Skip to content

Commit

Permalink
Adding the named_Mc_q_to_m1_m2 back
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunhopang committed Sep 2, 2024
1 parent 86605ea commit 2fbfc04
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions src/jimgw/single_event/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ def named_inverse_transform(x):

self.inverse_transform_func = named_inverse_transform

def named_m1_m2_to_Mc_q(x):
Mc, q = m1_m2_to_Mc_q(x["m_1"], x["m_2"])
return {"M_c": Mc, "q": q}


@jaxtyped(typechecker=typechecker)
class GeocentricArrivalTimeToDetectorArrivalTimeTransform(
Expand Down Expand Up @@ -383,28 +379,56 @@ def named_inverse_transform(x):
}

self.inverse_transform_func = named_inverse_transform


ComponentMassesToChirpMassMassRatioTransform = BijectiveTransform((["m_1", "m_2"], ["M_c", "q"]))

def named_m1_m2_to_Mc_q(x):
Mc, q = m1_m2_to_Mc_q(x["m_1"], x["m_2"])
return {"M_c": Mc, "q": q}


def named_Mc_q_to_m1_m2(x):
m1, m2 = Mc_q_to_m1_m2(x["M_c"], x["q"])
return {"m_1": m1, "m_2": m2}


ComponentMassesToChirpMassMassRatioTransform = BijectiveTransform(
(["m_1", "m_2"], ["M_c", "q"])
)
ComponentMassesToChirpMassMassRatioTransform.transform_func = named_m1_m2_to_Mc_q
ComponentMassesToChirpMassMassRatioTransform.inverse_transform_func = named_Mc_q_to_m1_m2
ComponentMassesToChirpMassMassRatioTransform.inverse_transform_func = (
named_Mc_q_to_m1_m2
)


def named_m1_m2_to_Mc_eta(x):
Mc, eta = m1_m2_to_Mc_eta(x["m_1"], x["m_2"])
return {"M_c": Mc, "eta": eta}


def named_Mc_eta_to_m1_m2(x):
m1, m2 = Mc_eta_to_m1_m2(x["M_c"], x["eta"])
return {"m_1": m1, "m_2": m2}

ComponentMassesToChirpMassSymmetricMassRatioTransform = BijectiveTransform((["m_1", "m_2"], ["M_c", "eta"]))
ComponentMassesToChirpMassSymmetricMassRatioTransform.transform_func = named_m1_m2_to_Mc_eta
ComponentMassesToChirpMassSymmetricMassRatioTransform.inverse_transform_func = named_Mc_eta_to_m1_m2

ComponentMassesToChirpMassSymmetricMassRatioTransform = BijectiveTransform(
(["m_1", "m_2"], ["M_c", "eta"])
)
ComponentMassesToChirpMassSymmetricMassRatioTransform.transform_func = (
named_m1_m2_to_Mc_eta
)
ComponentMassesToChirpMassSymmetricMassRatioTransform.inverse_transform_func = (
named_Mc_eta_to_m1_m2
)


def named_q_to_eta(x):
return {"eta": q_to_eta(x["q"])}


def named_eta_to_q(x):
return {"q": eta_to_q(x["eta"])}


MassRatioToSymmetricMassRatioTransform = BijectiveTransform((["q"], ["eta"]))
MassRatioToSymmetricMassRatioTransform.transform_func = named_q_to_eta
MassRatioToSymmetricMassRatioTransform.inverse_transform_func = named_eta_to_q
Expand Down

0 comments on commit 2fbfc04

Please sign in to comment.