Count-domain fitting
- asymmetry.core.fitting.count_domain.SEED_FROM_DATA
Seed sentinel — give this as a parameter’s
valueand the count-fit driver computes the seed from the data instead. Supported forN0, whose right scale is a per-run count level no caller can know in advance — a generic seed drops the forward/backward fit into a spurious minimum (seefit_fb_alpha()). OmittingN0from the set entirely does the same thing; the sentinel exists for callers that want to state the bounds.
- asymmetry.core.fitting.count_domain.fit_fb_alpha(dataset, forward_group, backward_group, model_fn, params, *, cost='poisson', t_min=None, t_max=None, exclude=None, estimate_beta=False, minos=False, cancel_callback=None)[source]
Prepare and jointly fit F/B counts with shared physics and balance.
Physics amplitudes are percent; scales/backgrounds are counts per packed bin.
estimate_betapermits a shared backward amplitude ratio, including fixed beta constraints. Otherwise beta is absent. Gaussian cost uses retained count errors; Poisson cost requires uncorrected integer acquisition observations. Optional t0, lifetime, deadtime and pulse nuisances use the same joint solver.
- asymmetry.core.fitting.count_domain.fit_single_histogram(dataset, group_id, model_fn, params, *, side='forward', cost='poisson', t_min=None, t_max=None, exclude=None, minos=False, cancel_callback=None)[source]
Fit one detector group’s raw counts (the musrfit fittype-0 analogue).
The count model is
N0 * exp(-t/tau) * (1 + s*A*P(t)) + bgwithsthe forward (+1) / backward (-1) sign set byside("selected"uses +1).paramssupplies the nuisancesN0andbackgroundplus the physics model parameters; the muon lifetime is held fixed at the physical value.Scale: the physics model’s asymmetry parameters (
A/A0,baseline) are in percent (0–100), as everywhere else in the fitting layer —asymmetry.core.fitting.count_domain._percent_to_fractiondivides the 100 out internally so1 + acombines a true fraction with the counts. Seed and readAin percent. The data here is raw counts, so the percent/fraction question touches only the parameters, not the arrays.Optional window/nuisance flexibility, all no-ops unless requested:
excludedrops an interior time window from the fit; a freet0parameter shifts the model time axis; freelambda_base/beta_baseparameters add a stretched-exponential baseline drift; the deadtime parameterDT0adds a rational non-paralysable count-loss term; adpsepparameter selects the double-delta count model with fixed supplied separation. Atauparameter frees the muon lifetime (musrfit-style; default fixed at the physical value); it is not supported together with the double-pulse model.