pyfli.simulator.calibration.sim_bridge#
Build the pyfli simulator config from calibrated quantities and run SimGenerator.
Functions
|
Config dict for |
|
|
|
Rebuild the calibrated |
|
|
|
|
|
Simulate |
|
Simulate an |
|
Stack |
|
Nested dicts / lists / tuples / NumPy values converted to JSON-serialisable Python types. |
Classes
|
|
|
Wraps a |
- build_sim_config(priors, detector_type, dcr, laser_freq_mhz, jitter=True)[source]#
Config dict for
SimGenerator/PhotonCountSimulator/ContinuousSimulator.
- class MultiIRFSimGenerator(irf_cube, config, a_range, b_range, weights=None, b_ranges=None, **kwargs)[source]#
Bases:
SimGeneratorSimGeneratorwhose IRF is drawn per pixel from a library:irf_cube[0, k]for k = 0..K-1, each with the usualOffsetGenshiftaand baselineb. Used for one config covering experiments recorded with different IRFs (e.g. two detector channels). The drawn index is returned asirf_index.b_rangesoptionally gives each IRF its own baseline range (background belongs to the detector channel, like the IRF).
- class TimeWindowedGenerator(generator, inactive_bins)[source]#
Bases:
objectWraps a
SimGeneratorand zeroesinactive_binsof every simulated decay: the time bins outside the detector’s acquisition window (e.g. outside the TCSPC TAC range), which never record a count in the experiment. The pyfli simulator fills all bins, so without this step the simulated decays could not contain the experimental ones. Ground-truthphoton_countstays the simulator’s expected photon number over the full period.- Parameters:
generator (SimGenerator)
- make_generator(irf_cube, config, a_range, b_range, irf_weights=None, irf_b_ranges=None, inactive_bins=None)[source]#
- draw_pixels(gen, n, seed=0)[source]#
ncalls ofgen.simulate_once(), reproducible for a givenseed: pixeligets the engine seedseed * 1_000_003 + iand the global NumPy RNG is seeded once (and restored afterwards).seed=Nonedraws fresh random numbers.
- stack_outputs(outs)[source]#
Stack
simulate_onceoutputs:decay/irfas(n, T), ground truth as(n,).
- simulate_batch(irf_cube, config, a_range, b_range, n, seed=0, irf_b_ranges=None, inactive_bins=None)[source]#
Simulate
npixels; returns stacked decays and ground-truth parameters (stack_outputs()).
- to_jsonable(obj)[source]#
Nested dicts / lists / tuples / NumPy values converted to JSON-serialisable Python types.
- load_calibrated_generator(json_path)[source]#
Rebuild the calibrated
SimGeneratorfromcalibrated_sim_config.json(and thecalibrated_irf.npynext to it). Use it as:gen = load_calibrated_generator(".../calibrated_sim_config.json") sample = gen.simulate_once() # dict with decay, irf, tau1, tau2, alpha1, ...
- Parameters:
json_path (str)
- Return type: