pyfli.simulator.separate.model_simulator#
Generate mono- and bi-exponential model parameters and simulated TCSPC observations.
This module belongs to pyfli.simulator.separate and is part of PyFLI synthetic
FLI/FLIM data generation, hardware noise modeling, calibration, and validation tools.
Public API includes classes FLIModelSimulator.
Shared IRF/timing setup, n_cycles range validation, and TCSPC photon-binning logic
live in pyfli.simulator.sim_engine_common.
Classes
|
Run the flimodel simulator routine. |
- class FLIModelSimulator(irf_full, tau2=(1, 0.5), tau2_dist='normal', tau2_beta_range=(4.8, 0.2), efficiency=(5, 5), A1_fraction=(5, 5), photo_count=(1.0, 1.0), mono_fraction=0.2, bit=8, n_cycles=800_000, dcr=0.05, laser_feq=80, pileup_mode='wrap', seed=None, **kwargs)[source]#
Bases:
BaseFLIEngineRun the flimodel simulator routine. observations. The class is useful for controlled model-generation experiments independent of image geometry.
- Parameters:
irf_full (
np.ndarray) – Full instrument response function sampled over the decay window.tau2 (
tuple[int,float]) – Long lifetime component.tau2_dist (
str) – Distribution used to sample donor-only lifetimes.tau2_beta_range (
tuple[float,]) – Shape-parameter range for beta-distributed tau2 values.efficiency (
tuple[int,]) – FRET transfer efficiency used to derive simulated lifetime components.A1_fraction (
tuple[int,]) – Amplitude fraction assigned to the first exponential component.photo_count (
tuple[float,int]) – Expected photon count used to scale the simulated decay.mono_fraction (
float) – Fraction of pixels or events assigned to the mono-exponential component.bit (
int) – Bit depth or quantization setting for simulated detector output.n_cycles (
int | tuple[int,int]) – Number of excitation cycles used when constructing the simulated decay. A bare int is the upper bound (lower bound fixed at 1000); a(low, high)tuple sets both bounds, and both must be >= 1000. The per-call cycle count is drawn from a Beta distribution (shaped byphoto_count) over that range.dcr (
float) – Detector dark-count rate used by the noise model.laser_feq (
int) – Laser repetition frequency used by the simulation.pileup_mode (
str) – ‘wrap’ (default) folds photons back via modulo; ‘truncate’ drops them.seed (
int | None) – Seed for reproducible random sampling.**kwargs (
Any) – Additional keyword arguments forwarded to the underlying implementation.
- sample_mono_params()[source]#
Samples the lifetime parameter for a single pixel (pure single-exponential).
- get_model_analytical_decay(p)[source]#
Return model analytical decay.
- Parameters:
p (
Any) – Detector parameter object or fitted parameter vector.- Returns:
Object produced by get model analytical decay.
- Return type:
Any
- simulate_model_tcspc(p, n_cycles, mu_per_cycle)[source]#
Simulate model TCSPC.
- Parameters:
p (
Any) – Detector parameter object or fitted parameter vector.n_cycles (
int) – Number of simulated laser cycles.mu_per_cycle (
np.ndarray) – Expected photons per laser cycle in the TCSPC simulation.
- Returns:
Object produced by simulate model TCSPC.
- Return type:
Any