Skip to content

Transforms

jimgw.core.single_event.transforms ¤

HR_TO_RAD = 2 * jnp.pi / 24 module-attribute ¤

HR_TO_SEC = 3600 module-attribute ¤

SEC_TO_RAD = HR_TO_RAD / HR_TO_SEC module-attribute ¤

ComponentMassesToChirpMassMassRatioTransform = BijectiveTransform((['m_1', 'm_2'], ['M_c', 'q'])) module-attribute ¤

ComponentMassesToChirpMassSymmetricMassRatioTransform = BijectiveTransform((['m_1', 'm_2'], ['M_c', 'eta'])) module-attribute ¤

MassRatioToSymmetricMassRatioTransform = BijectiveTransform((['q'], ['eta'])) module-attribute ¤

ChirpMassMassRatioToComponentMassesTransform = reverse_bijective_transform(ComponentMassesToChirpMassMassRatioTransform) module-attribute ¤

ChirpMassSymmetricMassRatioToComponentMassesTransform = reverse_bijective_transform(ComponentMassesToChirpMassSymmetricMassRatioTransform) module-attribute ¤

SymmetricMassRatioToMassRatioTransform = reverse_bijective_transform(MassRatioToSymmetricMassRatioTransform) module-attribute ¤

SpinAnglesToCartesianSpinTransform ¤

Bases: ConditionalBijectiveTransform

Transform spin angles (J-frame convention) to Cartesian spin components.

Converts (theta_jn, phi_jl, tilt_1, tilt_2, phi_12, a_1, a_2) to (iota, s1_x, s1_y, s1_z, s2_x, s2_y, s2_z) using the LALSimulation convention. The conditioning parameters are (M_c, q) and optionally phase_c.

Attributes:

Name Type Description
freq_ref Float

Reference frequency used in the spin conversion.

freq_ref: Float = freq_ref instance-attribute ¤
transform_func = named_transform instance-attribute ¤
inverse_transform_func = named_inverse_transform instance-attribute ¤
name_mapping: tuple[list[str], list[str]] = name_mapping instance-attribute ¤
n_dim: int property ¤

Number of parameters consumed/produced by this transform.

conditional_names: list[str] = conditional_names instance-attribute ¤
__repr__() ¤
__init__(freq_ref: Float, fixed_phase: bool = False) -> None ¤

Parameters:

Name Type Description Default
freq_ref Float

Reference frequency in Hz for the spin-angle conversion.

required
fixed_phase bool

If True, the coalescence phase phase_c is not included in the conditioning parameters (treated as fixed at 0). Defaults to False.

False
propagate_name(x: Sequence[str]) -> tuple[str, ...] ¤
forward(x: dict[str, Float]) -> dict[str, Float] ¤

Push forward the input x to transformed coordinate y.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The transformed dictionary.

