# pyFAI.app package

## pyFAI.app.average module

utility that averages out a serie of files

class `pyFAI.app.average.``ShellAverageObserver`

  Bases: `pyFAI.average.AverageObserver`

  Display average processing using a shell progress bar

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `algorithm_finished`(algorithm)

    Called when an algorithm is finished

  `algorithm_started`(algorithm)

    Called when an algorithm is started

  `frame_processed`(algorithm, frame_index, frames_count)

    Called after providing a frame to an algorithm

  `hide_info`()
  `image_loaded`(fabio_image, image_index, images_count)

    Called when an input image is loaded

  `process_finished`()

    Called when the full process is finished

  `process_started`()

    Called when the full processing is started

  `result_processing`(algorithm)

    Called before the result of an algorithm is computed

  `show_info`()

`pyFAI.app.average.``cleanup_input_paths`(input_paths)

  Clean up filename using :: to access to data inside file.

  Returns: | Returns a list of paths without directory separator inside the filename location.

`pyFAI.app.average.``main`()

`pyFAI.app.average.``parse_algorithms`(options)

  Return a list of initilized algorithms from the command line

`pyFAI.app.average.``parse_writer`(input_images, options, algorithms)

  Return a writer by using information from the command line

## pyFAI.app.benchmark module

utility to run the benchmark for azimuthal integration on images of various sizes

`pyFAI.app.benchmark.``main`()

## pyFAI.app.calib module

CLI tool for determining the geometry of a detector using a reference sample.

`pyFAI.app.calib.``main`()

## pyFAI.app.calib2 module

GUI tool for determining the geometry of a detector using a reference sample.

`pyFAI.app.calib2.``configure_parser_arguments`(parser)

`pyFAI.app.calib2.``displayExceptionBox`(message, exc_info)

  Display an exception as a MessageBox

  Parameters:

  - message (str) – A context message
  - exc_info (Union[tuple,Exception]) – An exception or the output of exc_info.

`pyFAI.app.calib2.``logUncaughtExceptions`(exceptionClass, exception, stack)

`pyFAI.app.calib2.``main`()

`pyFAI.app.calib2.``parse_options`()

  Returns parsed command line argument as an options object.

  Raises: | ExitException – In case of the use of –help in the comman line

`pyFAI.app.calib2.``parse_pixel_size`(pixel_size)

  Convert a comma separated sting into pixel size

  Parameters: | pixel_size (str) – String containing pixel size in micron
  Return type: | Tuple[float,float]
  Returns: | Returns floating point pixel size in meter

`pyFAI.app.calib2.``setup_model`(model, options)

  Setup the model using options from the command line.

  Parameters: | model (pyFAI.gui.model.CalibrationModel) – Model of the application

## pyFAI.app.check_calib module

DEPRECATED tool that checks a calibratation at the sub-pixel level

`pyFAI.app.check_calib.``main`()

## pyFAI.app.detector2nexus module

Converts a detector description into a NeXus detector usable by other pyFAI utilities

`pyFAI.app.detector2nexus.``main`()

## pyFAI.app.diff_map module

GUI interface for reduction of diffraction tomography experiments

`pyFAI.app.diff_map.``main`()

## pyFAI.app.diff_tomo module

CLI interface for diffraction tomography data reduction

class `pyFAI.app.diff_tomo.``DiffTomo`(nTrans=1, nRot=1, nDiff=1000)

  Bases: `pyFAI.diffmap.DiffMap`

  Basic class for diffraction tomography experiment using pyFAI.

  `__init__`(nTrans=1, nRot=1, nDiff=1000)

    Constructor of the class

    Parameters:

    - nTrans – number of translations
    - nRot – number of translations
    - nDiff – number of points in diffraction pattern

  `parse`(with_config=False)

    parse options from command line

`pyFAI.app.diff_tomo.``main`()

## pyFAI.app.drawmask module

Use silx library to provide a widget to customize a mask

class `pyFAI.app.drawmask.``AbstractMaskImageWidget`

  Bases: `PyQt5.QtWidgets.QMainWindow`

  Abstract window application which allow to create a mask manually.

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `saveAndClose`()
  `setOutputFile`(outputFile)

class `pyFAI.app.drawmask.``MaskImageWidget`

  Bases: `pyFAI.app.drawmask.AbstractMaskImageWidget`

  Window application which allow to create a mask manually. It is based on Silx library widgets.

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `getSelectionMask`()
  `setImageData`(image)

`pyFAI.app.drawmask.``main`()

`pyFAI.app.drawmask.``postProcessId21`(processFile, mask)

  Post process asked by Marine Cotte (ID21)

  TODO: Remove it outside if it is possible. Ask them if it is still used.

## pyFAI.app.eiger_mask module

extracts the mask from an Eiger master file.

`pyFAI.app.eiger_mask.``extract_mask`(infile)

  Retrieve the mask from an Eiger master file.

  Parameters: | infile – name of the Eiger master file

`pyFAI.app.eiger_mask.``main`()

## pyFAI.app.integrate module

GUI tool for configuring azimuthal integration on series of files.

class `pyFAI.app.integrate.``DataInfo`(source, source_id, frame_id, fabio_image, data_id, data, header, source_filename)

  Bases: `tuple`

  `data`

    Alias for field number 5

  `data_id`

    Alias for field number 4

  `fabio_image`

    Alias for field number 3

  `frame_id`

    Alias for field number 2

  `header`

    Alias for field number 6

  `source`

    Alias for field number 0

  `source_filename`

    Alias for field number 7

  `source_id`

    Alias for field number 1

