From a94586e8bd0ffa4c3baed0b94813789711bb7653 Mon Sep 17 00:00:00 2001 From: kazewong Date: Fri, 20 Sep 2024 13:43:47 -0400 Subject: [PATCH] Update parameters from theta to tilt in accordence to Lalsuite --- example/GW150914_IMRPhenomPV2.py | 8 ++++---- src/jimgw/single_event/transforms.py | 6 +++--- src/jimgw/single_event/utils.py | 21 +++++++++++---------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/example/GW150914_IMRPhenomPV2.py b/example/GW150914_IMRPhenomPV2.py index 1263c85b..ef35f5cf 100644 --- a/example/GW150914_IMRPhenomPV2.py +++ b/example/GW150914_IMRPhenomPV2.py @@ -108,11 +108,11 @@ sample_transforms = [ # ComponentMassesToChirpMassMassRatioTransform, BoundToUnbound(name_mapping = (["M_c"], ["M_c_unbounded"]), original_lower_bound=M_c_min, original_upper_bound=M_c_max), - BoundToUnbound(name_mapping = (["eta"], ["eta_unbounded"]), original_lower_bound=q_min, original_upper_bound=q_max), + BoundToUnbound(name_mapping = (["q"], ["q_unbounded"]), original_lower_bound=q_min, original_upper_bound=q_max), BoundToUnbound(name_mapping = (["theta_jn"], ["theta_jn_unbounded"]) , original_lower_bound=0.0, original_upper_bound=jnp.pi), BoundToUnbound(name_mapping = (["phi_jl"], ["phi_jl_unbounded"]) , original_lower_bound=0.0, original_upper_bound=2 * jnp.pi), - BoundToUnbound(name_mapping = (["theta_1"], ["theta_1_unbounded"]) , original_lower_bound=0.0, original_upper_bound=jnp.pi), - BoundToUnbound(name_mapping = (["theta_2"], ["theta_2_unbounded"]) , original_lower_bound=0.0, original_upper_bound=jnp.pi), + BoundToUnbound(name_mapping = (["tilt_1"], ["tilt_1_unbounded"]) , original_lower_bound=0.0, original_upper_bound=jnp.pi), + BoundToUnbound(name_mapping = (["tilt_2"], ["tilt_2_unbounded"]) , original_lower_bound=0.0, original_upper_bound=jnp.pi), BoundToUnbound(name_mapping = (["phi_12"], ["phi_12_unbounded"]) , original_lower_bound=0.0, original_upper_bound=2 * jnp.pi), BoundToUnbound(name_mapping = (["a_1"], ["a_1_unbounded"]) , original_lower_bound=0.0, original_upper_bound=1.0), BoundToUnbound(name_mapping = (["a_2"], ["a_2_unbounded"]) , original_lower_bound=0.0, original_upper_bound=1.0), @@ -126,8 +126,8 @@ ] likelihood_transforms = [ - MassRatioToSymmetricMassRatioTransform, SpinToCartesianSpinTransform(freq_ref=20.), + MassRatioToSymmetricMassRatioTransform, ] diff --git a/src/jimgw/single_event/transforms.py b/src/jimgw/single_event/transforms.py index 1bf8f3a7..b3062da9 100644 --- a/src/jimgw/single_event/transforms.py +++ b/src/jimgw/single_event/transforms.py @@ -37,7 +37,7 @@ def __init__( freq_ref: Float, ): name_mapping = ( - ["theta_jn", "phi_jl", "theta_1", "theta_2", "phi_12", "a_1", "a_2"], + ["theta_jn", "phi_jl", "tilt_1", "tilt_2", "phi_12", "a_1", "a_2"], ["iota", "s1_x", "s1_y", "s1_z", "s2_x", "s2_y", "s2_z"], ) super().__init__(name_mapping) @@ -48,8 +48,8 @@ def named_transform(x): iota, s1x, s1y, s1z, s2x, s2y, s2z = spin_to_cartesian_spin( x["theta_jn"], x["phi_jl"], - x["theta_1"], - x["theta_2"], + x["tilt_1"], + x["tilt_2"], x["phi_12"], x["a_1"], x["a_2"], diff --git a/src/jimgw/single_event/utils.py b/src/jimgw/single_event/utils.py index e136af02..517b2844 100644 --- a/src/jimgw/single_event/utils.py +++ b/src/jimgw/single_event/utils.py @@ -275,6 +275,7 @@ def eta_to_q(eta: Float) -> Float: temp = 1 / eta / 2 - 1 return temp - (temp**2 - 1) ** 0.5 + def euler_rotation(delta_x: Float[Array, " 3"]): """ Calculate the rotation matrix mapping the vector (0, 0, 1) to delta_x @@ -395,8 +396,8 @@ def theta_phi_to_ra_dec(theta: Float, phi: Float, gmst: Float) -> tuple[Float, F def spin_to_cartesian_spin( thetaJN: Float, phiJL: Float, - theta1: Float, - theta2: Float, + tilt1: Float, + tilt2: Float, phi12: Float, chi1: Float, chi2: Float, @@ -417,9 +418,9 @@ def spin_to_cartesian_spin( Zenith angle between the total angular momentum and the line of sight phiJL: Float Difference between total and orbital angular momentum azimuthal angles - theta1: Float + tilt1: Float Zenith angle between the spin and orbital angular momenta for the primary object - theta2: Float + tilt2: Float Zenith angle between the spin and orbital angular momenta for the secondary object phi12: Float Difference between the azimuthal angles of the individual spin vector projections @@ -483,16 +484,16 @@ def rotate_z(angle, vec): s1hat = jnp.array( [ - jnp.sin(theta1) * jnp.cos(phiRef), - jnp.sin(theta1) * jnp.sin(phiRef), - jnp.cos(theta1), + jnp.sin(tilt1) * jnp.cos(phiRef), + jnp.sin(tilt1) * jnp.sin(phiRef), + jnp.cos(tilt1), ] ) s2hat = jnp.array( [ - jnp.sin(theta2) * jnp.cos(phi12 + phiRef), - jnp.sin(theta2) * jnp.sin(phi12 + phiRef), - jnp.cos(theta2), + jnp.sin(tilt2) * jnp.cos(phi12 + phiRef), + jnp.sin(tilt2) * jnp.sin(phi12 + phiRef), + jnp.cos(tilt2), ] )