Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of pygrb aligntotalspin functionality into pycbc/transforms.py as a class #3756

Merged
merged 24 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b26d09c
added first version of aligntotalspin class to transforms.py
Jul 8, 2021
cd3e7eb
fully functional (uncommented) aligntotalspin class added to tranform…
Jul 27, 2021
c9e21c6
Reformatted transforms.py and performed a number of small modificatio…
Nov 29, 2021
e22633c
Update pycbc/transforms.py
SamuelH-97 Aug 4, 2021
d2d65d9
Update pycbc/transforms.py
SamuelH-97 Aug 4, 2021
1613752
Fixing bugs I introduced in AlignTotalSpin.
Aug 4, 2021
e75c6a6
Correcting output when no-/aligned-spins passed
Aug 5, 2021
aa6f6c2
Following standard input/output param handling
Aug 5, 2021
e509731
Fix typo
Aug 5, 2021
a7d83df
Adding the transform to dict for config use
Aug 5, 2021
85fb9b1
Make frame transform work on sets of inputs
Aug 6, 2021
2c3e49a
Moved jframe_to_l0frame function to pnutils.py from waveform_modes.py…
Oct 13, 2021
fbbc69c
Moved l0frame_to_jframe function from waveform_modes to pnutils
Oct 26, 2021
fef5fc6
made alterations to ensure my added and moved code is compliant with …
Oct 28, 2021
eafa7a5
made alterations to ensure transforms.py to make compliant with code …
Oct 28, 2021
a167b11
made alterations to ensure transforms.py is compliant with code checks
Oct 28, 2021
a7f26e6
made alterations to ensure transforms.py is compliant with code checks
Oct 28, 2021
ea2958b
made alterations to ensure transforms.py is compliant with code checks
Oct 28, 2021
fceddb9
made alterations to ensure transforms.py is compliant with code checks
Oct 28, 2021
228ea8c
attempting fix for like 2299 of transforms.py
Oct 28, 2021
b0e6ed6
Removed _formatdocstr lines in pnutils
Nov 29, 2021
bf751a5
Updated docstrings in l0frame_to_jframe and jframe_to_i0frame functio…
Dec 6, 2021
ed643b7
added data type labels to docstrings
Dec 6, 2021
48f7d6c
added blank line under dictionary header in docstrings for jframe_to_…
Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions pycbc/pnutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,3 +956,154 @@ def hybrid_meco_frequency(m1, m2, chi1, chi2, qm1=None, qm2=None):
qm2 = 1

return velocity_to_frequency(hybrid_meco_velocity(m1, m2, chi1, chi2, qm1, qm2), m1 + m2)


def jframe_to_l0frame(mass1, mass2, f_ref, phiref=0., thetajn=0., phijl=0.,
spin1_a=0., spin2_a=0.,
spin1_polar=0., spin2_polar=0.,
spin12_deltaphi=0.):
"""Converts J-frame parameters into L0 frame.

Parameters
----------
mass1 : float
The mass of the first component object in the
binary (in solar masses)
mass2 : float
The mass of the second component object in the
binary (in solar masses)
f_ref : float
The reference frequency.
thetajn : float
Angle between the line of sight and the total angular momentume J.
phijl : float
Azimuthal angle of L on its cone about J.
spin1_a : float
The dimensionless spin magnitude :math:`|\\vec{{s}}_1/m^2_1|`.
spin2_a : float
The dimensionless spin magnitude :math:`|\\vec{{s}}_2/m^2_2|`.
spin1_polar : float
Angle between L and the spin magnitude of the larger object.
spin2_polar : float
Angle betwen L and the spin magnitude of the smaller object.
spin12_deltaphi : float
Difference between the azimuthal angles of the spin of the larger
object (S1) and the spin of the smaller object (S2).

Returns
-------
dict :
Dictionary of:

* inclination : float
Inclination (rad), defined as the angle between
the orbital angular momentum L and the
line-of-sight at the reference frequency.
* spin1x : float
The x component of the first binary component's
dimensionless spin.
* spin1y : float
The y component of the first binary component's
dimensionless spin.
* spin1z : float
The z component of the first binary component's
dimensionless spin.
* spin2x : float
The x component of the second binary component's
dimensionless spin.
* spin2y : float
The y component of the second binary component's
dimensionless spin.
* spin2z : float
The z component of the second binary component's
dimensionless spin.
"""
inclination, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z = \
lalsimulation.SimInspiralTransformPrecessingNewInitialConditions(
thetajn, phijl, spin1_polar, spin2_polar, spin12_deltaphi,
spin1_a, spin2_a, mass1*lal.MSUN_SI, mass2*lal.MSUN_SI, f_ref,
phiref)
out = {'inclination': inclination,
'spin1x': spin1x,
'spin1y': spin1y,
'spin1z': spin1z,
'spin2x': spin2x,
'spin2y': spin2y,
'spin2z': spin2z}
return out

def l0frame_to_jframe(mass1, mass2, f_ref, phiref=0., inclination=0.,
spin1x=0., spin1y=0., spin1z=0.,
spin2x=0., spin2y=0., spin2z=0.):
"""Converts L0-frame parameters to J-frame.

Parameters
----------
mass1 : float
The mass of the first component object in the
binary (in solar masses)
mass2 : float
The mass of the second component object in the
binary (in solar masses)
f_ref : float
The reference frequency.
phiref : float
The orbital phase at ``f_ref``.
inclination : float
Inclination (rad), defined as the angle between
the orbital angular momentum L and the
line-of-sight at the reference frequency.
spin1x : float
The x component of the first binary component's
dimensionless spin.
spin1y : float
The y component of the first binary component's
dimensionless spin.
spin1z : float
The z component of the first binary component's
dimensionless spin.
spin2x : float
The x component of the second binary component's
dimensionless spin.
spin2y : float
The y component of the second binary component's
dimensionless spin.
spin2z : float
The z component of the second binary component's
dimensionless spin.

Returns
-------
dict :
Dictionary of:

* thetajn : float
Angle between the line of sight and the total angular momentume J.
* phijl : float
Azimuthal angle of L on its cone about J.
* spin1_a : float
The dimensionless spin magnitude :math:`|\\vec{{s}}_1/m^2_1|`.
* spin2_a : float
The dimensionless spin magnitude :math:`|\\vec{{s}}_2/m^2_2|`.
* spin1_polar : float
Angle between L and the spin magnitude of the larger object.
* spin2_polar : float
Angle betwen L and the spin magnitude of the smaller object.
* spin12_deltaphi : float
Difference between the azimuthal angles of the spin of the larger
object (S1) and the spin of the smaller object (S2).
"""
# Note: unlike other LALSimulation functions, this one takes masses in
# solar masses
thetajn, phijl, s1pol, s2pol, s12_deltaphi, spin1_a, spin2_a = \
lalsimulation.SimInspiralTransformPrecessingWvf2PE(
inclination, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z,
mass1, mass2, f_ref, phiref)
out = {'thetajn': thetajn,
'phijl': phijl,
'spin1_polar': s1pol,
'spin2_polar': s2pol,
'spin12_deltaphi': s12_deltaphi,
'spin1_a': spin1_a,
'spin2_a': spin2_a}
return out
Loading