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[dict[str, Float | Callable[[dict[str, Float]], Float | dict[str, Float]]]]
|
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
|
int
|
Number of frequency bins for relative binning. |
1000
|
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
|
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 |
|---|---|
make_binning_scheme |
Make a binning scheme based on the maximum phase difference between the |
max_phase_diff |
Compute the maximum phase difference between the frequencies in the array. |
maximize_likelihood |
Find the maximum-likelihood parameters using CMA-ES. |
make_binning_scheme(freqs: Float[Array, ' n_freq'], n_bins: int, chi: float = 1) -> tuple[Float[Array, ' n_bins + 1'], Float[Array, ' n_bins']]
¤
Make a binning scheme based on the maximum phase difference between the frequencies in the array.
max_phase_diff(freqs: Float[Array, ' n_freq'], f_low: FloatLike, f_high: FloatLike, chi: float = 1.0) -> Float[Array, ' n_freq']
staticmethod
¤
Compute the maximum phase difference between the frequencies in the array.
See Eq.(7) in arXiv:2302.05333.
maximize_likelihood(prior: Prior, likelihood_transforms: list[NtoMTransform], optimizer_popsize: int = 500, optimizer_n_steps: int = 1000)
¤
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.scan for speed.
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
|
Number of CMA-ES generations. Defaults to 1000. |
1000
|
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
|
Same value converted to seconds. |
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
|
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluate the log-likelihood for given parameters. |
SingleEventLikelihood
¤
Bases: LikelihoodBase
Methods:
| Name | Description |
|---|---|
__init__ |
Args: |
evaluate |
Apply |
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). |
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).
__init__(detectors: Sequence[Detector], waveform: Waveform, fixed_parameters: Optional[dict[str, Float | Callable[[dict[str, Float]], Float | dict[str, Float]]]] = 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
¤
Apply fixed_parameters overrides 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.
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[dict[str, Float | Callable[[dict[str, Float]], Float | dict[str, Float]]]]
|
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. |