pyfli.simulator.calibration.folder_calibration#

Calibrate every experiment in a folder, then combine them.

Functions

_check_irf(irf_path)

_reusable(cfg_path, mask_path, irf_path)

An existing calibration made with the same mask and IRF.

_stem(path)

calibrate_folder(folder, detector_type, ...)

Calibrate each data file in folder separately, then combine the calibrations.

find_data_files(folder[, extensions, pattern])

Raw decay files directly inside folder (not in sub-folders), sorted by name.

match_masks(data_files, mask_folder[, ...])

data file -> mask file for every data file whose name matches a mask in mask_folder: the mask's name (without extension) is the data file's name plus one of suffixes (case-insensitive).

find_data_files(folder, extensions=DATA_EXTENSIONS, pattern='*')[source]#

Raw decay files directly inside folder (not in sub-folders), sorted by name.

Parameters:
Return type:

list[str]

match_masks(data_files, mask_folder, extensions=MASK_EXTENSIONS, suffixes=MASK_SUFFIXES)[source]#

data file -> mask file for every data file whose name matches a mask in mask_folder: the mask’s name (without extension) is the data file’s name plus one of suffixes (case-insensitive). With several candidates, the exact name wins. Data files without a mask, and masks without a data file, are logged as warnings.

Parameters:
Return type:

dict[str, str]

calibrate_folder(folder, detector_type, model_type, output_root=None, mask_folder=None, irf_path=None, extensions=DATA_EXTENSIONS, pattern='*', force=False, combine=True, weighting='equal', verify=True, n_verify_pixels=10000, **calibration_kwargs)[source]#

Calibrate each data file in folder separately, then combine the calibrations.

mask_folder: folder of masks matched to the data files by name (see the module docstring); files without one get an automatic mask. irf_path: one IRF file for all experiments, or None to simulate each experiment’s IRF. calibration_kwargs go to CalibrationInputs for every file (e.g. bin_radius, irf_mode, target_coverage, budgets); mask_path and reference_path are per-experiment and not accepted here. A file whose calibration fails is reported in failed and left out of the combination. verify checks, per experiment, that its pixels are covered by its own values and by the whole combined setup (verify_combined()), simulating n_verify_pixels pixels per check.

Parameters:
  • folder (str)

  • detector_type (str)

  • model_type (str)

  • output_root (str | None)

  • mask_folder (str | None)

  • irf_path (str | None)

  • pattern (str)

  • force (bool)

  • combine (bool)

  • weighting (str)

  • verify (bool)

  • n_verify_pixels (int)

Return type:

dict