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

Add spin from pulsar frequency to conversions #3432

Merged
merged 2 commits into from
Aug 26, 2020
Merged
Changes from all commits
Commits
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
23 changes: 22 additions & 1 deletion pycbc/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,27 @@ def dquadmon_from_lambda(lambdav):
ln_quad_moment = ai + bi*ll + ci*ll**2.0 + di*ll**3.0 + ei*ll**4.0
return numpy.exp(ln_quad_moment) - 1


def spin_from_pulsar_freq(mass, radius, freq):
"""Returns the dimensionless spin of a pulsar.

Assumes the pulsar is a solid sphere when computing the moment of inertia.

Parameters
----------
mass : float
The mass of the pulsar, in solar masses.
radius : float
The assumed radius of the pulsar, in kilometers.
freq : float
The spin frequency of the pulsar, in Hz.
"""
omega = 2 * numpy.pi * freq
mt = mass * lal.MTSUN_SI
mominert = (2/3.) * mt * (radius * 1000 / lal.C_SI)**2
return mominert * omega / mt**2


#
# =============================================================================
#
Expand Down Expand Up @@ -1512,5 +1533,5 @@ def nltides_gw_phase_diff_isco(f_low, f0, amplitude, n, m1, m2):
'final_mass_from_initial', 'final_spin_from_initial',
'optimal_dec_from_detector', 'optimal_ra_from_detector',
'chi_eff_from_spherical', 'chi_p_from_spherical',
'nltides_gw_phase_diff_isco',
'nltides_gw_phase_diff_isco', 'spin_from_pulsar_freq',
]