pyfli.simulator.calibration.pooled_calibration#
One simulator config that covers several experiments.
Functions
|
Fraction of a pixel's counts that is flat background: dark counts plus the IRF baseline b. |
|
|
|
One dark-count rate cannot reproduce experiments whose backgrounds differ 100-fold, and too much background pulls the raw phasors of clean experiments out of the simulated cloud. |
|
Beta on |
|
name -> calibrated_sim_config.json for every calibrated experiment under |
|
Rebuild the calibrated |
|
|
|
Equal-size random subsets of each experiment's sample pixels; returns (decays (N, T), experiment index (N,)). |
Classes
|
Build one covering simulator config from per-experiment calibrations. |
|
|
|
- class SessionCalibration(name: str, folder: str, json_path: str, payload: dict, state: CalibrationState)[source]#
Bases:
object- Parameters:
name (str)
folder (str)
json_path (str)
payload (dict)
state (CalibrationState)
- state: CalibrationState#
- load_session_calibration(json_path, name='', folder='')[source]#
Rebuild the calibrated
CalibrationStatefrom acalibrated_sim_config.json.- Parameters:
- Return type:
- covering_beta(samples, weights, offset, scale, q_exp=(0.01, 0.99), q_cov=(1e-3, 1 - 1e-3), min_shape=1.0)[source]#
Beta on
[offset, offset + scale]matched to the weighted mixture ofsamples, then widened until each sample set’sq_expinterval lies inside the Beta’sq_covinterval.
- combine_states(sessions, weights, fm, n_samples=20000, seed=0)[source]#
- Parameters:
sessions (list[SessionCalibration])
weights (ndarray)
fm (DecayForwardModel)
n_samples (int)
seed (int)
- Return type:
- covering_background(sessions, library, n_samples, rng, q=0.995)[source]#
One dark-count rate cannot reproduce experiments whose backgrounds differ 100-fold, and too much background pulls the raw phasors of clean experiments out of the simulated cloud. The combined config therefore uses the lowest dark-count rate and gets the rest from the per-pixel IRF baseline
b ~ U(0, b_max_k)(background proportional to signal). Background belongs to the detector channel, so each library IRF k gets its ownb_max_k, chosen so that experiment k’s background fractions are reached. A single shared range would make the low-background channel’s clean pixels rare.
- pooled_pixels(sessions, n_per_exp, seed=0, decay_name='clean_decay.npy', mask_name='final_mask.npy')[source]#
Equal-size random subsets of each experiment’s sample pixels; returns (decays (N, T), experiment index (N,)).
- class PooledResult(config: dict, sim_generator_kwargs: dict, state: CalibrationState, coverage: DataFrame, prior_report: dict, validation: dict, output_dir: str, files: dict = <factory>)[source]#
Bases:
object- Parameters:
- state: CalibrationState#
- class PooledCalibrator(session_jsons, output_dir, weighting='equal', n_per_exp=4000, n_validation=20000, target_coverage=0.90, max_flatten=8, flatten_factor=0.8, seed=0, folders=None)[source]#
Bases:
objectBuild one covering simulator config from per-experiment calibrations.
- Parameters:
session_jsons (
dict[str,str]) – experiment name ->calibrated_sim_config.jsonof that experiment.weighting (
str) – “equal” (each experiment counts the same) or “pixels” (by number of sample pixels).target_coverage (
float) – Required fraction of every experiment’s pixels inside the simulated phasor clouds (harmonics 1 and 2). Priors are flattened up tomax_flattentimes to reach it.output_dir (str)
n_per_exp (int)
n_validation (int)
max_flatten (int)
flatten_factor (float)
seed (int)