jesterTOV.inference.likelihoods.radio.RadioTimingLikelihood#
- class RadioTimingLikelihood(psr_name, mean, std, m_min=0.1, penalty_value=-100000.0)[source]#
Bases:
LikelihoodBaseLikelihood for radio pulsar mass measurements constraining maximum NS mass.
This likelihood evaluates how well an equation of state’s maximum TOV mass (M_TOV) is consistent with an observed pulsar mass measurement. Since we observe a specific pulsar (with some measurement uncertainty) but don’t know its true mass relative to the theoretical maximum, we must marginalize over all possible true masses between some minimum value and M_TOV.
The marginalization assumes: - The measured mass follows a Gaussian distribution: \(M_{\text{obs}} \sim \mathcal{N}(M_{\text{true}}, \sigma)\) - The true mass has a uniform prior: \(P(M_{\text{true}} | M_{\text{TOV}}) = 1/(M_{\text{TOV}} - m_{\text{min}})\) for \(M_{\text{true}} \in [m_{\text{min}}, M_{\text{TOV}}]\)
This gives the marginal likelihood.
\[\mathcal{L}(M_{\text{TOV}} | M_{\text{obs}}, \sigma) = \frac{1}{M_{\text{TOV}} - m_{\text{min}}} \int_{m_{\text{min}}}^{M_{\text{TOV}}} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left[-\frac{(m - M_{\text{obs}})^2}{2\sigma^2}\right] dm\]where the integration is evaluated analytically via the Gaussian CDF.
- Parameters:
psr_name (str) – Pulsar designation for identification (e.g., “J1614-2230”, “J0740+6620”). Used for logging and tracking which pulsar constraint is being applied.
mean (float) – Measured pulsar mass in solar masses (\(M_{\odot}\)). This is typically the reported value from timing analysis.
std (float) – Measurement uncertainty (\(1\sigma\)) in solar masses. This combines statistical and systematic uncertainties from the timing analysis.
m_min (float, optional) – Minimum mass for the integration lower bound in solar masses. This should be well below any physical neutron star mass to avoid truncation effects. Default is 0.1 \(M_{\odot}\).
penalty_value (float, optional) – Log-likelihood penalty for invalid TOV solutions (M_TOV ≤ m_min). Default is -1e5.
- Variables:
Notes
Invalid TOV solutions (M_TOV ≤ m_min) receive a large negative log-likelihood penalty to effectively exclude them from the posterior.
The implementation uses log-space arithmetic throughout to avoid numerical underflow when combining with other log-likelihoods.
See also
GWLikelihoodGravitational wave constraints on mass and tidal deformability
NICERLikelihoodX-ray timing constraints on mass and radius
Examples
Create a likelihood for PSR J0740+6620 (Fonseca et al. 2021: 2.08 ± 0.07 \(M_{\odot}\)):
>>> from jesterTOV.inference.likelihoods import RadioTimingLikelihood >>> likelihood = RadioTimingLikelihood("J0740+6620", mean=2.08, std=0.07) >>> params = {"masses_EOS": jnp.array([1.0, 1.5, 2.0, 2.2])} # Example TOV masses >>> log_like = likelihood.evaluate(params, data={})
Create a more precise likelihood for PSR J1614-2230 (narrower uncertainty):
>>> likelihood_j1614 = RadioTimingLikelihood("J1614-2230", mean=1.94, std=0.06)
Methods
__init__(psr_name, mean, std[, m_min, ...])evaluate(params)Evaluate the marginalized log-likelihood for the pulsar mass measurement.
Attributes
dataThe data for the likelihood.
modelThe model for the likelihood.
- evaluate(params)[source]#
Evaluate the marginalized log-likelihood for the pulsar mass measurement.
This method computes the marginal likelihood by: 1. Extracting the maximum TOV mass from the EOS 2. Computing standardized z-scores for the integration bounds 3. Evaluating the Gaussian CDF at the upper and lower bounds 4. Computing the CDF difference in log-space for numerical stability 5. Applying the 1/(M_TOV - m_min) normalization factor
- Parameters:
params (dict[str, Float | Array]) –
Dictionary containing TOV solution outputs from the transform. Required keys:
”masses_EOS” : Array of neutron star masses (solar masses) at different central pressures. The maximum value is taken as M_TOV.
- Return type:
Float- Returns:
Float – Natural logarithm of the marginalized likelihood. Returns a large negative penalty for invalid EOSs (M_TOV ≤ m_min), which indicates TOV integration failure or unphysical EOS.
Notes
Any NaN or infinity values in the result should not be replaced with -jnp.inf as this will cause some samplers to have numerical problems.