class `pyFAI.app.integrate.``DataSource`(statistics)

  Bases: `object`

  Source of data to integrate.

  `__init__`(statistics)

    Initialize self. See help(type(self)) for accurate signature.

  `append`(item)
  `approximate_count`()

    Returns the number of frames contained in the data source.

    To speed up the processing time, this value could be approximate. Especially with file series, and EDF multiframes.

    Type: | int

  `basename`()

    Returns a basename identifying this data source

  `count`()
  `frames`()

    Iterate all the frames from this data source.

    Return type: | Iterator[DataInfo]

  `is_multiframe`()
  `is_single_multiframe`()

class `pyFAI.app.integrate.``IntegrationObserver`

  Bases: `object`

  Interface providing access to the to the processing of the process function.

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `data_result`(data_info, result)

    Called after each data processing, with the result

    Parameters:

    - data_info (DataInfo) – Contains data and metadata from the data to integrate
    - result (object) – Result of the integration.

  `is_interruption_requested`()
  `processing_data`(data_info, approximate_count=None)

    Start processing the data data_info

    Parameters:

    - data_info (DataInfo) – Contains data and metadata from the data to integrate
    - approximate_count (int) – If set, the amount of total data to process have changed

  `processing_finished`()

    Called when the full processing is finisehd (interupted or not).

  `processing_interrupted`(reason=None)

    Called before processing_finished if the processing was interrupted.

    Parameters: | error ([str,Exception,None]) – A reason of the interruption.

  `processing_started`(data_count)

    Called before starting the full processing.

    Parameters: | data_count (int) – Number of data to integrate

  `processing_succeeded`()

    Called before processing_finished if the processing succedded.

  `request_interruption`()
  `worker_initialized`(worker)

    Called when the worker is initialized

    Parameters: | data_count (int) – Number of data to integrate

class `pyFAI.app.integrate.``MultiFileWriter`(output_path, mode='error')

  Bases: `pyFAI.io.Writer`

  Broadcast writing to differnet files for each frames

  `__init__`(output_path, mode='error')

    Constructor of the class

  `close`()
  `init`(fai_cfg=None, lima_cfg=None)

    Creates the directory that will host the output file(s) :param fai_cfg: configuration for worker :param lima_cfg: configuration for acquisition

  `prepare_write`(data_info, engine)
  `write`(data)

    To be implemented

class `pyFAI.app.integrate.``ShellIntegrationObserver`

  Bases: `pyFAI.app.integrate.IntegrationObserver`

  Implement IntegrationObserver as a shell display.

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `hide_info`()
  `processing_data`(data_info, approximate_count=None)

    Start processing the data data_info

    Parameters:

    - data_info (DataInfo) – Contains data and metadata from the data to integrate
    - approximate_count (int) – If set, the amount of total data to process have changed

  `processing_finished`()

    Called when the full processing is finisehd (interupted or not).

  `processing_started`(data_count)

    Called before starting the full processing.

    Parameters: | data_count (int) – Number of data to integrate

  `show_info`()

class `pyFAI.app.integrate.``Statistics`

  Bases: `object`

  Instrument the application to collect statistics.

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `execution_finished`()
  `execution_started`()
  `preprocessing`()

    Try to extract the preprocessing time

  `processing_per_frame`()

    Average time spend to process a frame

  `reading_per_frame`()

    Average time spend to read a frame

  `time_processing`()
  `time_reading`()
  `total_execution`()
  `total_processing`()
  `total_reading`()

`pyFAI.app.integrate.``get_monitor_value`(image, monitor_key)

  Return the monitor value from an image using an header key.

  Parameters:

  - image (fabio.fabioimage.FabioImage) – Image containing the header
  - monitor_key (str) – Key containing the monitor

  Returns: | returns the monitor else returns 1.0
  Return type: | float

`pyFAI.app.integrate.``integrate_gui`(options, args)

`pyFAI.app.integrate.``integrate_shell`(options, args)

`pyFAI.app.integrate.``main`()

`pyFAI.app.integrate.``process`(input_data, output, config, monitor_name, observer, write_mode='error')

  Integrate a set of data.

  Parameters:

  - input_data (List[str]) – List of input filenames
  - output (str) – Filename of directory output
  - config (dict) – Dictionary to configure pyFAI.worker.Worker
  - observer (IntegrationObserver) – Observer of the processing
  - write_mode (str) – Specify options to deal with IO errors

## pyFAI.app.mx_calibrate module

calibrate the distance of a detector from a set of powder diffraction patterns

`pyFAI.app.mx_calibrate.``main`()

## pyFAI.app.recalib module

DEPRECATED tool for refining the geometry of a detector using a reference sample and a previously known calibration file.

`pyFAI.app.recalib.``main`()

## pyFAI.app.saxs module

Integrate 2D images into SAXS patterns. Also used in PDF measurements

`pyFAI.app.saxs.``main`()

## pyFAI.app.setup module

`pyFAI.app.setup.``configuration`(parent_package='', top_path=None)

## pyFAI.app.waxs module

Integrate 2D images into powder diffraction patterns

`pyFAI.app.waxs.``main`()

## Module contents

Common for all applications within pyFAI