P_astro_project.p_astro_utils

A place for storing the functions required for the P_astro analysis

Module Contents

Classes

spin

A class for holding the spin calculation functions.

Functions

convert(pdf)

Ensure formatting of the input pdf for use in the cdf functions.

cdf(pdf)

Compute the normalised CDF of the probability distribution x.

cdf_samp(pdf, param)

Create and normalise the cdf and return a sample from it.

SNR_to_FAR(snr[, FAR8, alpha])

Calculate the FAR using the parameterisations from the Lynch at al paper https://arxiv.org/abs/1803.02880.

P_astro_project.p_astro_utils.convert(pdf)

Ensure formatting of the input pdf for use in the cdf functions.

Parameters
pdf: pandas dataframe

The probability distribution of interest.

Returns
pdf: ndarray

The pdf converted to numpy.

P_astro_project.p_astro_utils.cdf(pdf)

Compute the normalised CDF of the probability distribution x.

Parameters
pdf: ndarray

The probability distribution of interest.

Returns
cdf: ndarray

The normalised cumulative distribution of the input probability distribution.

P_astro_project.p_astro_utils.cdf_samp(pdf, param)

Create and normalise the cdf and return a sample from it.

Parameters
pdf: ndarray

The probability distribution of interest.

param: ndarray

The range of values the parameter being sampled can take.

Returns
sample: float or complex (corresponding to fp) or ndarray

Random sample from the cdf.

class P_astro_project.p_astro_utils.spin(a1, a2, tilt_1, tilt_2, q)

A class for holding the spin calculation functions.

chi_eff()

Compute the effective spin parameter, which is that aligned with the orbital angular momentum.

\[\chi_{eff} = \frac{a_{1}\cos{\theta_{1}} + q a_{2} \cos{\theta_{2}}}{1+q}\]
Parameters
a1, a2: float

Spin magnitudes.

tilt_1, tilt_2: float

The tilt angles for bodies 1 and 2.

q: float

Mass ratio (\(\frac{m_2}{m_1}\)).

Returns
chi_eff: float

Effective spin parameter.

chi_p()

Compute the effective spin precession parameter, which is that projected into the plane of the orbit.

\[\chi_{p} = max(a_{1}\sin{\theta_{1}}, \frac{4q + 3}{4+3q}qa_{2}\sin{\theta_2})\]
Parameters
a1, a2: float

Spin magnitudes.

tilt_1, tilt_2: float

The tilt angles for bodies 1 and 2.

q: float

Mass ratio (\(\frac{m_2}{m_1}\)).

Returns
chi_p: float

Effective spin precession parameter.

P_astro_project.p_astro_utils.SNR_to_FAR(snr, FAR8=5500, alpha=0.18)

Calculate the FAR using the parameterisations from the Lynch at al paper https://arxiv.org/abs/1803.02880.

\[\mathrm{FAR} = \mathrm{FAR}_8 \times \exp{\left[-\frac{\rho - 8}{\alpha}\right]}\]
Parameters
snr: float

Signal to noise ratio.

FAR8: float

The approximate false alarm rate for an SNR=8.

alpha: float

The steepness of the exponential function (\(\alpha\))

Returns
FAR: float

The approximate false alarm rate for the input SNR.