holodeck.cyutils
Module for methods implemented in cython.
To use and load this module, you will need to build the cython extension using:
$ python setup.py build_ext -i
from the holodeck root directory (containing the setup.py file).
And you still need to install holodeck in develop mode, using:
$ python setup.py develop
- holodeck.cyutils.Sh_rest()
Calculate the noise from all the single sources except the source in question and the next N_excl loudest sources.
- Parameters:
hc_ss ((F,R,L) NDarray) – Characteristic strain from all loud single sources.
hc_bg ((F,R) NDarray) – Characteristic strain from all but loudest source at each frequency.
freqs ((F,) 1Darray) – Frequency bin centers.
nexcl (int) – Number of loudest single sources to exclude from hc_rest noise, in addition to the source in question.
- Returns:
Sh_rest – The noise in a single pulsar from other GW sources for detecting each single source.
- Return type:
(F,R,L) NDarray of scalars
- holodeck.cyutils.gamma_of_rho_interp()
- rho1Darray of scalars
SNR of single sources, in flat array
- rsort1Darray
order of flat rho values smallest to largest
- rho_interp_grid1Darray
rho values corresponding to each gamma
- gamma_interp_grid1Darray
gamma values corresponding to each rho
- holodeck.cyutils.loudest_hc_and_par_from_sorted()
Calculates the characteristic strain from loud single sources and a background of all other sources.
- Parameters:
number ([M, Q, Z, F] NDarray) – number in each bin
h2fdf ([M, Q, Z, F] NDarray) – Strain amplitude squared x frequency / frequency bin width for each bin.
nreals – Number of realizations.
nloudest – Number of loudest sources to separate in each frequency bin.
mt ((M,) 1Darray of scalars) – Total masses, M, of each bin center.
mr ((Q,) 1Darray of scalars) – Mass ratios, q, of each bin center.
rz ((Z,) 1Darray of scalars) – Redshifts, z, of each bin center.
msort ((M*Q*Z,) 1Darray) – M indices of each bin, sorted from largest to smallest h2fdf.
qsort ((M*Q*Z,) 1Darray) – q indices of each bin, sorted from largest to smallest h2fdf.
zsort ((M*Q*Z,) 1Darray) – z indices of each bin, sorted from largest to smallest h2fdf.
normal_threshold (float) – Threshold for approximating poisson sampling as normal.
- Returns:
hc2ss ((F, R, L) Ndarray of scalars) – Char strain squared of the loudest single sources.
hc2bg ((F, R) Ndarray of scalars) – Char strain squared of the background.
lspar ((3, F, R) NDarray of scalars) – Average effective M, q, z parameters of the loudest L sources.
bgpar ((3, F, R) NDarray of scalars) – Average effective M, q, z parameters of the background.
ssidx ((3, F, R, L) NDarray of ints) – Indices of the loudest single sources.
- holodeck.cyutils.loudest_hc_and_par_from_sorted_redz()
Calculates the characteristic strain and binary parameters from loud single sources and a background of all other sources.
- Parameters:
number ([M, Q, Z, F] NDarray) – number in each bin
h2fdf ([M, Q, Z, F] NDarray) – Strain amplitude squared x frequency / frequency bin width for each bin.
nreals – Number of realizations.
nloudest – Number of loudest sources to separate in each frequency bin.
mt ((M,) 1Darray of scalars) – Total masses, M, of each bin center.
mr ((Q,) 1Darray of scalars) – Mass ratios, q, of each bin center.
rz ((Z,) 1Darray of scalars) – Redshifts, z, of each bin center.
redz_final ((M,Q,Z,F) NDarray of scalars) – Final redshifts of each bin.
dcom_final ((M,Q,Z,F) NDarray of scalars) – Final comoving distances of each bin.
sepa ((M,Q,Z,F) NDarray of scalars) – Final separations of each mass and frequency combination.
angs ((M,Q,Z,F)) – Final angular separations of each bin.
msort ((M*Q*Z,) 1Darray) – M indices of each bin, sorted from largest to smallest h2fdf.
qsort ((M*Q*Z,) 1Darray) – q indices of each bin, sorted from largest to smallest h2fdf.
zsort ((M*Q*Z,) 1Darray) – z indices of each bin, sorted from largest to smallest h2fdf.
normal_threshold (float) – Threshold for approximating poisson sampling as normal.
- Returns:
hc2ss ((F, R, L) Ndarray of scalars) – Char strain squared of the loudest single sources.
hc2bg ((F, R) Ndarray of scalars) – Char strain squared of the background.
sspar ((4, F, R) NDarray of scalars) – Effective M, q, z parameters of the loudest L sources. mass, ratio, redshift, redshift_final
bgpar ((4, F, R) NDarray of scalars) – Average effective M, q, z parameters of the background. mass, ratio, redshift, redshift_final
- holodeck.cyutils.loudest_hc_from_sorted()
Calculates the characteristic strain from loud single sources and a background of all other sources.
- Parameters:
number ([M, Q, Z, F] NDarray) – number in each bin
h2fdf ([M, Q, Z, F] NDarray) – Strain amplitude squared x frequency / frequency bin width for each bin.
nreals – Number of realizations.
nloudest – Number of loudest sources to separate in each frequency bin.
msort ((M*Q*Z,) 1Darray) – M indices of each bin, sorted from largest to smallest h2fdf.
qsort ((M*Q*Z,) 1Darray) – q indices of each bin, sorted from largest to smallest h2fdf.
zsort ((M*Q*Z,) 1Darray) – z indices of each bin, sorted from largest to smallest h2fdf.
normal_threshold (float) – Threshold for approximating poisson sampling as normal.
- Returns:
hc2ss ((F, R, L) Ndarray of scalars) – Char strain squared of the loudest single sources.
hc2bg ((F, R) Ndarray of scalars) – Char strain squared of the background.
- holodeck.cyutils.sam_calc_gwb_single_eccen()
Pure-python wrapper for the SAM eccentric GWB calculation method. See: _sam_calc_gwb_single_eccen().
- holodeck.cyutils.sam_calc_gwb_single_eccen_discrete()
Pure-python wrapper for the SAM eccentric GWB calculation method. See: _sam_calc_gwb_single_eccen().
- holodeck.cyutils.snr_ss()
Calculate single source SNR.
- Parameters:
amp ((F,R,L) NDarray) – Dimensionless strain amplitude of loudest single sources
F_iplus ((P,F,S,L) NDarray) – Antenna pattern function for each pulsar.
F_icross ((P,F,S,L) NDarray) – Antenna pattern function for each pulsar.
iotas ((F,S,L) NDarray) – Inclination, used to calculate: \(a_pol = 1 + np.cos(iotas)^2\) \(b_pol = -2 np.cos(iotas)\)
dur (scalar) – Duration of observations.
Phi_0 ((F,S,L) NDarray) – Initial GW phase
S_i ((P,F,R,L) NDarray) – Total noise of each pulsar wrt detection of each single source, in \(s^3\).
freqs ((F,) 1Darray) – Observed frequency bin centers.
- Returns:
snr_ss – SNR from the whole PTA for each single source with each realized sky position (S) and realized strain (R)
- Return type:
(F,R,S,L) NDarray
- holodeck.cyutils.sort_h2fdf()
Get indices of sorted h2fdf. :param h2fdf: h_s^2 * f / df of a source in each bin. :type h2fdf: (M,Q,Z) NDarray
- Returns:
indices
- Return type:
?
- holodeck.cyutils.ss_bg_hc()
Calculates the characteristic strain from loud single sources and a background of all other sources.
- Parameters:
number ([M, Q, Z, F] ndarray) – number in each bin
h2fdf ([M, Q, Z, F] ndarray) – strain squared x frequency / frequency bin width for each bin
nreals – number of realizations
- Returns:
hc2ss ((F, R) Ndarray of scalars)
hc2bg ((F, R) Ndarray of scalars)
ssidx ((3, F, R) Ndarray of ints) – Index of the loudest single source, -1 if there are none at the frequency/realization.
- holodeck.cyutils.ss_bg_hc_and_par()
Calculates the characteristic strain from loud single sources and a background of all other sources.
- Parameters:
number ([M, Q, Z, F] NDarray) – number in each bin
h2fdf ([M, Q, Z, F] NDarray) – Strain amplitude squared x frequency / frequency bin width for each bin.
nreals – Number of realizations.
mt ((M,) 1Darray of scalars) – Total masses, M, of each bin center.
mr ((Q,) 1Darray of scalars) – Mass ratios, q, of each bin center.
rz ((Z,) 1Darray of scalars) – Redshifts, z, of each bin center.
- Returns:
hc2ss ((F, R) Ndarray of scalars) – Char strain squared of the loudest single sources.
hc2bg ((F, R) Ndarray of scalars) – Char strain squared of the background.
ssidx ((3, F, R) NDarray of ints) – Indices of the loudest single sources. -1 if there are no single sources at that frequency/realization.
bgpar ((3, F, R) NDarray of scalars) – Average effective M, q, z parameters of the background.
sspar ((3, F, R) NDarray of scalars) – M, q, z parameters of the loudest single sources.