Skip to content

Commit

Permalink
precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibeauWouters committed Aug 27, 2024
1 parent 95bc462 commit b3898e1
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/jimgw/single_event/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
):
name_mapping = (
["theta_jn", "phi_jl", "theta_1", "theta_2", "phi_12", "a_1", "a_2"],
["iota", "s1_x", "s1_y", "s1_z", "s2_x", "s2_y", "s2_z"]
["iota", "s1_x", "s1_y", "s1_z", "s2_x", "s2_y", "s2_z"],
)
super().__init__(name_mapping)

Expand Down Expand Up @@ -68,7 +68,6 @@ def named_transform(x):
}

self.transform_func = named_transform



@jaxtyped(typechecker=typechecker)
Expand Down Expand Up @@ -135,6 +134,7 @@ def named_inverse_transform(x):

self.inverse_transform_func = named_inverse_transform


@jaxtyped(typechecker=typechecker)
class _ComponentMassesToChirpMassSymmetricMassRatioTransform(BijectiveTransform):
"""
Expand All @@ -145,7 +145,6 @@ def __init__(self):
name_mapping = (["m_1", "m_2"], ["M_c", "eta"])
super().__init__(name_mapping)


def named_transform(x):
Mc, eta = m1_m2_to_Mc_eta(x["m_1"], x["m_2"])
return {"M_c": Mc, "eta": eta}
Expand All @@ -158,6 +157,7 @@ def named_inverse_transform(x):

self.inverse_transform_func = named_inverse_transform


@jaxtyped(typechecker=typechecker)
class _MassRatioToSymmetricMassRatioTransform(BijectiveTransform):
"""
Expand All @@ -170,14 +170,25 @@ def __init__(self):

self.transform_func = lambda x: {"eta": q_to_eta(x["q"])}
self.inverse_transform_func = lambda x: {"q": eta_to_q(x["eta"])}

def __repr__(self):
return f"{self.__class__.__name__[1:]}()"

ComponentMassesToChirpMassMassRatioTransform = _ComponentMassesToChirpMassMassRatioTransform()
ComponentMassesToChirpMassSymmetricMassRatioTransform = _ComponentMassesToChirpMassSymmetricMassRatioTransform()

ComponentMassesToChirpMassMassRatioTransform = (
_ComponentMassesToChirpMassMassRatioTransform()
)
ComponentMassesToChirpMassSymmetricMassRatioTransform = (
_ComponentMassesToChirpMassSymmetricMassRatioTransform()
)
MassRatioToSymmetricMassRatioTransform = _MassRatioToSymmetricMassRatioTransform()

ChirpMassMassRatioToComponentMassesTransform = reverse_bijective_transform(ComponentMassesToChirpMassMassRatioTransform)
ChirpMassSymmetricMassRatioToComponentMassesTransform = reverse_bijective_transform(ComponentMassesToChirpMassSymmetricMassRatioTransform)
SymmetricMassRatioToMassRatioTransform = reverse_bijective_transform(MassRatioToSymmetricMassRatioTransform)
ChirpMassMassRatioToComponentMassesTransform = reverse_bijective_transform(
ComponentMassesToChirpMassMassRatioTransform
)
ChirpMassSymmetricMassRatioToComponentMassesTransform = reverse_bijective_transform(
ComponentMassesToChirpMassSymmetricMassRatioTransform
)
SymmetricMassRatioToMassRatioTransform = reverse_bijective_transform(
MassRatioToSymmetricMassRatioTransform
)

0 comments on commit b3898e1

Please sign in to comment.