pyfli.simulator.calibration.prior_estimation#
Beta priors for the pyfli simulator config.
Functions
|
Method-of-moments Beta fit on (values - offset) / scale, with the variance multiplied by |
|
|
|
|
|
Beta over A / (2**bit - 1). |
|
Beta over n_cycles in [lo, hi] such that |
|
Per-pixel Poisson fits with the IRF and the background fixed, parameterised like the simulator: bi -> (tau2, E, A1, N), mono -> (tau, N). |
|
(offset, scale) for the simulator's tau2_beta_range, with a 20 % margin. |
Classes
- class BetaPrior(a: float, b: float, offset: float = 0.0, scale: float = 1.0)[source]#
Bases:
object
- fit_beta(values, offset=0.0, scale=1.0, inflation=1.0)[source]#
Method-of-moments Beta fit on (values - offset) / scale, with the variance multiplied by
inflation. The values are winsorized at their 0.5 / 99.5 percentiles (capped, not dropped), which limits single outliers without the ~3 % variance loss that trimming the tails causes.
- class PriorSet(tau2: pyfli.simulator.calibration.prior_estimation.BetaPrior, efficiency: pyfli.simulator.calibration.prior_estimation.BetaPrior | None, alpha1: pyfli.simulator.calibration.prior_estimation.BetaPrior | None, photon: pyfli.simulator.calibration.prior_estimation.BetaPrior, photon_range: tuple[float, float], bit: int, mono_fraction: float, source: str, reference_moments: dict = <factory>)[source]#
Bases:
object- Parameters:
- quick_pixel_fits(fm, decays, irf_norm, bg_per_bin, is_bi, init)[source]#
Per-pixel Poisson fits with the IRF and the background fixed, parameterised like the simulator: bi -> (tau2, E, A1, N), mono -> (tau, N). Bi-exponential fits are MAP with a weak Gaussian prior around the pooled fit (
BI_FIT_PRIOR_SD). They only initialise the priors; the simulation-based search refines them.
- photon_prior_discrete(counts, n_active_bins, dcr, inflation=1.0, active_fraction=1.0)[source]#
Beta over n_cycles in [lo, hi] such that
0.01 * n_cycles * active_fractionmatches the observed signal photons.active_fractionis the expected share of signal photons that land in active time bins (photons in bins outside the acquisition window are lost, in the data and in the windowed simulation).
- photon_prior_continuous(peaks, data_max, bit, qe_on=True, inflation=1.0, scale_corr=1.0)[source]#
Beta over A / (2**bit - 1). The observed peak is
A * QEwith QE ~ U(0.15, 0.35) independent of A, so E[A] = E[peak] / E[QE] and E[A^2] = E[peak^2] / E[QE^2].