pyfli.simulator.calibration.irf_estimation#
IRF template and shift range for the simulator, from a measured IRF or the data.
Functions
|
|
|
Fit the pooled decay with: IRF(theta) + baseline b, two lifetimes, photon fraction f, and a background fraction beta. |
|
Sub-bin circular delay of |
|
Sub-bin peak position (centroid of the 5 bins around the maximum) per trace. |
|
Return a copy of |
|
|
|
Peak-normalised IRF template and the half-width (bins) of the per-pixel IRF shift range. |
|
|
|
Split the pre-edge background of a circular (TCSPC) model into dark counts and the |
Classes
|
- class IRFEstimate(source: str, template: ndarray, a_center: float, a_half: float, b_max: float, params: dict = <factory>, pooled_fit: dict = <factory>, library: ndarray | None = None, library_b_max: ndarray | None = None)[source]#
Bases:
object- Parameters:
- experimental_template(irf, mask)[source]#
Peak-normalised IRF template and the half-width (bins) of the per-pixel IRF shift range.
- estimate_irf(fm, decay, mask, irf=None, mode='auto')[source]#
mode: “experimental” uses the given IRF, “simulated” fits an EMG IRF, “auto” does both when an IRF is given and keeps the one whose pooled fit has the lower deviance. A measured IRF can be the wrong one for the data (other day, wavelength, detector setting); “auto” catches that.- Parameters:
fm (DecayForwardModel)
decay (ndarray)
mask (ndarray)
irf (ndarray | None)
mode (str)
- Return type:
- split_background(est, fm, bg_bins, slope, intercept)[source]#
Split the pre-edge background of a circular (TCSPC) model into dark counts and the
OffsetGenIRF baselineb, using the per-pixel regressionpre-edge level = intercept + slope * counts.A baseline
bon the peak-normalised IRF addsb / (sum(IRF) + b T)to every bin per signal photon, the same flat floor as dark counts in a pooled decay, so the pooled fit cannot separate them. Per pixel they differ: dark counts give a constant level (the intercept), the baseline a level proportional to the signal (the slope left over after the previous-pulse tail of the pooled-fit lifetimes). Setsest.b_max(b ~ U(0, b_max), sob_max = 2 b) andpooled_fit["irf_baseline_b"]; returns the dark-count rate per bin per pixel (the pooled background when the intercept is not positive). The counts include the dark counts themselves, sointercept = dcr (1 - slope n_active).- Parameters:
est (IRFEstimate)
fm (DecayForwardModel)
bg_bins (ndarray)
slope (float)
intercept (float)
- Return type:
- irf_theta_from_estimate(est)[source]#
- Parameters:
est (IRFEstimate)
- Return type:
- apply_irf_theta(est, fm, theta)[source]#
Return a copy of
estwith the optimiser’s IRF parameters applied.- Parameters:
est (IRFEstimate)
fm (DecayForwardModel)
theta (ndarray)
- Return type: