Skip to content

helpers

Helpers for setting up a compact-binary analysis.

The get_default_* functions read the parameter names of a prior (and, for the NS AW unit cube, its bounds) and return what Jim takes; to_likelihood_space converts a parameter dictionary to what the waveform expects. For anything these do not cover, write the lists by hand.

Functions:

Name Description
get_default_likelihood_transforms

Default likelihood transforms (prior space to waveform input) for prior.

get_default_periodic

Sampling-space parameters that wrap around, in the form Jim's periodic takes.

get_default_sample_transforms

Default sample transforms (prior space to sampling space) for prior.

to_likelihood_space

Convert parameters given in any supported parametrization to likelihood space.

get_default_likelihood_transforms(prior: Prior, ifos: Sequence[GroundBased2G], waveform: Waveform, *, phase_marginalization: bool = False) -> list[NtoMTransform] ¤

Default likelihood transforms (prior space to waveform input) for prior.

Parameters:

Name Type Description Default
prior Prior

The prior Jim will sample.

required
ifos Sequence[GroundBased2G]

Detectors with data attached.

required
waveform Waveform

The waveform model; its f_ref fixes the spin-angle convention.

required
phase_marginalization bool

phase_c is not a parameter, so the spin angles are converted at phase_c = 0.

False

Returns:

Type Description
list[NtoMTransform]

The transforms to pass to Jim as likelihood_transforms.

get_default_periodic(prior: Prior, sample_transforms: Sequence[BijectiveTransform]) -> dict[str, tuple[float, float]] | list[str] ¤

Sampling-space parameters that wrap around, in the form Jim's periodic takes.

A parameter counts when it is an angle with a known period (psi: pi; ra, azimuth, phase_c, phi_jl, phi_12, s1_phi, s2_phi: 2 pi) and its range covers one full period.

Parameters:

Name Type Description Default
prior Prior

The prior Jim will sample.

required
sample_transforms Sequence[BijectiveTransform]

The sample transforms Jim will use. If they map onto [0, 1] (space="unit_cube" of get_default_sample_transforms, for the NS AW sampler), the result is the list of names of the unit-cube parameters, whose bounds are implicit; otherwise it is a dict with bounds.

required

Returns:

Type Description
dict[str, tuple[float, float]] | list[str]

{name: (lower, upper)}, or a list of names for a unit-cube sampling space.

get_default_sample_transforms(prior: Prior, ifos: Sequence[GroundBased2G], *, detector_frame_time: bool = True, detector_frame_sky: bool = True, space: Literal['default', 'unit_cube', 'unbounded'] = 'default') -> list[BijectiveTransform] ¤

Default sample transforms (prior space to sampling space) for prior.

Parameters:

Name Type Description Default
prior Prior

The prior Jim will sample.

required
ifos Sequence[GroundBased2G]

Detectors with data attached.

required
detector_frame_time bool

Sample t_c as the arrival time at ifos[0].

True
detector_frame_sky bool

Sample ra/dec as azimuth/zenith relative to the baseline of ifos[0] and ifos[1].

True
space Literal['default', 'unit_cube', 'unbounded']

"default" keeps each parameter in its prior range. "unit_cube" maps every sampling parameter to [0, 1], as the NS AW sampler requires; it raises if a prior cannot be mapped exactly, e.g. t_c in the detector frame or a non-isotropic ra/dec. "unbounded" maps every sampling parameter to the real line (its unit-cube map, then a logit), as the SMC sampler prefers, except the periodic angles, which the sampler maps itself. A detector-frame time takes the t_c range widened by the largest detector delay.

'default'

Returns:

Type Description
list[BijectiveTransform]

The transforms to pass to Jim as sample_transforms.

to_likelihood_space(params: Mapping[str, float], ifos: Sequence[GroundBased2G], waveform: Waveform) -> dict[str, float] ¤

Convert parameters given in any supported parametrization to likelihood space.

Handles azimuth/zenith to ra/dec, t_det to t_c (at ifos[0]), J-frame spin angles and spherical spins to Cartesian spins, and q to eta. The detector-frame conversions read the trigger time from the data of ifos.