jesterTOV.inference.likelihoods.constraints.ConstraintEOSLikelihood#

class ConstraintEOSLikelihood(
penalty_causality=-10000000000.0,
penalty_stability=-10000000000.0,
penalty_pressure=-10000000000.0,
)[source]#

Bases: LikelihoodBase

EOS-level constraint likelihood for enforcing physical validity.

This likelihood only checks EOS-level constraints (causality, stability, pressure). It does NOT check TOV integration results, allowing JAX to optimize away the TOV solve when only EOS constraints are needed (much faster for chiEFT, etc).

The transform must add EOS violation counts to its output dictionary: - ‘n_causality_violations’: Number of cs^2 > 1 points - ‘n_stability_violations’: Number of cs^2 < 0 points - ‘n_pressure_violations’: Number of non-monotonic pressure points

Parameters:
  • penalty_causality (float, optional) – Log likelihood penalty for causality violation (default: -1e10)

  • penalty_stability (float, optional) – Log likelihood penalty for thermodynamic instability (default: -1e10)

  • penalty_pressure (float, optional) – Log likelihood penalty for non-monotonic pressure (default: -1e10)

Examples

>>> # In config.yaml (chiEFT example - no TOV solve needed)
>>> likelihoods:
>>>   - type: "constraints_eos"
>>>     enabled: true
>>>     parameters:
>>>       penalty_causality: -1.0e10
>>>       penalty_stability: -1.0e10
__init__(
penalty_causality=-10000000000.0,
penalty_stability=-10000000000.0,
penalty_pressure=-10000000000.0,
)[source]#

Methods

__init__([penalty_causality, ...])

evaluate(params)

Evaluate EOS constraint log likelihood.

Attributes

data

The data for the likelihood.

model

The model for the likelihood.

penalty_causality

penalty_stability

penalty_pressure

evaluate(params)[source]#

Evaluate EOS constraint log likelihood.

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

Parameters:

params (dict[str, float]) – Must contain EOS constraint violation counts from transform: - ‘n_causality_violations’ - ‘n_stability_violations’ - ‘n_pressure_violations’

Return type:

Float

Returns:

float – Sum of EOS penalties (0.0 if valid, large negative if invalid)

penalty_causality: float#
penalty_pressure: float#
penalty_stability: float#