integrator.integrator module#

class integrator.integrator.AIConfiguration(n_pts: int, unit: str, polarization_factor: float, correct_solid_angle: bool, detector: str, poni_file: str, mask_file: str, flatfield_file: str, dark_file: str, error_model: str, azimuthal_range: tuple, radial_range: tuple, ai_method: str, trim_method: str = None, trim_n_pts: int = 0, trim_bounds: tuple = None, do_stack_mean: bool = False, pixel_splitting: str = 'no', average_xy: str = None)#

Bases: object

n_pts: int#
unit: str#
polarization_factor: float#
correct_solid_angle: bool#
detector: str#
poni_file: str#
mask_file: str#
flatfield_file: str#
dark_file: str#
error_model: str#
azimuthal_range: tuple#
radial_range: tuple#
ai_method: str#
trim_method: str = None#
trim_n_pts: int = 0#
trim_bounds: tuple = None#
do_stack_mean: bool = False#
pixel_splitting: str = 'no'#
average_xy: str = None#
integrator.integrator.create_azimuthal_integrator(ai_config)#

Create a AzimuthalIntegrator object from a configuration.

Parameters:

ai_config (AIConfiguration) – Data structure describing the azimuthal integration configuration

Returns:

azimuthal_integrator – Azimuthal integrator instance

Return type:

pyFAI.azimuthalIntegrator.AzimuthalIntegrator

class integrator.integrator.StackIntegrator(ai_config, logger=None, existing_output='skip', extra_options=None)#

Bases: object

Initialize an Integrator object.

Parameters:
  • ai_config (AIConfiguration) – Azimuthal Integration configuration

  • logger (Logger, optional) – Logger object. If not provided, messages are shown with the print() function

  • existing_output (str, optional) –

    What do do in the case where the output file already exists:
    • ”raise”: raise an error

    • ”overwrite”: overwrite the existing file

    • ”skip”: do not process the current stack

  • extra_options (dict, optional) –

    Dictionary of advanced options. Current values are:
    • ”scan_num_as_h5_entry”: False

      Whether to use the current scan number as HDF5 entry.

get_current_config(data_location=None)#
integrate_image(image, azimuth_range=None)#
process_data(data, output)#

Perform azimuthal integration on data.

Parameters:
  • data (DataUrl or array) – Data to process (stack of images)

  • output (str or array) – Output file or array

Notes

Processing from/to in-memory arrays is not supported yet

integrator.integrator.result_already_exists(out_fname, config_path, existing_output_behavior, current_config, sections_to_ignore=None, logger=None)#

Return true if a given filename contains integration result with the same configuration. Basically: “was this data already integrated ?”

Parameters:
  • out_fname (str) – Path to the output file

  • config_path (str) – Configuration within the output file (eg. “azimuthal integration/configuration”)

  • existing_output_behavior (str) –

    What to do if the results already exist (possibly with the same configuration). Possible values are:
    • ”skip”: don’t overwrite the existing results, proceed to the next stack

    • ”overwrite”: discard existing results, re-do processing and overwrite the existing file

    • ”raise”: raise an error

  • current_config (dict) – Dictionary with the current azimuthal integration configuration

  • sections_to_ignore (list, optional) – Which sections to ignore when comparing configurations

  • logger (logging object, optional) – Logging object. If not provided, messages will be sent in stdout