UniformCubicTemplate¶
- class ell1fit.templates.UniformCubicTemplate(coefficients, x0, dx, n_intervals)[source]¶
Bases:
objectA pulse template that is callable and can score events in one pass.
Behaves as the plain
phase -> densityfunction every caller expects, so plotting and diagnostics are unaffected. The likelihood additionally usesloglike(), which fuses interpolation, flooring and the log-sum into a single traversal rather than three.Methods Summary
__call__(phases)Call self as a function.
loglike(phases[, weights, floor])Total log-likelihood of
phasesunder this template.Methods Documentation
- loglike(phases, weights=None, floor=1e-12)[source]¶
Total log-likelihood of
phasesunder this template.The interpolation and clamp happen in one compiled pass; the logarithm and the sum are then left to numpy, which is both faster and more accurate than doing them element-by-element. Faster because numpy’s
logis SIMD-vectorised, where a scalar loop callinglogonce per event is not – measured at roughly 0.6x, so fusing everything is a pessimisation. More accurate becausenp.sumaccumulates pairwise, with error growing like log(N) rather than the N of a running total: at two million events that is a 30x smaller error than the loop this replaces.