transform(x: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional forward transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
x dict[str, Float]

Parameter dictionary containing both primary and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary parameters.

inverse(y: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional inverse transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
y dict[str, Float]

Parameter dictionary in the output space, containing both primary (output) and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The inverse-transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary output parameters.

backward(y: dict[str, Float]) -> dict[str, Float] ¤

Pull back the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The original dictionary.

SphereSpinToCartesianSpinTransform ¤

Bases: BijectiveTransform

Transform spin magnitude and angles to Cartesian spin components.

Converts ({label}_mag, {label}_theta, {label}_phi) to ({label}_x, {label}_y, {label}_z) using the standard spherical-to-Cartesian conversion.

transform_func = named_transform instance-attribute ¤
inverse_transform_func = named_inverse_transform instance-attribute ¤
name_mapping: tuple[list[str], list[str]] = name_mapping instance-attribute ¤
n_dim: int property ¤

Number of parameters consumed/produced by this transform.

__repr__() ¤
__init__(label: str) -> None ¤

Parameters:

Name Type Description Default
label str

Parameter label prefix (e.g. "s1" produces s1_mag, s1_theta, s1_phis1_x, s1_y, s1_z).

required
propagate_name(x: Sequence[str]) -> tuple[str, ...] ¤
forward(x: dict[str, Float]) -> dict[str, Float] ¤

Push forward the input x to transformed coordinate y.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The transformed dictionary.

transform(x: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Transform the input x to transformed coordinate y and return the log Jacobian determinant. This only works if the transform is a N -> N transform.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The transformed dictionary and the log Jacobian determinant.

inverse(y: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Inverse transform the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The original dictionary and the log Jacobian determinant.

backward(y: dict[str, Float]) -> dict[str, Float] ¤

Pull back the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The original dictionary.

SkyFrameToDetectorFrameSkyPositionTransform ¤

Bases: BijectiveTransform

Transform sky position from equatorial (RA/Dec) to detector-frame (zenith/azimuth).

Converts (ra, dec) to (zenith, azimuth) relative to the baseline between two detectors at the given trigger time. The rotation matrix is computed from the baseline vector between the first two detectors in ifos.

Attributes:

Name Type Description
gmst Float

Greenwich Mean Sidereal Time at the trigger time in radians.

rotation Float[Array, '3 3']

Rotation matrix from equatorial to detector frame.

rotation_inv Float[Array, '3 3']

Inverse rotation matrix.

gmst: Float = compute_gmst(trigger_time) instance-attribute ¤
rotation: Float[Array, '3 3'] = euler_rotation(delta_x) instance-attribute ¤
rotation_inv: Float[Array, '3 3'] = jnp.linalg.inv(self.rotation) instance-attribute ¤
transform_func = named_transform instance-attribute ¤
inverse_transform_func = named_inverse_transform instance-attribute ¤
name_mapping: tuple[list[str], list[str]] = name_mapping instance-attribute ¤
n_dim: int property ¤

Number of parameters consumed/produced by this transform.

__repr__() ¤
__init__(trigger_time: Float, ifos: Sequence[GroundBased2G]) -> None ¤

Parameters:

Name Type Description Default
trigger_time Float

GPS trigger time in seconds.

required
ifos Sequence[GroundBased2G]

At least two detectors; the rotation is computed from the baseline vector between ifos[0] and ifos[1].

required
propagate_name(x: Sequence[str]) -> tuple[str, ...] ¤
forward(x: dict[str, Float]) -> dict[str, Float] ¤

Push forward the input x to transformed coordinate y.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The transformed dictionary.

transform(x: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Transform the input x to transformed coordinate y and return the log Jacobian determinant. This only works if the transform is a N -> N transform.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The transformed dictionary and the log Jacobian determinant.

inverse(y: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Inverse transform the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The original dictionary and the log Jacobian determinant.

backward(y: dict[str, Float]) -> dict[str, Float] ¤

Pull back the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The original dictionary.

GeocentricArrivalTimeToDetectorArrivalTimeTransform ¤

Bases: ConditionalBijectiveTransform

Transform geocentric coalescence time offset to detector arrival time offset.

In the geocentric convention the signal arrives at Earth's centre at trigger_time + t_c. In the detector convention it arrives at the detector at trigger_time + time_delay_from_geocenter + t_det.

Maps t_ct_det (forward) and t_dett_c (inverse). Conditioning parameters are (ra, dec).

Attributes:

Name Type Description
gmst Float

Greenwich Mean Sidereal Time at the trigger time in radians.

ifo GroundBased2G

The target detector.

gmst: Float = compute_gmst(trigger_time) instance-attribute ¤
ifo: GroundBased2G = ifo instance-attribute ¤
transform_func = named_transform instance-attribute ¤
inverse_transform_func = named_inverse_transform instance-attribute ¤
name_mapping: tuple[list[str], list[str]] = name_mapping instance-attribute ¤
n_dim: int property ¤

Number of parameters consumed/produced by this transform.

conditional_names: list[str] = conditional_names instance-attribute ¤
__repr__() ¤
__init__(trigger_time: Float, ifo: GroundBased2G) -> None ¤

Parameters:

Name Type Description Default
trigger_time Float

GPS trigger time in seconds.

required
ifo GroundBased2G

The target detector for which to compute the time delay from the geocentre.

required
propagate_name(x: Sequence[str]) -> tuple[str, ...] ¤
forward(x: dict[str, Float]) -> dict[str, Float] ¤

Push forward the input x to transformed coordinate y.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The transformed dictionary.

transform(x: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional forward transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
x dict[str, Float]

Parameter dictionary containing both primary and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary parameters.

inverse(y: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional inverse transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
y dict[str, Float]

Parameter dictionary in the output space, containing both primary (output) and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The inverse-transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary output parameters.

backward(y: dict[str, Float]) -> dict[str, Float] ¤

Pull back the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The original dictionary.

GeocentricArrivalPhaseToDetectorArrivalPhaseTransform ¤

Bases: ConditionalBijectiveTransform

Transform geocentric coalescence phase to detector arrival phase.

In the geocentric convention the orbital phase at coalescence is phase_c (so the GW phase is phase_c / 2). In the detector convention the arrival phase is

.. math::

\phi_{\mathrm{det}} = \frac{\phi_c}{2} + \arg R_{\mathrm{det}}

where :math:R_{\mathrm{det}} is the complex detector response.

Conditioning parameters are (ra, dec, psi, iota).

Warning

This transform is derived under the assumption that the waveform consists only of the dominant quadrupolar mode (:math:\ell = 2, |m| = 2), following the parameterisation in arXiv:2207.03508 <https://arxiv.org/abs/2207.03508>_. It is not valid for waveforms that include higher harmonics or orbital precession. Use at your own discretion when such waveform approximants are employed.

Attributes:

Name Type Description
gmst Float

Greenwich Mean Sidereal Time at the trigger time in radians.

ifo GroundBased2G

The target detector.

gmst: Float = compute_gmst(trigger_time) instance-attribute ¤
ifo: GroundBased2G = ifo instance-attribute ¤
transform_func = named_transform instance-attribute ¤
inverse_transform_func = named_inverse_transform instance-attribute ¤
name_mapping: tuple[list[str], list[str]] = name_mapping instance-attribute ¤
n_dim: int property ¤

Number of parameters consumed/produced by this transform.

conditional_names: list[str] = conditional_names instance-attribute ¤
__repr__() ¤
__init__(trigger_time: Float, ifo: GroundBased2G) -> None ¤

Parameters:

Name Type Description Default
trigger_time Float

GPS trigger time in seconds.

required
ifo GroundBased2G

The target detector used to compute the complex antenna response.

required
propagate_name(x: Sequence[str]) -> tuple[str, ...] ¤
forward(x: dict[str, Float]) -> dict[str, Float] ¤

Push forward the input x to transformed coordinate y.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The transformed dictionary.

transform(x: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional forward transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
x dict[str, Float]

Parameter dictionary containing both primary and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary parameters.

inverse(y: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional inverse transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
y dict[str, Float]

Parameter dictionary in the output space, containing both primary (output) and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The inverse-transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary output parameters.

backward(y: dict[str, Float]) -> dict[str, Float] ¤

Pull back the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The original dictionary.

DistanceToSNRWeightedDistanceTransform ¤

Bases: ConditionalBijectiveTransform

Transform luminosity distance to the network SNR-weighted distance.

The SNR-weighted distance d_hat absorbs the network sensitivity and chirp-mass dependence into the distance parameter, making it closer to uniform in the posterior:

.. math::

d_{\hat} = \frac{d_L}{\mathcal{M}_c^{5/6}\, R_{\mathrm{net}}}

Conditioning parameters are (M_c, ra, dec, psi, iota).

Warning

This transform is derived under the assumption that the waveform consists only of the dominant quadrupolar mode (:math:\ell = 2, |m| = 2), following the parameterisation in arXiv:2207.03508 <https://arxiv.org/abs/2207.03508>_. It is not valid for waveforms that include higher harmonics or orbital precession. Use at your own discretion when such waveform approximants are employed.

Attributes:

Name Type Description
gmst Float

Greenwich Mean Sidereal Time at the trigger time in radians.

ifos Sequence[GroundBased2G]

List of detectors forming the network.

gmst: Float = compute_gmst(trigger_time) instance-attribute ¤
ifos: Sequence[GroundBased2G] = ifos instance-attribute ¤
transform_func = named_transform instance-attribute ¤
inverse_transform_func = named_inverse_transform instance-attribute ¤
name_mapping: tuple[list[str], list[str]] = name_mapping instance-attribute ¤
n_dim: int property ¤

Number of parameters consumed/produced by this transform.

conditional_names: list[str] = conditional_names instance-attribute ¤
__repr__() ¤
__init__(trigger_time: Float, ifos: Sequence[GroundBased2G]) -> None ¤

Parameters:

Name Type Description Default
trigger_time Float

GPS trigger time in seconds.

required
ifos Sequence[GroundBased2G]

Detectors that form the network; used to compute the network antenna response R_net.

required
propagate_name(x: Sequence[str]) -> tuple[str, ...] ¤
forward(x: dict[str, Float]) -> dict[str, Float] ¤

Push forward the input x to transformed coordinate y.

Parameters:

Name Type Description Default
x dict[str, Float]

The input dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The transformed dictionary.

transform(x: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional forward transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
x dict[str, Float]

Parameter dictionary containing both primary and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary parameters.

inverse(y: dict[str, Float]) -> tuple[dict[str, Float], Float] ¤

Apply the conditional inverse transform and compute the log-Jacobian.

Parameters:

Name Type Description Default
y dict[str, Float]

Parameter dictionary in the output space, containing both primary (output) and conditioning parameters.

required

Returns:

Type Description
tuple[dict[str, Float], Float]

tuple[dict[str, Float], Float]: The inverse-transformed parameter dictionary and the log absolute Jacobian determinant w.r.t. the primary output parameters.

backward(y: dict[str, Float]) -> dict[str, Float] ¤

Pull back the input y to original coordinate x.

Parameters:

Name Type Description Default
y dict[str, Float]

The transformed dictionary.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: The original dictionary.

named_m1_m2_to_Mc_q(x) ¤

named_Mc_q_to_m1_m2(x) ¤

named_m1_m2_to_Mc_eta(x) ¤

named_Mc_eta_to_m1_m2(x) ¤

named_q_to_eta(x) ¤

named_eta_to_q(x) ¤