pyfli.simulator.main_common#

Shared engine-wrapping pipelines for the continuous (ICCD-style) and discrete (TCSPC-style) simulator pairs.

combined/main_factory.py (MacroSimulator, TCSPCSimulator, wrapping FLIEngine) and separate/main_factory_gen.py (ContinuousSimulator, PhotonCountSimulator, wrapping FLIModelSimulator) implement the identical noise/scaling pipeline; they differ only in which engine class they wrap, the names of a few methods on that engine, and whether the “mono” branch trims the returned maps dict. Subclasses declare those differences as class attributes; this module owns the actual pipeline math so it is defined exactly once.

Functions

_build_maps(p, photon_count, mono_only_maps, ...)

Build the parameter-maps dict, optionally trimmed for mono pixels, in the solver's convention: photon_count_map is S, v_shift_map the mean background per bin, h_shift_map the jitter delay in ns (h_shift_jit_map is the same delay in bins).

Classes

BaseContinuousSimulator(irf_data[, sensor_type])

Shared __call__ pipeline for MacroSimulator/ContinuousSimulator: samples lifetime parameters, scales the expected decay (the engine's expected_decay(), i.e. the solver's forward model, circular for pileup_mode="wrap") to a Beta-sampled peak intensity, then applies, in the order of a camera, QE, jitter, shot noise on the signal, dark counts, read noise, rounding and clipping.

BaseDiscreteSimulator(irf_data[, sensor_type])

Shared __call__ pipeline for TCSPCSimulator/PhotonCountSimulator: samples lifetime parameters, runs a TCSPC photon-by-photon histogram (with the timing jitter applied to the photons), and adds dark counts and counter clipping.

class BaseContinuousSimulator(irf_data, sensor_type='continuous', **cfg)[source]#

Bases: object

Shared __call__ pipeline for MacroSimulator/ContinuousSimulator: samples lifetime parameters, scales the expected decay (the engine’s expected_decay(), i.e. the solver’s forward model, circular for pileup_mode="wrap") to a Beta-sampled peak intensity, then applies, in the order of a camera, QE, jitter, shot noise on the signal, dark counts, read noise, rounding and clipping. fit_map is the expectation of the result before read noise, rounding and clipping (signal + dark counts).

Subclasses set the following class attributes:

engine_clstype

The engine class to wrap (FLIEngine / FLIModelSimulator).

sample_params_namestr

Name of the engine method that samples lifetime parameters.

analytical_decay_namestr

Name of the engine method that returns the clean un-convolved decay (the pipeline itself uses the engine’s expected_decay).

mono_only_mapsbool

Whether p["mono"] trims the returned maps dict down to {tau_map, photon_count_map, mono_map} (True, as in ContinuousSimulator) or the full map set is always returned regardless of mono status (False, as in MacroSimulator).

Parameters:
engine_cls: type#
sample_params_name: str#
analytical_decay_name: str#
mono_only_maps: bool = False#
class BaseDiscreteSimulator(irf_data, sensor_type='discrete', **cfg)[source]#

Bases: object

Shared __call__ pipeline for TCSPCSimulator/PhotonCountSimulator: samples lifetime parameters, runs a TCSPC photon-by-photon histogram (with the timing jitter applied to the photons), and adds dark counts and counter clipping. fit_map is the exact expectation of the histogram, the engine’s expected_decay() (the solver’s forward model, circular for pileup_mode="wrap") plus the dark counts.

Subclasses set the following class attributes:

engine_clstype

The engine class to wrap (FLIEngine / FLIModelSimulator).

sample_params_namestr

Name of the engine method that samples lifetime parameters.

analytical_decay_namestr

Name of the engine method that returns the clean un-convolved decay (the pipeline itself uses the engine’s expected_decay).

simulate_tcspc_namestr

Name of the engine method that runs the TCSPC photon histogram.

mono_only_mapsbool

As in BaseContinuousSimulator.

Parameters:
engine_cls: type#
sample_params_name: str#
analytical_decay_name: str#
simulate_tcspc_name: str#
mono_only_maps: bool = False#