pyfli.simulator.calibration.config#

Inputs and constants for calibrating the pyfli simulator against an experimental cube.

Functions

normalize_detector_type(detector_type)

normalize_model_type(model_type)

Classes

CalibrationInputs(data_path, detector_type, ...)

Everything the calibration needs.

PixelSelectionCriteria([min_signal_photons, ...])

Thresholds that decide whether a pixel carries sample fluorescence or only detector/background noise.

normalize_model_type(model_type)[source]#
Parameters:

model_type (str)

Return type:

str

normalize_detector_type(detector_type)[source]#
Parameters:

detector_type (str)

Return type:

str

class PixelSelectionCriteria(min_signal_photons=50.0, snr_min=5.0, flatness_sigma=5.0, peak_window_bins=None, use_otsu='auto', otsu_min_separability=0.6, hot_pixel_factor=10.0, min_component_size=9, refine_user_mask=False)[source]#

Bases: object

Thresholds that decide whether a pixel carries sample fluorescence or only detector/background noise. See pixel_selection for the tests.

Parameters:
  • min_signal_photons (float)

  • snr_min (float)

  • flatness_sigma (float)

  • peak_window_bins (int | None)

  • use_otsu (str)

  • otsu_min_separability (float)

  • hot_pixel_factor (float)

  • min_component_size (int)

  • refine_user_mask (bool)

min_signal_photons: float = 50.0#
snr_min: float = 5.0#
flatness_sigma: float = 5.0#
peak_window_bins: int | None = None#
use_otsu: str = 'auto'#
otsu_min_separability: float = 0.6#
hot_pixel_factor: float = 10.0#
min_component_size: int = 9#
refine_user_mask: bool = False#
class CalibrationInputs(data_path, detector_type, model_type, irf_path=None, irf_mode='auto', bg_path=None, mask_path=None, reference_path=None, reference_source='auto', reference_alpha='auto', laser_freq_mhz=80.0, bin_radius=0, bit_depth=None, jitter='auto', mono_fraction=None, prior_inflation=1.0, optimize_irf=True, optimize_noise=True, optimize_priors=True, reference_weight=0.05, n_exp_pixels=20000, n_sim_pixels=2000, n_fit_pixels=1500, n_validation_pixels=6000, n_bank_pixels=20000, bank_rounds=3, max_evals_stage1=120, max_evals_stage2=1500, target_coverage=0.99, n_coverage_pixels=20000, max_coverage_iter=10, seed=0, output_dir=None, selection=<factory>)[source]#

Bases: object

Everything the calibration needs.

Parameters:
  • data_path (str) – Raw 3D decay data (.sdt, .ptu, .tif, .npy, …), loaded via pyfli.io.DataOperations.

  • detector_type (str) – “continuous” (gated/ICCD-like) or “discrete” (TCSPC photon counting).

  • model_type (str) – “bi_exponential” or “mono_exponential”.

  • irf_path (str | None) – Experimental IRF. When omitted the IRF is simulated with pyfli.simulator.IRFGenerator.gaussianExpIRF and its parameters are optimised.

  • mask_path (str | None) – Boolean mask of sample pixels. When omitted, one is derived automatically.

  • reference_path (str | None) – Optional parameter maps (AlliGator folder, SPCImage folder, or a pyfli session .npy file / folder) used to initialise and regularise the priors.

  • target_coverage (float) – Required fraction of experimental pixels inside the simulated distribution for every coverage statistic (raw phasors h=1/2, photons, rising edge, background); see coverage. After the best-fit calibration the config is widened until this is reached, so that the experiment is a subset of what the simulator produces. 0 keeps the best-fit config.

  • n_coverage_pixels (int) – Simulated pixels per coverage check.

  • max_coverage_iter (int) – Maximum number of widening steps.

  • irf_mode (str)

  • bg_path (str | None)

  • reference_source (str)

  • reference_alpha (str)

  • laser_freq_mhz (float)

  • bin_radius (int)

  • bit_depth (int | None)

  • jitter (bool | str)

  • mono_fraction (float | None)

  • prior_inflation (float)

  • optimize_irf (bool)

  • optimize_noise (bool)

  • optimize_priors (bool)

  • reference_weight (float)

  • n_exp_pixels (int)

  • n_sim_pixels (int)

  • n_fit_pixels (int)

  • n_validation_pixels (int)

  • n_bank_pixels (int)

  • bank_rounds (int)

  • max_evals_stage1 (int)

  • max_evals_stage2 (int)

  • seed (int)

  • output_dir (str | None)

  • selection (PixelSelectionCriteria)

data_path: str#
detector_type: str#
model_type: str#
irf_path: str | None = None#
irf_mode: str = 'auto'#
bg_path: str | None = None#
mask_path: str | None = None#
reference_path: str | None = None#
reference_source: str = 'auto'#
reference_alpha: str = 'auto'#
laser_freq_mhz: float = 80.0#
bin_radius: int = 0#
bit_depth: int | None = None#
jitter: bool | str = 'auto'#
mono_fraction: float | None = None#
prior_inflation: float = 1.0#
optimize_irf: bool = True#
optimize_noise: bool = True#
optimize_priors: bool = True#
reference_weight: float = 0.05#
n_exp_pixels: int = 20000#
n_sim_pixels: int = 2000#
n_fit_pixels: int = 1500#
n_validation_pixels: int = 6000#
n_bank_pixels: int = 20000#
bank_rounds: int = 3#
max_evals_stage1: int = 120#
max_evals_stage2: int = 1500#
target_coverage: float = 0.99#
n_coverage_pixels: int = 20000#
max_coverage_iter: int = 10#
seed: int = 0#
output_dir: str | None = None#
selection: PixelSelectionCriteria#
property laser_period_ns: float#
property is_bi: bool#