jesterTOV.inference.likelihoods.constraints.ConstraintGammaLikelihood#

class ConstraintGammaLikelihood(penalty_gamma=-10000000000.0)[source]#

Bases: LikelihoodBase

Gamma constraint likelihood for spectral decomposition EOS.

This likelihood enforces LALSuite’s requirement that the adiabatic index Γ(x) ∈ [0.6, 4.5] for all dimensionless log-pressures x ∈ [0, xmax]. This constraint is specific to spectral decomposition EOS and ensures physical validity and numerical stability.

The spectral transform must add gamma violation counts to its output dictionary: - ‘n_gamma_violations’: Number of points where Γ(x) violates [0.6, 4.5] bounds

Parameters:

penalty_gamma (float, optional) – Log likelihood penalty for gamma bound violation (default: -1e10)

Examples

>>> # In config.yaml (spectral EOS examples)
>>> likelihoods:
>>>   - type: "constraints_gamma"
>>>     enabled: true
>>>     parameters:
>>>       penalty_gamma: -1.0e10

Notes

This likelihood is only relevant for spectral decomposition EOS parametrization. For metamodel or metamodel+CSE transforms, this likelihood will return 0.0 (no penalty) since n_gamma_violations will not be present in the transform output.

See also

ConstraintEOSLikelihood

General EOS-level constraints (causality, stability, pressure)

ConstraintTOVLikelihood

TOV integration validity

__init__(penalty_gamma=-10000000000.0)[source]#

Methods

__init__([penalty_gamma])

evaluate(params)

Evaluate gamma constraint log likelihood.

Attributes

data

The data for the likelihood.

model

The model for the likelihood.

penalty_gamma

evaluate(params)[source]#

Evaluate gamma constraint log likelihood.

Returns 0.0 if all gamma constraints satisfied, applies penalty otherwise. Uses jnp.where for JAX compatibility (no Python if-statements).

Parameters:

params (dict[str, float]) – Must contain gamma constraint violation counts from spectral transform: - ‘n_gamma_violations’ (only present for spectral transform)

Return type:

Float

Returns:

Float – Gamma penalty (0.0 if valid, large negative if invalid)

penalty_gamma: float#