P10Loader#

class cdiutils.io.P10Loader(experiment_data_dir_path, scan=None, sample_name=None, detector_name=None, flat_field=None, alien_mask=None, hutch='EH1', **kwargs)[source]#

Bases: Loader

Data loader for PETRA III P10 beamline.

Handles HDF5 master files and .fio motor position files from P10 beamline at PETRA III, supporting Eiger4M and Eiger500k detectors. Data is organised in separate directories per scan.

angle_names#

Mapping from canonical names to P10 motor names:

  • sample_outofplane_angle -> "om" (EH1) or "samth" (EH2)

  • sample_inplane_angle -> "phi" (EH1 only)

  • detector_outofplane_angle -> "del" (EH1) or "e2_t02" (EH2)

  • detector_inplane_angle -> "gam" (EH1 only)

authorised_detector_names#

Tuple of supported detectors: ("eiger4m", "e2500").

Notes

EH2 (experimental hutch 2) has different motor names and lacks in-plane rotation stages. Specify hutch="EH2" during initialisation for EH2 experiments.

See also

Loader for factory method and base class documentation.

The P10Loader class handles data loading from the PETRA III P10 beamline. It is typically used internally by BcdiPipeline.

See Loader for inherited methods.

angle_names = {'detector_inplane_angle': 'gam', 'detector_outofplane_angle': 'del', 'sample_inplane_angle': 'phi', 'sample_outofplane_angle': 'om'}#
authorised_detector_names = ('eiger4m', 'e2500')#
__init__(experiment_data_dir_path, scan=None, sample_name=None, detector_name=None, flat_field=None, alien_mask=None, hutch='EH1', **kwargs)[source]#

Initialise P10 data loader.

Parameters:
  • experiment_data_dir_path (str) – Root data directory containing scan subdirectories. Expected structure: {root}/{sample}_{scan:05d}/{detector}/.

  • scan (int) – Scan number (5-digit zero-padded in file paths).

  • sample_name (str) – Sample identifier matching directory names.

  • detector_name (str) – Detector identifier ("eiger4m" or "e2500"). If None, defaults to "e4m".

  • flat_field (ndarray | str) – Flat-field correction array or path to .npy/.npz file.

  • alien_mask (ndarray | str) – Bad pixel mask array or path.

  • hutch (str) – Experimental hutch ("EH1" or "EH2"). Affects motor name mappings. Defaults to "EH1".

  • **kwargs – Additional parameters (reserved for future use).

Raises:

ValueError – If hutch is not "EH1" or "EH2".

load_detector_data(scan=None, sample_name=None, roi=None, rocking_angle_binning=None, binning_method='sum')[source]#

Load raw detector frames from P10 HDF5 file.

Retrieves 3D detector data array with optional ROI, binning, flat-field correction, and masking. Automatically applies detector chip gap mask for Eiger detectors.

Parameters:
  • scan (int) – Scan number. If None, uses self.scan.

  • sample_name (str) – Sample name. If None, uses self.sample_name.

  • roi (tuple[slice]) – Region of interest as tuple of slices or integers.

  • rocking_angle_binning (int) – Binning factor along rocking curve axis.

  • binning_method (str) – Binning operation ("sum", "mean", or "max"). Default "sum".

Returns:

Preprocessed detector data with shape (n_frames//binning, n_y, n_x).

Return type:

None

load_motor_positions(scan=None, sample_name=None, roi=None, rocking_angle_binning=None)[source]#

Load diffractometer motor angles from .fio file.

Parses P10’s text-based .fio files to extract motor positions, applying same ROI and binning as detector data.

Parameters:
  • scan (int) – Scan number. If None, uses self.scan.

  • sample_name (str) – Sample name. If None, uses self.sample_name.

  • roi (tuple[slice]) – ROI tuple. Only first element (rocking curve axis) is used.

  • rocking_angle_binning (int) – Binning factor matching detector binning. Angles are averaged when binned.

Returns:

Motor angles with canonical keys (see angle_names for P10-specific mapping). Values are scalars (fixed motor) or 1D arrays (scanned motor).

Return type:

dict

load_energy(scan=None, sample_name=None)[source]#

Load X-ray beam energy from .fio file.

Parameters:
  • scan (int) – Scan number. If None, uses self.scan.

  • sample_name (str) – Sample name. If None, uses self.sample_name.

Returns:

Beam energy in eV from fmbenergy motor, or None if not found.

Return type:

float

load_det_calib_params()[source]#

Load detector calibration parameters.

Returns:

None. P10 does not store calibration in scan files. Calibration must be determined separately.

Return type:

dict

load_detector_shape(scan=None)[source]#

Load detector shape.

Returns:

None. Shape is determined from data files directly.

Return type:

tuple

See Also#

Loader : Base loader class ID01Loader : Similar loader for ESRF ID01