Likelihood
HeterodynedTransientLikelihoodFD
¤
Bases: SingleEventLikelihood
Frequency-domain likelihood using the relative-binning (heterodyne) scheme.
Optionally marginalizes over coalescence phase when phase_marginalization
is provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detectors
|
Sequence[Detector]
|
List of detector objects containing data and metadata. |
required |
waveform
|
Waveform
|
Waveform model to evaluate. |
required |
fixed_parameters
|
Optional[FixedParameters]
|
Dictionary of fixed parameter values. Each value
may be a constant |
None
|
f_min
|
float | dict[str, float]
|
Minimum frequency for likelihood evaluation. |
0.0
|
f_max
|
float | dict[str, float]
|
Maximum frequency for likelihood evaluation. |
inf
|
trigger_time
|
float
|
GPS time of the event trigger. |
0
|
n_bins
|
Optional[int]
|
Number of frequency bins for relative binning. Mutually
exclusive with |
None
|
epsilon
|
Optional[float]
|
Maximum allowed phase change per bin (rad). The bin count
is set to |
None
|
optimizer_popsize
|
int
|
Population size for the CMA-ES optimizer used when finding reference parameters automatically. Defaults to 500. |
500
|
optimizer_n_steps
|
int
|
Maximum number of CMA-ES generations. Defaults to 1000. |
1000
|
optimizer_target
|
Optional[float]
|
Optional log-likelihood value at which the CMA-ES
search stops early, before |
None
|
reference_parameters
|
Optional[dict]
|
Pre-computed reference parameters (dict). If supplied, the optimizer is skipped entirely. |
None
|
reference_waveform
|
Optional[Waveform]
|
Optional waveform instance used to compute the
reference waveform. Defaults to |
None
|
prior
|
Optional[Prior]
|
Prior distribution from which the initial CMA-ES mean is
drawn. Required when |
None
|
likelihood_transforms
|
Optional[list[NtoMTransform]]
|
Transforms mapping sampling parameters to likelihood parameters (e.g. mass-ratio → symmetric mass-ratio). |
None
|
phase_marginalization
|
Optional[Union[PhaseMargConfig, dict, bool]]
|
If provided, marginalize over coalescence phase
|
None
|
Methods:
| Name | Description |
|---|---|
maximize_likelihood |
Find the maximum-likelihood parameters using CMA-ES. |
maximize_likelihood(prior: Prior, likelihood_transforms: list[NtoMTransform], optimizer_popsize: int = 500, optimizer_n_steps: int = 1000, optimizer_target: Optional[float] = None)
¤
Find the maximum-likelihood parameters using CMA-ES.
Uses evosax.CMA_ES (Covariance Matrix Adaptation Evolution
Strategy) to search the full parameter space. The initial mean is
drawn from the prior and the entire ask/tell loop is compiled with
jax.lax.while_loop for speed, stopping once optimizer_n_steps
generations have run or optimizer_target has been reached,
whichever comes first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prior
|
Prior
|
Prior used to seed the initial CMA-ES mean. |
required |
likelihood_transforms
|
list[NtoMTransform]
|
Transforms mapping sampling parameters to likelihood parameters. |
required |
optimizer_popsize
|
int
|
Population size for CMA-ES. Defaults to 500. |
500
|
optimizer_n_steps
|
int
|
Maximum number of CMA-ES generations. Defaults to 1000. |
1000
|
optimizer_target
|
Optional[float]
|
Optional log-likelihood value (same scale as
|
None
|
MultibandedTransientLikelihoodFD
¤
Bases: SingleEventLikelihood
Multi-banded likelihood for gravitational wave transient events.
This implements the multi-banding method described in S. Morisaki, 2021, arXiv:2104.07813. The method divides the frequency range into bands with different resolutions, using coarser grids at higher frequencies to speed up likelihood evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
reference_chirp_mass |
Float
|
Reference chirp mass for determining frequency bands. |
reference_chirp_mass_in_second |
Float
|
Geometrised reference chirp mass in time unit [second]. |
highest_mode |
int
|
Maximum magnetic number of GW moments (fixed to 2 for 22-mode). |
accuracy_factor |
Float
|
Parameter L controlling approximation accuracy. |
time_offset |
Float
|
Time offset for band construction. |
delta_f_end |
Float
|
Frequency scale for high-frequency tapering. |
durations |
Array
|
Durations of each band. |
fb_dfb |
Array
|
Starting frequencies and taper widths for each band. |
linear_coeffs |
dict
|
Pre-computed coefficients for (d|h) inner product. |
quadratic_coeffs |
dict
|
Pre-computed coefficients for (h|h) inner product. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detectors
|
Sequence[Detector]
|
List of detector objects. |
required |
waveform
|
Waveform
|
Waveform model to evaluate. |
required |
fixed_parameters
|
Optional[dict]
|
Fixed parameters for the likelihood. |
None
|
f_min
|
Float | dict[str, Float]
|
Minimum frequency for likelihood evaluation, or a dict mapping detector name to per-detector Float. |
0
|
f_max
|
Float | dict[str, Float]
|
Maximum frequency for likelihood evaluation, or a dict mapping detector name to per-detector Float. |
inf
|
trigger_time
|
Float
|
GPS time of the event trigger. |
0
|
highest_mode
|
int
|
Maximum magnetic number (default 2, for 22-mode only). |
2
|
accuracy_factor
|
Float
|
Accuracy parameter L (default 5.0). |
5.0
|
prior
|
Optional[Prior]
|
Combined prior object. Needed when reference_chirp_mass,
time_offset, or delta_f_end are |
None
|
reference_chirp_mass
|
Optional[Float]
|
Reference chirp mass in solar masses.
Use the minimum of your chirp-mass prior for maximum speedup. When
|
None
|
time_offset
|
Optional[Float]
|
Time offset in seconds. When |
None
|
delta_f_end
|
Optional[Float]
|
End frequency taper scale in Hz. When
|
None
|
max_banding_frequency
|
Optional[Float]
|
Upper limit on band starting frequency. |
None
|
min_banding_duration
|
Float
|
Minimum duration for bands. |
0.0
|
n_bands: int
property
¤
Number of frequency bands.
SingleEventLikelihood
¤
Bases: LikelihoodBase
Methods:
| Name | Description |
|---|---|
__init__ |
Args: |
evaluate |
Prepare parameters and evaluate the likelihood. |
evaluate_from_waveform |
Evaluate this likelihood from a waveform cache. |
generate_waveform |
Generate a reusable waveform cache. |
Attributes:
| Name | Type | Description |
|---|---|---|
detector_names |
list[str]
|
Names of the detectors used in this likelihood. |
duration |
FloatLike
|
Duration of the data segment in seconds (taken from the first detector). |
waveform_caches_distance |
bool
|
Whether a waveform cache can be reused across |
detector_names: list[str]
property
¤
Names of the detectors used in this likelihood.
duration: FloatLike
property
¤
Duration of the data segment in seconds (taken from the first detector).
waveform_caches_distance: bool
property
¤
Whether a waveform cache can be reused across d_L changes.
Derived from the waveform's type by default, so subclasses may
override it to control the behavior directly. Consumed by the
waveform-cache block-dependency inference (see
jimgw.core.single_event.blocked_likelihood): when True, d_L
is excluded from the cache's dependency set, so a d_L-only
proposal block reuses the cache instead of rebuilding it.
__init__(detectors: Sequence[Detector], waveform: Waveform, fixed_parameters: Optional[FixedParameters] = None) -> None
¤
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detectors
|
Sequence[Detector]
|
Detectors with initialized data and PSD. |
required |
waveform
|
Waveform
|
Waveform model to evaluate. |
required |
fixed_parameters
|
Optional[dict]
|
Parameters held constant during
sampling. Values may be scalars or callables
|
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If any detector has uninitialized data or PSD. |
evaluate(params: dict[str, Float]) -> FloatScalar
¤
Prepare parameters and evaluate the likelihood.
Constants are injected directly; callables receive the current params dict and may return a scalar or a dict (the matching key is extracted). Callables are applied in insertion order.
evaluate_from_waveform(params: dict[str, Float], waveform_cache: Any) -> FloatScalar
¤
Evaluate this likelihood from a waveform cache.
generate_waveform(params: dict[str, Float]) -> Any
¤
Generate a reusable waveform cache.
Evaluated at unit distance when waveform_caches_distance is True,
so d_L is not a cache dependency; otherwise d_L is a
dependency like any other waveform parameter. Every other effective
waveform input is always a dependency, regardless of distance support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict[str, Float]
|
Source parameters to build the cache from. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
An opaque cache understood by this likelihood's
|
TransientLikelihoodFD
¤
Bases: SingleEventLikelihood
Frequency-domain transient gravitational wave likelihood.
Supports optional analytic marginalization over coalescence time, phase, and/or luminosity distance via typed config objects. Each marginalization mode is activated by passing the corresponding config object (or a plain dict shorthand) to the relevant parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detectors
|
Sequence[Detector]
|
List of detector objects containing data and metadata. |
required |
waveform
|
Waveform
|
Waveform model to evaluate. |
required |
fixed_parameters
|
Optional[FixedParameters]
|
Parameters held constant during sampling. Values
may be constants or callables |
None
|
f_min
|
float | dict[str, float]
|
Minimum frequency for likelihood evaluation. Can be a single float or a per-detector dictionary. |
0.0
|
f_max
|
float | dict[str, float]
|
Maximum frequency for likelihood evaluation. Can be a single float or a per-detector dictionary. |
inf
|
trigger_time
|
float
|
GPS time of the event trigger. |
0
|
time_marginalization
|
Optional[Union[TimeMargConfig, dict, bool]]
|
If provided, marginalize over coalescence time
|
None
|
phase_marginalization
|
Optional[Union[PhaseMargConfig, dict, bool]]
|
If provided, marginalize over coalescence phase
|
None
|
distance_marginalization
|
Optional[Union[DistanceMargConfig, dict, bool]]
|
If provided, marginalize over luminosity
distance |
None
|
Example
likelihood = TransientLikelihoodFD( ... detectors, waveform, ... f_min=20, f_max=1024, trigger_time=1234567890, ... phase_marginalization=True, ... time_marginalization={"tc_range": (-0.1, 0.1)}, ... ) logL = likelihood.evaluate(params)
ZeroLikelihood
¤
Bases: LikelihoodBase
Trivial likelihood that always returns zero.
Useful for prior-only sampling or debugging.
Methods:
| Name | Description |
|---|---|
evaluate |
Return zero regardless of the parameters. |
evaluate(params: dict[str, Float]) -> FloatScalar
¤
Return zero regardless of the parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict[str, Float]
|
Ignored. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FloatScalar |
FloatScalar
|
Always 0.0. |