rayleigh_as_likelihood

ell1fit.likelihoods.rayleigh_as_likelihood(phases, template_func=None, weights=None)[source]

Use the Rayleigh statistic \(Z_1^2\) as a surrogate for a likelihood.

Selected by --likelihood Rayleigh. It measures how concentrated the event phases are at the fundamental frequency, and depends on nothing but the phases – which is both its appeal and its limitation.

Parameters:
phasesnp.ndarray

Event phases.

template_funccallable or None, optional

Accepted for interface compatibility and deliberately unused.

weightsnp.ndarray or None, optional

Accepted for interface compatibility and deliberately unused.

Returns:
float

\(Z_1^2\) for the input phases.

Warning

This is a statistic rather than a likelihood derived from a model, and two real limitations follow from that:

  • Only the fundamental harmonic is used. The pulse template is not consulted at all, so -N/nharm has no effect on the fit. A sharply peaked pulse carries information in its higher harmonics that this discards, so it is strictly less sensitive than --likelihood PC for anything non-sinusoidal.

  • Per-event weights are ignored, so --use-weight does nothing.

Notes

A caution that was tested and did not hold up, recorded because it is the natural thing to worry about: \(Z_1^2\) is not on a log-density scale (around +1700 where the Pletsch-Clarke log-likelihood is around -970), which suggests the log-prior added to it would be weighted wrongly, and that for weak signals \(\log L \approx Z_1^2 / 2\) would make credible intervals a factor \(\sqrt{2}\) too narrow.

Measured over 30 synthetic realizations with a near-sinusoidal pulse and a single harmonic, comparing each statistic’s Laplace uncertainty against the actual scatter of its estimates, the ratios came out 1.07 for Rayleigh and 0.89 for Pletsch-Clarke – both consistent with 1 within the roughly 13% precision of that test. Walking a parameter across its range, the change in \(Z_1^2\) tracks the change in the log-likelihood with a ratio near 1, not 2.

The \(Z_1^2/2\) result applies to a likelihood profiled over the pulse amplitude; this pipeline holds the template fixed from the folded data instead, which is a different function of the parameters. Since only the parameter-dependence matters and the constant offset cancels, adding a log-prior is legitimate and the sampled distribution behaves like a posterior.

ell1fit.pipeline.ell1fit() warns when this is combined with options it cannot honour, rather than letting them be silently discarded.