pyRing package

Submodules

pyRing.NR_amp module

class pyRing.NR_amp.Amp_KHS(eta, chi_eff)[source]

Bases: object

QNM real amplitudes fitting functions for remnant BHs resulting from the coalescence of two non-precessing progenitors in a quasi-circular orbit. References: https://arxiv.org/abs/1207.0399, https://arxiv.org/abs/1406.3201.

class pyRing.NR_amp.Amp_MMRDNP(eta, chi_s, chi_a, delta)[source]

Bases: object

QNM complex amplitudes fitting functions for remnant BHs resulting from the coalescence of two non-precessing progenitors in a quasi-circular orbit. Reference: https://arxiv.org/abs/1801.08208.

class pyRing.NR_amp.Amp_MMRDNS(eta)[source]

Bases: object

QNM complex amplitudes fitting functions for remnant BHs resulting from the coalescence of two non-spinning progenitors in a quasi-circular orbit. Reference: https://github.com/llondon6/kerr_public/blob/master/kerr/formula/mmrdns_amplitudes.py (the ones in the original publication https://arxiv.org/abs/1404.3197 are not up to date).

pyRing.eob_utils module

pyRing.eob_utils.Y(double Y_0, double b_1, double b_2, double b_3, double c_1, double c_2, double c_3, double af, double af2, double af3)

pyRing.inject_signal module

pyRing.inject_signal.TEOBPM_injection(**kwargs)[source]

Create an injection using a TEOBPM waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – TEOBPM waveform model.

Return type

object

pyRing.inject_signal.damped_sinusoids_injection(**kwargs)[source]

Create an injection using a damped sinusoid waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – Damped sinusoid waveform model.

Return type

object

pyRing.inject_signal.inject_IMR_signal(times, triggertime, ifo, print_output=True, **kwargs)[source]

Create an IMR waveform model to be injected into the data.

Parameters
  • times (array) – Array containing the times at which the waveform will be evaluated.

  • triggertime (float) – Time of the trigger.

  • ifo (string) – Name of the interferometer.

  • kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – IMR waveform model.

Return type

object

pyRing.inject_signal.inject_ringdown_signal(times, triggertime, ifo, print_output=True, **kwargs)[source]

Main function to set an injection using one of the analytical ringdown templates available. Handles parameters common to all templates.

Parameters
  • times (array) – Time axis of the data.

  • triggertime (float) – GPS time of the trigger.

  • ifo (str) – Name of the detector.

  • kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wave – Time series of the injected signal.

Return type

array

pyRing.inject_signal.kerr_injection(**kwargs)[source]

Create an injection using a Kerr waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – Kerr waveform model.

Return type

object

pyRing.inject_signal.khs_injection(**kwargs)[source]

Create an injection using a KHS waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – KHS waveform model.

Return type

object

pyRing.inject_signal.load_injected_ra_dec(triggertime, kwargs)[source]

Load the sky position of the signal injection.

Parameters
  • triggertime (float) – GPS time of the trigger.

  • kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

  • ra (float) – Right ascension of the signal injection.

  • dec (float) – Declination of the signal injection.

pyRing.inject_signal.mmrdnp_injection(**kwargs)[source]

Create an injection using a MMRDNP waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – MMRDNP waveform model.

Return type

object

pyRing.inject_signal.mmrdns_injection(**kwargs)[source]

Create an injection using a MMRDNS waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – MMRDNS waveform model.

Return type

object

pyRing.inject_signal.morlet_gabor_wavelets_injection(**kwargs)[source]

Create an injection using a Morlet-Gabor wavelets waveform model.

Parameters

kwargs (dict) – Dictionary containing the parameters of the injection.

Returns

wf_model – Morlet-Gabor waveform model.

Return type

object

pyRing.likelihood module

pyRing.likelihood.inner_product_direct_inversion(ndarray vector1, ndarray vector2, ndarray inverse_covariance) → double

Compute the inner product between two vectors using the inverse of the covariance matrix.

Parameters
  • vector1 (array of shape (n,)) – The first vector.

  • vector2 (array of shape (n,)) – The second vector.

  • inverse_covariance (array of shape (n,n)) – The inverse of the covariance matrix.

Returns

inner_product – The inner product between the two vectors.

Return type

double

pyRing.likelihood.loglikelihood(model, x, waveform_model, double ra, double dec, double psi, double t_start, dict time_delay, unicode ref_det, int truncate, int duration_n, unsigned int OnsourceACF=0, unsigned int MaxEntPSD=0, unsigned int Dirac_comb=0, unsigned int Zeroing_data=0, unicode likelihood_method=u'direct-inversion', unsigned int split_inner_prod=0)
pyRing.likelihood.project(ndarray hs, ndarray hvx, ndarray hvy, ndarray hp, ndarray hc, detector, double ra, double dec, double psi, tgps) → ndarray

Compute the complex time series projected onto the given detector.

Parameters
  • hs (array of shape (n,)) – The complex time series of the breathing mode.

  • hvx (array of shape (n,)) – The complex time series of the longitudinal mode in the x direction.

  • hvy (array of shape (n,)) – The complex time series of the longitudinal mode in the y direction.

  • hp (array of shape (n,)) – The complex time series of the plus polarization.

  • hc (array of shape (n,)) – The complex time series of the cross polarization.

  • detector (laldetector structure) – The detector.

  • ra (double) – The right ascension.

  • dec (double) – The declination.

  • psi (double) – The polarisation angle.

  • tgps (double) – The time (GPS seconds).

pyRing.likelihood.residuals_inner_product_cholesky_solve_triangular(ndarray residuals, ndarray cholesky) → double

Compute the inner product between the residuals using the inverse of the covariance matrix through the scipy solve_triangular method, exploiting the Cholesky decomposition.

Parameters
  • residuals (array of shape (n,)) – The residuals.

  • cholesky (array of shape (n,n)) – The Cholesky decomposition of the covariance matrix.

Returns

inner_product – The inner product between the residuals.

Return type

double

pyRing.likelihood.residuals_inner_product_direct_inversion(ndarray residuals, ndarray inverse_covariance) → double

Compute the inner product between the residuals using the direct inverse of the covariance matrix.

Parameters
  • residuals (array of shape (n,)) – The residuals.

  • inverse_covariance (array of shape (n,n)) – The inverse of the covariance matrix.

Returns

inner_product – The inner product between the residuals.

Return type

double

pyRing.likelihood.residuals_inner_product_toeplitz_inversion(ndarray residuals, ndarray acf) → double

Compute the inner product between the residuals using the inverse of the covariance matrix through the scipy solve_toeplitz method.

Parameters
  • residuals (array of shape (n,)) – The residuals.

  • acf (array of shape (n,)) – The autocorrelation function of the residuals.

Returns

inner_product – The inner product between the residuals.

Return type

double

pyRing.likelihood.toeplitz_slogdet(ndarray r) → tuple

Method from Marano et al. “Fitting Earthquake Spectra: Colored Noise and Incomplete Data”, Bulletin of the Seismological Society of America, Vol. 107, No. 1, pp. –, February 2017, doi: 10.1785/0120160030 Code available here: http://mercalli.ethz.ch/~marra/publications/2017_fitting_earthquake_spectra_colored_noise_and_incomplete_data/ All credits go to the original authors.

Compute the log determinant of a positive-definite symmetric toeplitz matrix. The determinant is computed recursively. The intermediate solutions of the Levinson recursion are exploited.

Parameters

r (array of shape (n,)) – The first row of the Toeplitz matrix.

Returns

  • sign – Sign of the determinant

  • logdet – Natural log of the determinant

pyRing.likelihood.vector_module(ndarray X) → double

Compute the module of a vector.

Parameters

X (array of shape (n,)) – The vector.

Returns

module – The module of the vector.

Return type

double

pyRing.noise module

pyRing.noise.UNCHECKED_acf_finite(y, k)[source]

Estimate directly from the data y Weighting by 1/(N-i) for lag i where N=len(y) k specifies the desired size of the ACF, i.e. the number of samples in the on-source segment.

y: numpy array

Array of data.

k: int

Number of samples in the on-source segment.

R: numpy array

Array of ACF values.

pyRing.noise.UNCHECKED_acf_from_ideal_psd(ASDtxtfile, fmin, srate, T)[source]

Build the ACF from an ideal PSD.

Parameters
  • ASDtxtfile (string) – Path to the file containing the ASD.

  • fmin (float) – Minimum frequency of the PSD.

  • srate (float) – Sampling rate of the ACF.

  • T (float) – Length of the ACF.

Returns

  • lag (numpy array) – Array of lags.

  • R (numpy array) – Array of ACF values.

pyRing.noise.UNCHECKED_estimated_acf(x)[source]

Estimate ACF directly from the data.

Parameters

x (numpy array) – Array of data.

Returns

r – Array of ACF values.

Return type

numpy array

pyRing.noise.acf(y, fft=True, simple_norm=False)[source]

Returns the autocorrelation function (ACF): R[i] = sum_n x[n]*x[n+i], in the form of an array spanned by the index i.

Computes the ACF using either the standard correlation (with the appropriate normalisation) or the fft method. The latter simply exploits the fact that the ACF is a convolution product and that the Fourier transform of a a convolution product is a product in the Fourier domain, see section ‘Efficient computation’ of ‘https://en.wikipedia.org/wiki/Autocorrelation#cite_note-3.

The difference between the two methods is in the treatment of boundary terms. When computing the ACF using the standard correlation, we ‘slide’ the data vector against a delayed copy of itself, obtaining the correlation at different lags. For all lags except lag=0, part of the ‘slided’ vector will spill over the boundaries of the fixed vector. In this method, terms outside the vectors boundaries are assigned zeros. This implies that for increasing lag, an increasingly smaller number of terms will contribute, and the variance of large-lag terms grow. Also, the ACF will eventually go to zero, when the maximum lag is reached. When employing the fft method instead, the data are windowed at the boundaries to avoid Gibbs phenomena, and periodic boundary conditions are assumed when applying the Fourier transform, implying a different structure for large lags.

For small lags (compared to the total length of the vector), the portion of the sum which dependent on boundary terms will be small, since the vectors still possess a significant overlap, and the specific method used should not matter (if gaussianity and stationarity assumptions are respected). For this reason, the length of the data on which the ACF is estimated, should always be much larger than the analysis segment length.

Parameters
  • y (numpy array) – The data vector.

  • fft (bool) – Whether to use the fft method.

  • simple_norm (bool) – Whether to use the simple normalization (1/N) or the standard normalization (1/(N-lag)).

Returns

acf_normed – The normalized ACF.

Return type

numpy array

pyRing.noise.add_injection(on_source_times, on_source_strain, triggertime, ifo, kwargs)[source]

Add an injection to the data.

Parameters
  • on_source_times (numpy array) – The times of the on-source data.

  • on_source_strain (numpy array) – The on-source strain data.

  • triggertime (float) – The time of the trigger.

  • ifo (string) – The interferometer in which the signal is injected.

  • kwargs (dictionary) – The dictionary of keyword arguments.

Returns

on_source_strain – The on-source strain data including the injection.

Return type

numpy array

pyRing.noise.bandpass_data(rawstrain, f_min_bp, f_max_bp, srate_dt, bandpassing_flag)[source]

Bandpass the raw strain between [f_min, f_max] Hz.

Parameters
  • rawstrain (numpy array) – The raw strain data.

  • f_min_bp (float) – The lower frequency of the bandpass filter.

  • f_max_bp (float) – The upper frequency of the bandpass filter.

  • srate_dt (float) – The sampling rate of the data.

  • bandpassing_flag (bool) – Whether to apply bandpassing or not.

Returns

strain – The bandpassed strain data.

Return type

numpy array

pyRing.noise.check_Plancherel_ratio(psd_window_norm, df_welch, psd_welch, dt, ACF, debug)[source]

This function checks if the Plancherel theorem is verified by our ACF estimate, by using the fact that twice the Fourier transform of the ACF = one-sided PSD (approximately, in the truncated case). Since the psd is the one-sided, we only stored positive values, but Plancherel theorem must be evaluated on both positive and negative frequencies. Also, need to take into account the fact that the window absorbed some power.

Parameters
  • psd_window_norm (float) – Normalization factor for the window.

  • df_welch (float) – Frequency resolution of the PSD estimate.

  • psd_welch (1D numpy array) – PSD estimate.

  • dt (float) – Time resolution of the ACF estimate.

  • ACF (1D numpy array) – ACF estimate.

  • debug (boolean) – If True, it prints additional information.

Returns

Nothing. It just prints the Plancherel theorem ratio E(f)/E(t) (expected value

Return type

~1)

pyRing.noise.check_chunksizes_consistency(signal_chunk_size, noise_chunk_size, truncate)[source]

Check the consistency of the chunksizes.

Parameters
  • signal_chunk_size (int) – The size of the signal chunk.

  • noise_chunk_size (int) – The size of the noise chunk.

  • truncate (bool) – Whether to truncate the data.

pyRing.noise.check_consistency_loading_options(ifo_datafile, download_data_flag, kwargs)[source]

Check that the options passed for data loading are consistent.

Parameters
  • ifo_datafile (str) – Path to the data file to be loaded.

  • download_data_flag (bool) – Flag to download data from the data server.

  • kwargs (dict) – Dictionary of options passed to the script.

Returns

Return type

Nothing, it just raises an error if the options are not consistent.

pyRing.noise.check_covariance_matrix_inversion_stability(Covariance_matrix_signal, debug, tolerance=100000000000000.0)[source]

This function checks the stability of the covariance matrix inversion, by computing its conditioning number. If the latter is larger than a certain user-specified tolerance, it raises a warning.

Parameters
  • Covariance_matrix_signal (2D numpy array) – Covariance matrix of the signal.

  • debug (boolean) – If True, it prints additional information.

  • tolerance (float) – Tolerance for the conditioning number of the covariance matrix. If the conditioning number is larger than this value, it raises a warning.

Returns

Return type

Nothing. It just raises a warning if the covariance matrix is not well conditioned.

pyRing.noise.check_data_gaussianity(times, data, Covariance, signal_seglen, trigger_time, string_output, outdir)[source]

This function checks if the data are Gaussian, by computing the ACF and the reduced chisquare of the ACF estimate.

Parameters
  • times (1D numpy array) – Time array.

  • data (1D numpy array) – Data array.

  • Covariance (2D numpy array) – Covariance matrix.

  • signal_seglen (float) – Signal segment length.

  • trigger_time (float) – Trigger time.

  • string_output (string) – Output string.

  • outdir (string) – Output directory.

Returns

Return type

Nothing. It just plots the whitened data against a normal distribution, to visually check gaussianity.

pyRing.noise.check_sampling_rate_compatibility(requested_sampling_rate, data_sampling_rate)[source]

Check that the requested sampling rate is not higher than the data sampling rate. Raise a error otherwise.

Parameters
  • requested_sampling_rate (float) – The requested sampling rate.

  • data_sampling_rate (float) – The sampling rate of the input data.

Returns

Return type

Nothing, but raises a ValueError if the requested sampling rate is higher than the data sampling rate.

pyRing.noise.check_seglen_compatibility(signal_chunk_size, noise_chunk_size, T)[source]

Check that the noise and signal chunk sizes are shorter than the data duration. Raise a error otherwise.

Parameters
  • signal_chunk_size (float) – The requested signal chunk size.

  • noise_chunk_size (float) – The requested noise chunk size.

Returns

Return type

Nothing, but raises a ValueError if the requested sampling rate is higher than the data sampling rate.

pyRing.noise.chisquare_computation(ACF, chisquare_flag)[source]

This function computes the reduced chisquare of the ACF estimate, and prints it.

Parameters
  • ACF (1D numpy array) – ACF estimate.

  • chisquare_flag (boolean) – If True, it computes the reduced chisquare of the ACF estimate.

Returns

Return type

Nothing. It just prints the reduced chisquare of the ACF estimate.

pyRing.noise.chunks(times, strain, chunksize, trigger_time)[source]

Divide the data in chunks. Skip the 0th and the last chunks which have filter ringing from downsampling.

Parameters
  • times (numpy array) – The times of the data.

  • strain (numpy array) – The strain data.

  • chunksize (int) – The size of the chunks.

  • trigger_time (float) – The time of the trigger.

Returns

  • time_chunks_list (numpy array) – The times of the chunks.

  • data_chunks_list (numpy array) – The data of the chunks.

  • index_trig (int) – The index of the trigger time.

pyRing.noise.chunks_iterator(times, strain, chunksize, avoid=None, window=False, alpha=0.1)[source]

Divide the data in chunks. Skip the 0th and the last chunks which have filter ringing from downsampling.

Parameters
  • times (numpy array) – The times of the data.

  • strain (numpy array) – The strain data.

  • chunksize (int) – The size of the chunks.

  • avoid (float) – The time to avoid.

  • window (bool) – Whether to apply a window to the data.

  • alpha (float) – The alpha parameter of the Tukey window.

Returns

strain – The strain data.

Return type

numpy array

pyRing.noise.compute_Welch_PSD(off_source_strain, srate, noise_seglen, psd_window)[source]

Compute the one-sided PSD with the Welch method.

Parameters
  • off_source_strain (numpy array) – The off-source strain.

  • srate (float) – The sampling rate.

  • noise_seglen (int) – The length of the noise segments.

  • psd_window (str) – The window to use for the PSD estimation.

Returns

  • psd_welch (numpy array) – The one-sided PSD.

  • freqs_welch (numpy array) – The frequencies associated to the PSD.

  • df_welch (float) – The PSD frequency resolution.

pyRing.noise.compute_acf_and_whitening_psd(times, strain, starttime, T, srate, triggertime, index_trigtime, dt, window_flag, alpha_window, noise_chunk_size, noise_seglen, signal_seglen, f_min_bp, f_max_bp, fft_acf, freqs_welch, psd_welch, ifo, kwargs)[source]

Compute the ACF and the whitening PSD.

Parameters
  • times (numpy array) – The times of the data.

  • strain (numpy array) – The strain data.

  • starttime (float) – The start time of the data.

  • T (float) – The duration of the data.

  • srate (float) – The sampling rate.

  • triggertime (float) – The trigger time.

  • index_trigtime (int) – The index of the trigger time.

  • dt (float) – The time resolution.

  • window_flag (bool) – Whether to apply a window to the data.

  • alpha_window (float) – The alpha parameter of the Tukey window.

  • noise_chunk_size (int) – The size of the noise chunks.

  • noise_seglen (int) – The length of the noise segments.

  • signal_seglen (int) – The length of the signal segments.

  • f_min_bp (float) – The minimum frequency of the bandpass filter.

  • f_max_bp (float) – The maximum frequency of the bandpass filter.

  • fft_acf (bool) – Whether to use the fft method to compute the ACF.

  • freqs_welch (numpy array) – The frequencies associated to the PSD.

  • psd_welch (numpy array) – The one-sided PSD.

  • ifo (str) – The interferometer.

  • kwargs (dict) – The dictionary of keyword arguments.

Returns

  • acf (numpy array) – The ACF.

  • acf_normed (numpy array) – The normalized ACF.

  • psd (numpy array) – The one-sided PSD.

  • freqs (numpy array) – The frequencies associated to the PSD.

  • df (float) – The PSD frequency resolution.

pyRing.noise.compute_maxent_PSD(times, strain, starttime, T, srate, triggertime, index_trigtime, dt, alpha_window, window_flag, noise_seglen, signal_seglen, fft_acf, freqs_welch, psd_welch, ifo, kwargs)[source]

Compute the one-sided average PSD with the MESA method. Currently not used.

Parameters
  • times (array) – The time axis of the data.

  • strain (array) – The data to be analysed.

  • starttime (float) – The start time of the data.

  • T (float) – The duration of the data.

  • srate (float) – The sampling rate of the data.

  • triggertime (float) – The time of the signal injection.

  • index_trigtime (int) – The index of the time of the signal injection.

  • dt (float) – The time step of the data.

  • alpha_window (float) – The alpha parameter of the Tukey window.

  • window_flag (string) – The windowing function to be used.

  • noise_seglen (int) – The length of the noise segments.

  • signal_seglen (int) – The length of the signal segments.

  • fft_acf (bool) – Whether the ACF is computed in the time or frequency domain.

  • freqs_welch (array) – The frequencies at which the Welch PSD is evaluated.

  • psd_welch (array) – The one-sided Welch PSD.

  • ifo (string) – The detector name.

  • kwargs (dict) – The dictionary of the input parameters.

Returns

  • freqs_maxent (array) – The frequencies at which the PSD is evaluated.

  • psd_maxent (array) – The one-sided average PSD.

pyRing.noise.compute_on_off_source_strain(times, strain, signal_seglen, index_trigtime)[source]

Compute the on-source and off-source strain data.

Parameters
  • times (numpy array) – The times of the data.

  • strain (numpy array) – The strain data.

  • signal_seglen (int) – The length of the signal segment.

  • index_trigtime (int) – The index of the trigger time.

Returns

  • on_source_strain (numpy array) – The on-source strain data.

  • on_source_times (numpy array) – The on-source times.

  • on_source_mask (numpy array) – The on-source mask.

  • off_source_strain (numpy array) – The off-source strain data.

  • off_source_times (numpy array) – The off-source times.

  • off_source_mask (numpy array) – The off-source mask.

class pyRing.noise.detector(ifo_name, datafile, **kwargs)[source]

Bases: object

pyRing.noise.download_data(ifo, triggertime, kwargs)[source]

Download data from the data server.

Parameters
  • ifo (str) – Name of the interferometer.

  • triggertime (float) – GPS time of the trigger.

  • kwargs (dict) – Dictionary of options passed to the script.

Returns

  • starttime (float) – GPS start time of the data downloaded.

  • dt (float) – Time step of the data downloaded.

  • srate_dt (float) – Sampling rate of the data downloaded.

  • rawstrain (numpy.ndarray) – Array of the data downloaded.

pyRing.noise.download_data_with_gwdatafind(ifo, starttime, endtime, channel, kwargs)[source]

Download data from the data server using gwdatafind.

Parameters
  • ifo (str) – Name of the interferometer.

  • starttime (float) – GPS start time of the data to be downloaded.

  • endtime (float) – GPS end time of the data to be downloaded.

  • channel (str) – Name of the channel to be downloaded.

  • kwargs (dict) – Dictionary of options passed to the script.

Returns

tseries – Time series of the data downloaded.

Return type

gwpy.timeseries.TimeSeries

pyRing.noise.download_data_with_gwpy(ifo, starttime, endtime, channel, kwargs)[source]

Download data from the data server using gwpy.

Parameters
  • ifo (str) – Name of the interferometer.

  • starttime (float) – GPS start time of the data to be downloaded.

  • endtime (float) – GPS end time of the data to be downloaded.

  • channel (str) – Name of the channel to be downloaded.

  • kwargs (dict) – Dictionary of options passed to the script.

Returns

tseries – Time series of the data downloaded.

Return type

gwpy.timeseries.TimeSeries

pyRing.noise.downsample_data(strain, srate, srate_dt)[source]

Downsample the data to the requested sampling rate.

Parameters
  • strain (numpy array) – The strain data.

  • srate (float) – The requested sampling rate.

  • srate_dt (float) – The sampling rate of the data.

Returns

  • strain (numpy array) – The downsampled strain data.

  • dt (float) – The new sampling rate.

pyRing.noise.excise_nans_from_strain(rawstrain, starttime, T, triggertime, signal_chunk_size, dt, ifo_datafile, download_data_flag)[source]

If there are nans in the data, resize the strain to the longest segment which contains no nans.

Parameters
  • rawstrain (numpy array) – The strain data (possibly containing nans).

  • starttime (float) – The start time of the data.

  • T (float) – The duration of the data.

  • triggertime (float) – The time of the trigger.

  • signal_chunk_size (float) – The duration of the on-source chunk.

  • dt (float) – The sampling time of the data.

  • ifo_datafile (string) – The path to the data file of a given ifo.

  • download_data_flag (boolean) – Flag to download the data from the LVK server.

Returns

  • rawstrain (numpy array) – The updated strain data after nans removal.

  • starttime (float) – The updated start time of the data after nans removal.

  • T (float) – The updated duration of the data after nans removal.

pyRing.noise.fetch_data(ifo, tstart, tend, channel=None, path=None, verbose=0)[source]

Fetch data from the data server.

Parameters
  • ifo (str) – Name of the interferometer.

  • tstart (float) – GPS start time of the data to be downloaded.

  • tend (float) – GPS end time of the data to be downloaded.

  • channel (str) – Name of the channel to be read from frame data. If ‘GWOSC’ will fetch open data.

  • path (str) – Path to the data file to be loaded. If the file already exists locally, it will be read from disk rather than fetched from the data server.

  • verbose (int) – Verbosity level.

Returns

tseries – Time series of the data downloaded.

Return type

gwpy.timeseries.TimeSeries

pyRing.noise.generate_coloured_gaussian_noise(ifo, srate, dt, T, kwargs)[source]

Generate coloured gaussian noise.

Parameters
  • ifo (str) – Name of the interferometer.

  • srate (float) – Sampling rate of the data.

  • dt (float) – Time step of the data.

  • T (float) – Duration of the data.

  • kwargs (dict) – Dictionary containing the input arguments.

Returns

noise_strain – Array of the data downloaded.

Return type

numpy.ndarray

pyRing.noise.generate_coloured_gaussian_noise_from_acf_file(acf_file)[source]

Generate coloured gaussian noise from an ACF file.

Parameters

acf_file (str) – Name of the file containing the ACF.

Returns

noise_strain – Array of the data downloaded.

Return type

numpy.ndarray

pyRing.noise.generate_coloured_gaussian_noise_from_psd_file(psd_file, srate, dt, T, kwargs)[source]

Generate coloured gaussian noise from a PSD file.

Parameters

psd_file (str) – Name of the file containing the PSD.

Returns

noise_strain – Array of the data downloaded.

Return type

numpy.ndarray

pyRing.noise.generate_gaussian_noise(ifo, triggertime, srate, kwargs)[source]

Generate gaussian noise.

Parameters
  • ifo (str) – Name of the interferometer.

  • triggertime (float) – GPS time of the trigger.

  • srate (float) – Sampling rate of the data.

  • kwargs (dict) – Dictionary of options passed to the script.

Returns

  • starttime (float) – GPS start time of the data downloaded.

  • dt (float) – Time step of the data downloaded.

  • srate_dt (float) – Sampling rate of the data downloaded.

  • rawstrain (numpy.ndarray) – Array of the data downloaded.

pyRing.noise.generate_white_gaussian_noise(sigma, srate, T)[source]

Generate white gaussian noise.

Parameters
  • sigma (float) – Standard deviation of the noise.

  • srate (float) – Sampling rate of the data.

  • T (float) – Duration of the data.

Returns

noise_strain – Array of the data downloaded.

Return type

numpy.ndarray

pyRing.noise.load_data(ifo, fname, **kwargs)[source]

Main function to read the data (from file or downloads it using gwpy), computing the ACF (either from the data or from given file input ACF/PSD) and inject a template if requested.

Parameters
  • ifo (str) – Name of the interferometer.

  • fname (str) – Name of the file containing the data.

  • kwargs (dict) – Dictionary containing the input arguments.

Returns

Return type

Work in progress.

pyRing.noise.mem_psd(data, srate, optimisation_method='FPE')[source]

Compute the one-sided average PSD with the MESA method. Currently not used.

Parameters
  • data (array) – The data to be analysed.

  • srate (float) – The sampling rate of the data.

  • optimisation_method (string) – The method used to optimise the PSD. Can be “FPE” or “AIC”.

Returns

  • freqs (array) – The frequencies at which the PSD is evaluated.

  • psd (array) – The one-sided average PSD.

pyRing.noise.non_stationarity_check(acfs, dt)[source]

Check if there is any trend in PSD evolution.

Parameters
  • acfs (list of numpy arrays) – List of autocorrelation functions.

  • dt (float) – Time step of the autocorrelation functions.

Returns

Return type

Nothing, but it plots the PSD evolution and prints the number of non-stationary bins.

pyRing.noise.read_data_from_GWOSC_file(fname, ifo, kwargs)[source]

Read data from a GWOSC file.

Parameters
  • fname (str) – Name of the file containing the data. The file name is expected to follow GWOSC conventions ‘DET-FRAMETYPE-STARTTIME–DATALEN.txt’, e.g.: ‘H-H1_GWOSC_4_V1-1126259446-32.txt’. See https://www.gw-openscience.org for more infomation. This requirement can be relaxed by activating the ‘ignore-data-filename’ option.

  • ifo (str) – Name of the interferometer.

  • kwargs (dict) – Dictionary containing the input arguments.

Returns

  • starttime (float) – Start time of the data.

  • dt (float) – Time step of the data.

  • T (float) – Duration of the data.

  • rawstrain (numpy.ndarray) – Array of the data downloaded.

pyRing.noise.read_data_from_custom_file(fname)[source]

Read data from a custom file.

Parameters

fname (str) – Name of the file containing the data.

Returns

  • starttime (float) – Start time of the data.

  • dt (float) – Time step of the data.

  • T (float) – Duration of the data.

  • rawstrain (numpy.ndarray) – Array of the data downloaded.

pyRing.noise.read_data_from_file(fname, ifo, kwargs)[source]

Read data from a file.

Parameters
  • fname (str) – Name of the file containing the data.

  • ifo (str) – Name of the interferometer.

  • kwargs (dict) – Dictionary containing the input arguments.

Returns

  • starttime (float) – Start time of the data.

  • dt (float) – Time step of the data.

  • srate_dt (float) – Sampling rate of the data.

  • T (float) – Duration of the data.

  • rawstrain (numpy.ndarray) – Array of the data.

pyRing.noise.read_data_from_gwf_file(fname, ifo, kwargs)[source]

Read data from a gwf file.

Parameters
  • fname (str) – Name of the file containing the data.

  • ifo (str) – Name of the interferometer.

  • kwargs (dict) – Dictionary containing the input arguments.

Returns

  • starttime (float) – Start time of the data.

  • T (float) – Duration of the data.

  • rawstrain (numpy.ndarray) – Array of the data downloaded.

pyRing.noise.read_data_from_txt_file(fname)[source]

Read data from a txt file.

Parameters

fname (str) – Name of the file containing the data.

Returns

  • starttime (float) – Start time of the data.

  • T (float) – Duration of the data.

  • rawstrain (numpy.ndarray) – Array of the data downloaded.

pyRing.noise.resize_nan_strain(strain, start_time, trig_time, onsource_length, dt)[source]

Resize the strain to the longest segment which contains no nans.

Parameters
  • strain (numpy array) – The strain data (possibly containing nans).

  • start_time (float) – The start time of the data.

  • trig_time (float) – The time of the trigger.

  • onsource_length (float) – The duration of the on-source chunk.

  • dt (float) – The sampling time of the data.

Returns

  • strain (numpy array) – The updated strain data after nans removal.

  • start_time (float) – The updated start time of the data after nans removal.

  • T (float) – The updated duration of the data after nans removal.

pyRing.noise.set_random_seed(user_seed, ifo)[source]

Set the random seed used for generating the noise for injections in different detectors.

Parameters
  • user_seed (int) – The user seed.

  • ifo (str) – The detector.

pyRing.noise.window_onsource_strain(on_source_strain, signal_seglen, noise_seglen, window_onsource_flag, window_flag, alpha_window, truncate)[source]

Apply a window to the on-source strain data.

Parameters
  • on_source_strain (numpy array) – The on-source strain data.

  • signal_seglen (int) – The length of the signal segment.

  • noise_seglen (int) – The length of the noise segment.

  • window_onsource_flag (bool) – Whether to apply a window to the on-source strain data.

  • window_flag (bool) – Whether to apply a window to the data.

  • alpha_window (float) – The alpha parameter of the Tukey window.

  • truncate (bool) – Whether to truncate the data.

Returns

on_source_strain – The on-source strain data.

Return type

numpy array

pyRing.plots module

pyRing.plots.FindHeightForLevel(inArr, adLevels)[source]

Function to find the height of a contour line in a 2D array.

Parameters
  • inArr (array) – 2D array of values.

  • adLevels (array) – Array of levels.

Returns

adHeights – Array of heights.

Return type

array

pyRing.plots.Kerr_Newman_intrinsic_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters of the Kerr-Newman model.

Parameters
  • x (array) – Array containing the samples of the intrinsic parameters of the Kerr-Newman model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.Kerr_intrinsic_alpha_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters of the final Kerr black hole when including the alpha area quantisatio parameter.

Parameters
  • x (dictionary) – Dictionary containing the samples of the intrinsic parameters of the final Kerr black hole.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the corner plot in the output directory.

pyRing.plots.Kerr_intrinsic_braneworld_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters of the final Kerr black hole when including the braneworld parameters.

Parameters
  • x (dictionary) – Dictionary containing the samples of the intrinsic parameters of the final Kerr black hole.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the corner plot in the output directory.

pyRing.plots.Kerr_intrinsic_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters of the final Kerr black hole.

Parameters
  • x (dictionary) – Dictionary containing the samples of the intrinsic parameters of the final Kerr black hole.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the corner plot in the output directory.

pyRing.plots.MMRDNP_amplitude_parameters_corner(x, **input_par)[source]

Create the corner plot of the amplitude parameters for the MMRDNP model.

Parameters
  • x (dictionary) – Dictionary containing the samples of the amplitude parameters for the MMNRDNP model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the corner plot in the output directory.

pyRing.plots.MMRDNP_intrinsic_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters for the MMRDNP model.

Parameters
  • x (dictionary) – Dictionary containing the samples of the amplitude parameters for the MMNRDNS model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the corner plot in the output directory.

pyRing.plots.MMRDNS_intrinsic_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters for the MMRDNS model.

Parameters
  • x (dictionary) – Dictionary containing the samples of the intrinsic parameters of the final Kerr black hole.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the corner plot in the output directory.

pyRing.plots.Mf_af_plot(samples, Mf_LAL_samples, af_LAL_samples, **input_par)[source]

Create the plot of the final mass and spin and compare them to IMR samples.

Parameters
  • samples (array) – Array containing the samples of final mass and spin.

  • Mf_LAL_samples (array) – Array containing the samples of the final mass of the IMR model.

  • af_LAL_samples (array) – Array containing the samples of the final spin of the IMR model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.Mf_af_plot_old(samples, Mf_LAL_samples, af_LAL_samples, **input_par)[source]

Create the plot of the final mass and spin and compare them to IMR samples.

Parameters
  • samples (array) – Array containing the samples of final mass and spin.

  • Mf_LAL_samples (array) – Array containing the samples of the final mass of the IMR model.

  • af_LAL_samples (array) – Array containing the samples of the final spin of the IMR model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.SNR_plots(get_waveform, dets, fixed_params, tgps, params=None, **kwargs)[source]

Plot the SNR of the network and of each detector.

Parameters
  • get_waveform (function) – Function that returns the waveform model.

  • dets (dict) – Dictionary of detectors.

  • fixed_params (dict) – Dictionary of fixed parameters.

  • tgps (float) – GPS time of the event.

  • params (dict) – Dictionary of parameters sampled on.

  • kwargs (dict) – Dictionary of keyword arguments.

Returns

Return type

Nothing, but creates the SNR plots.

pyRing.plots.TEOBPM_intrinsic_corner(x, **input_par)[source]

Create the corner plot of the intrinsic parameters of the TEOBPM model.

Parameters
  • x (array) – Array containing the samples of the intrinsic parameters of the TEOBPM model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.TEOBPM_masses_spins_corner(x, **input_par)[source]

Create the corner plot of the progenitors masses and spins of the TEOBPM model.

Parameters
  • x (array) – Array containing the samples of the intrinsic parameters of the TEOBPM model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.UNUSED_noise_evidence_density(t0_samples, noise_model)[source]

Compute the noise evidence density for a given set of t0 samples.

Parameters
  • t0_samples (array) – Array of t0 samples.

  • noise_model (NoiseModel object) – Noise model object.

Returns

logZnoise – Array of logZnoise values for each t0 sample.

Return type

array

pyRing.plots.amplitudes_corner(x, **input_par)[source]

Create the corner plot of the amplitude parameters.

Parameters
  • x (dictionary) – Dictionary containing the samples of the amplitude parameters.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.compare_damped_sinusoids_with_QNM_predictions(samples_x, Mf_IMR, af_IMR, Num_mode, probs_flag=1, scatter_samples_flag=1, delta_QNM_plots=0, predictions_contour_flag=0, **kwargs)[source]

Plot the posterior distributions of the QNM frequencies and damping times, and compare them to the GR prediction coming from an IMR analysis (if IMR posterior is available).

Parameters
  • samples_x (dictionary) – Dictionary of samples.

  • Mf_IMR (array) – Array of final masses used to compute the GR predicition.

  • af_IMR (array) – Array of final spins used to compute the GR predicition.

  • Num_mode (int) – Number of free damped sinusoids considered.

  • probs_flag (int) – Flag to plot the probabilities of identifying a given damped-sinusoid with GR-predicted QNMs.

  • scatter_samples_flag (int) – Flag to plot the scatter of the samples.

  • delta_QNM_plots (int) – Flag to plot the difference between the QNM parameters and the GR prediction.

  • predictions_contour_flag (int) – Flag to plot the contours of the GR prediction.

  • kwargs (dictionary) – Dictionary of keyword arguments.

Returns

Return type

Nothing, but saves plots to the output directory.

pyRing.plots.f_tau_amp_corner(x, **input_par)[source]

Create the corner plot of the frequency, damping time and amplitude parameters.

Parameters
  • x (dictionary) – Dictionary containing the samples of the frequency, damping time and amplitude parameters.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.get_param_override(fixed_params, x, name)[source]

Returns x[name], unless it is over-ridden by value in the fixed_params dictionary.

Parameters
  • fixed_params (dict) – Dictionary of fixed parameters.

  • x (dict) – Dictionary of samples.

  • name (str) – Name of the parameter.

Returns

Return type

Either x[name] or fixed_params[name]

pyRing.plots.global_corner(x, names, output, truths=None)[source]

Create a corner plot of all parameters.

Parameters
  • x (dictionary) – Dictionary of parameters.

  • names (list) – List of parameter names.

  • output (string) – Output directory.

Returns

Return type

Nothing, but saves a corner plot to the output directory.

pyRing.plots.init_plotting()[source]

Function to set the default plotting parameters.

Parameters

None

Returns

Return type

Nothing, but sets the default plotting parameters.

pyRing.plots.initialise_plot_strain(strain_only, whiten_method, dets, **kwargs)[source]
pyRing.plots.insp_par_Mf_af_plot(x, **input_par)[source]

Create the plot of the final mass and final spin for models that are parameterised using binary parameters.

Parameters
  • x (dictionary) – Dictionary containing the samples of the amplitude parameters for the MMNRDNP model.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.mode_corner(samples, filename=None, **kwargs)[source]

Create a corner plot of the QNM parameters.

Parameters
  • samples (array) – Array of samples.

  • filename (string) – Name of the file to save the plot to.

  • kwargs (dictionary) – Dictionary of keyword arguments.

Returns

fig – Figure object.

Return type

figure

pyRing.plots.omega_tau_eff_plot(x, **kwargs)[source]

Create the plot of the effective frequency and damping time.

Parameters
  • x (array) – Array containing the samples of the intrinsic parameters of the TEOBPM model.

  • kwargs (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.orientation_corner(x, Config, **input_par)[source]

Create the corner plot of the orientation parameters.

Parameters
  • x (dictionary) – Dictionary containing the samples of the orientation parameters.

  • Config (configparser object) – Configparser object containing the configuration of the run.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.plot_ACF(time, acf, label, output_path)[source]

Plot the ACF of the data.

Parameters
  • time (array) – Time array.

  • acf (array) – ACF array.

  • label (str) – Label of the plot.

  • output_path (str) – Path to the output file.

Returns

Return type

Nothing, but it saves the plot in the output_path.

pyRing.plots.plot_ACF_compare(time1, acf1, label1, time2, acf2, label2, output_path)[source]

Plot two different ACF estimates to compare them.

Parameters
  • time1 (array) – Time array of the first ACF.

  • acf1 (array) – ACF array of the first ACF.

  • label1 (str) – Label of the first ACF.

  • time2 (array) – Time array of the second ACF.

  • acf2 (array) – ACF array of the second ACF.

  • label2 (str) – Label of the second ACF.

  • output_path (str) – Path to the output file.

Returns

Return type

Nothing, but it saves the plot in the output_path.

pyRing.plots.plot_NR_single_mode(t_geom, hr_geom, hi_geom, **kwargs)[source]

Plot the NR waveform in the time domain for a single mode.

Parameters
  • t_geom (array) – Time array in geometric units.

  • hr_geom (array) – Real part of the waveform in geometric units.

  • hi_geom (array) – Imaginary part of the waveform in geometric units.

  • kwargs (dict) – Dictionary of keyword arguments.

Returns

Return type

Nothing, but saves the waveform plot to the output directory.

pyRing.plots.plot_PSD(freqs, psd, label, output_path)[source]

Plot the PSD of the data.

Parameters
  • freqs (array) – Frequency array.

  • psd (array) – PSD array.

  • label (str) – Label of the plot.

  • output_path (str) – Path to the output file.

Returns

Return type

Nothing, but it saves the plot in the output_path.

pyRing.plots.plot_PSD_compare(freqs1, psd1, label1, freqs2, psd2, label2, output_path)[source]

Plot two different PSD estimates to compare them.

Parameters
  • freqs1 (array) – Frequency array of the first PSD.

  • psd1 (array) – PSD array of the first PSD.

  • label1 (str) – Label of the first PSD.

  • freqs2 (array) – Frequency array of the second PSD.

  • psd2 (array) – PSD array of the second PSD.

  • label2 (str) – Label of the second PSD.

  • output_path (str) – Path to the output file.

Returns

Return type

Nothing, but it saves the plot in the output_path.

pyRing.plots.plot_contour(samples_stacked, level=[0.9], linest='dotted', label=None, color='k', line_w=1.2, plot_legend=1, zorder=None)[source]

Function to plot a contour line.

Parameters
  • samples_stacked (array) – Array of samples.

  • level (array) – Array of levels.

  • linest (str) – Linestyle.

  • label (str) – Label.

  • color (str) – Color.

  • line_w (float) – Line width.

  • plot_legend (int) – Plot legend.

  • zorder (int) – Zorder.

Returns

Return type

Nothing, but plots a contour line.

pyRing.plots.plot_delta_QNMs(samples, f0, t0, l, m, n, Num_mode, output_dir)[source]
pyRing.plots.plot_strain(get_waveform, dets, fixed_params, tgps, params=None, whiten_flag=False, whiten_method='TD', strain_only=0, spectrum=0, logamp=0, **kwargs)[source]

Function to plot the strain.

Parameters
  • get_waveform (function) – Function to get the waveform.

  • dets (dict) – Dictionary of detectors.

  • fixed_params (dict) – Dictionary of fixed parameters.

  • tgps (float) – GPS time.

  • params (dict) – Dictionary of parameters.

  • whiten_flag (bool) – Whitening flag.

  • whiten_method (str) – Whitening method. Available options: [‘TD’, ‘FD’].

  • strain_only (int) – Strain only.

  • kwargs (dict) – Dictionary of keyword arguments.

Returns

Return type

Nothing, but plots the strain.

pyRing.plots.read_Mf_af_IMR_posterior(Config, **input_par)[source]

Read the IMR posterior samples from the imr-samples entry of the Plot section of the configuration file, and return the median values of the mass and spin parameters.

Parameters
  • Config (configparser.ConfigParser) – Configuration file parser.

  • input_par (dict) – Dictionary containing the input parameters.

Returns

  • Mf_d (float) – Median value of the final mass.

  • af_d (float) – Median value of the final spin.

pyRing.plots.read_QNM(fit_flag, l, m, n)[source]
pyRing.plots.read_dataseries(d, whiten_flag, detector, tevent, dt, whiten_method, mf_time_prior, timeseries_whitened_TD, duration_n, dt_dict, spectrum, **kwargs)[source]
pyRing.plots.read_skypos(fixed_params, p, dets, sky_frame, ref_det, tevent, **kwargs)[source]
pyRing.plots.read_waveforms(params, fixed_params, get_waveform, dets, ref_det, tevent, sky_frame, whiten_method, whiten_flag, mf_time_prior, duration_n, tgps, dt, model_waveforms, dt_dict, timeseries_whitened_TD, spectrum, **kwargs)[source]
pyRing.plots.single_time_delay_plots(dt_vec, **input_par)[source]

Plot the time delay posterior distributions and chains for each detector pair.

Parameters
  • dt_vec (dict) – Dictionary containing the time delay posterior distributions for each detector pair.

  • input_par (dict) – Dictionary containing the input parameters for the run.

Returns

Return type

Nothing. Plots are saved to the output directory.

pyRing.plots.sky_location_plots(x, Config, **input_par)[source]

Plot the sky location posterior distributions and chains for each detector pair.

Parameters
  • x (array) – Array containing the sky location posterior distributions for each detector pair.

  • Config (configparser object) – Configparser object containing the input parameters for the run.

  • input_par (dict) – Dictionary containing the input parameters for the run.

Returns

Return type

Nothing. Plots are saved to the output directory.

pyRing.plots.t_start_plot(t0_ds, Mf, **input_par)[source]

Create the plot of the start time of the template.

Parameters
  • t0_ds (array) – Array containing the samples of the start time of the template.

  • Mf (float) – Final mass of the system.

  • input_par (dictionary) – Dictionary containing the input parameters of the run.

Returns

Return type

Nothing, but saves the plot in the output directory.

pyRing.plots.tick_function(X)[source]

Function to create the ticks for the time plot.

Parameters

X (array) – FIXME: Ignored.

Returns

Return type

Array containing the values of the ticks.

pyRing.pyRing module

class pyRing.pyRing.DampedSinusoids(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing a superposition of damped sinusoids as ringdown model. Frequency, damping time, amplitude and phase are sampled over for each mode.

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

class pyRing.pyRing.IMR_Ringdown_Model(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing a non-precessing ringdown model extracted from LAL IMR waveforms.

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

class pyRing.pyRing.KHS_2012Model(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing the KHS_2012 waveform as ringdown model (valid for spinning, non-precessing progenitors). Frequencies and damping times of the specified (l,m,n) modes are fixed as a function of the mass and spin of the remnant BH. Relative amplitudes and phases are fixed as a function of the symmetric mass ratio and effective spin. References: https://arxiv.org/abs/1207.0399, https://arxiv.org/abs/1406.3201

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

class pyRing.pyRing.KerrModel(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing a Kerr waveform as ringdown model. Frequencies and damping times of the specified (s,l,m,n) modes are fixed as a function of the mass and spin of the remnant BH. Relative amplitudes and phases of the modes are instead free to vary.

amp_phi_names()[source]
get_cplx_amp(x, mode)[source]
get_cplx_amp_quad(x, quad_term, s, l, m, n, s1, l1, m1, n1, s2, l2, m2, n2)[source]
get_tail_parameters(x, tail_string)[source]
get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

static modename(s, l, m, n)[source]

Returns “slmn”

tail_names()[source]
class pyRing.pyRing.LIGOVirgoModel(**kwargs)[source]

Bases: cpnest.model.Model

Parent class for all the models used in the package. Reads the data and sets sky position parameters common to all waveform models.

class pyRing.pyRing.MMRDNPModel(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing the MMRDNP waveform as ringdown model (valid for spinning, non-precessing progenitors). Reference: https://arxiv.org/pdf/1801.08208.pdf Technical notes: https://github.com/llondon6/kerr_public/blob/master/notes/ns/mmrd.pdf

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

class pyRing.pyRing.MMRDNSModel(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing the MMRDNS waveform as ringdown model (valid for non-spinning progenitors). Frequencies and damping times of the specified (l,m,n) modes are fixed as a function of the mass and spin of the remnant BH. Relative amplitudes and phases are fixed as a function of the symmetric mass ratio. Reference: https://arxiv.org/pdf/1404.3197.pdf

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

class pyRing.pyRing.MorletGaborWavelets(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing a superposition of Morlet-Gabor-wavelets as waveform model. Frequency, damping time, amplitude and phase are sampled over for each mode.

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

class pyRing.pyRing.RingDownModel(**kwargs)[source]

Bases: pyRing.pyRing.LIGOVirgoModel

Parent class for all ringdown models. Sets common time prior and likelihood.

log_likelihood(x)[source]

returns log likelihood of given parameter

Parameter:

param: cpnest.parameter.LivePoint

class pyRing.pyRing.TEOBPMModel(**kwargs)[source]

Bases: pyRing.pyRing.RingDownModel

Class implementing the EOBPM waveform as post-merger model (valid for non-precessing progenitors). References: arXiv: 1406.0401, 1606.03952, 2001.09082.

get_waveform(x)[source]
log_prior(x)[source]

Returns log of prior. Default is flat prior within bounds

Parameter:

param: cpnest.parameter.LivePoint

Returns

0 if param is in bounds -np.inf otherwise

pyRing.pyRing.get_param_override(fixed_params, x, name)[source]

Returns x[name], unless it is over-ridden by value in the fixed_params dictionary.

pyRing.pyRing.main()[source]
pyRing.pyRing.read_parameter_bounds(Config, configparser, kwargs, name, default_bounds, approx_name, extra_polarisation=None)[source]

Function reading the prior bounds for a given parameter. Either from the config file or from the default bounds.

Parameters
  • Config (configparser.ConfigParser()) – ConfigParser object containing the config file.

  • configparser (configparser) – ConfigParser object.

  • kwargs (dict) – Dictionary containing the input arguments.

  • name (str) – Name of the parameter.

  • default_bounds (dict) – Dictionary containing the default bounds for the parameter.

  • approx_name (str) – Name of the waveform approximant.

  • extra_polarisation (tuple) – Tuple containing the polarisation and mode indices, if the parameter is a mode-dependent one.

Returns

single_bounds – List containing the prior bounds for the parameter.

Return type

list

pyRing.utils module

pyRing.utils.A_mrg_Bohe(m1, m2, a1, a2)[source]
pyRing.utils.A_mrg_Healy(m1, m2, a1, a2)[source]
pyRing.utils.A_mrg_Nagar(m1, m2, a1, a2)[source]
pyRing.utils.A_omg_mrg_TEOB(m1, m2, a1, a2, version='spins', geom=0)[source]

Amplitude and frequency at the peak of the 22 mode for quasicircular spin-aligned binaries.

Fits version: master/84b8f10 of bitbucket.org/eob_ihes/teobresums/commits/branch/master.

Parameters
  • m1 (float) – Mass of the first black hole

  • m2 (float) – Mass of the second black hole

  • a1 (float) – Dimensionless spin of the first black hole

  • a2 (float) – Dimensionless spin of the second black hole

  • version (string) – Which type of fits to use.

  • geom (int) – Flag to activate geometrical units. Default is 0, SI units.

Returns

res – Merger frequency of the binary black hole system

Return type

float

pyRing.utils.EsGB_corrections(name, dim)[source]

This function returns the coefficients of the Parspec expansion for the gravitational polar-led modes in the EdGB model.

Parameters
  • name (str) – Name of the mode deviation.

  • dim (int) – Number of terms to be used in the Parspec expansion.

Returns

corr – Coefficients of the Parspec expansion for the gravitational polar-led modes in the EdGB model.

Return type

array

pyRing.utils.EsGB_corrections_Carson_Yagi(name)[source]

This function returns the coefficients of the Parspec expansion for the gravitational polar-led modes in the EdGB model according to the Carson-Yagi prescription.

Parameters

name (str) – Name of the mode deviation.

Returns

corr – Coefficients of the Parspec expansion for the gravitational polar-led modes in the EdGB model according to the Carson-Yagi prescription.

Return type

array

pyRing.utils.F_mrg_Bohe(m1, m2, a1, a2)[source]

Computees the merger frequency fit as described in Bohe et al. arXiv:1611.03703

Parameters
  • m1 (float) – Mass of the first black hole

  • m2 (float) – Mass of the second black hole

  • a1 (float) – Dimensionless spin of the first black hole

  • a2 (float) – Dimensionless spin of the second black hole

Returns

res – Merger frequency of the binary black hole system

Return type

float

pyRing.utils.F_mrg_Healy(m1, m2, a1, a2)[source]

Computes the merger frequency fit as described in Healy et al. Phys. Rev. D 97, 084002(2018) This implementation uses the convention m1>m2 and thus has a sign differences in the definitions of dm and Delta comparing to the original paper.

Parameters
  • m1 (float) – Mass of the first black hole

  • m2 (float) – Mass of the second black hole

  • a1 (float) – Dimensionless spin of the first black hole

  • a2 (float) – Dimensionless spin of the second black hole

Returns

res – Merger frequency of the binary black hole system

Return type

float

pyRing.utils.F_mrg_Nagar(m1, m2, a1, a2, geom=0)[source]

This function returns the merger frequency of a binary black hole system, defined with respect to the peak of the 22 mode amplitude. The coefficients contained here are an update of Tab.1 of arxiv:1811.08744, generated by Gunnar Riemenschneider.

Newer versions (if existent) can be found in the TEOBResumS repository (bitbucket.org/eob_ihes/teobresums), e.g. the latest version on 27/11/2023 is here: https://bitbucket.org/eob_ihes/teobresums/src/83f260f43161fe360e08f495c8b540eec41d167b/C/src/TEOBResumSFits.c#lines-177

Parameters
  • m1 (float) – Mass of the first black hole in solar mass units

  • m2 (float) – Mass of the second black hole in solar mass units

  • a1 (float) – Dimensionless spin of the first black hole

  • a2 (float) – Dimensionless spin of the second black hole

  • geom (int) – Flag to activate geometrical units. Default is 0, SI units.

Returns

res – Merger frequency of the binary black hole system

Return type

float

pyRing.utils.F_mrg_Nagar_v0(m1, m2, a1, a2)[source]

This function returns the merger frequency of a binary black hole system. Old version of the merger frequency, defined with respect to the 22 mode of the inspiral.

Parameters
  • m1 (float) – Mass of the first black hole

  • m2 (float) – Mass of the second black hole

  • a1 (float) – Dimensionless spin of the first black hole

  • a2 (float) – Dimensionless spin of the second black hole

Returns

res – Merger frequency of the binary black hole system

Return type

float

class pyRing.utils.UNUSED_NR_waveform(**kwargs)[source]

Bases: object

Class to generate NR waveforms.

Parameters

object (object) – Object to be used.

pyRing.utils.UNUSED_inject_NR_signal(lenstrain, tstart, length, ifo, triggertime, **kwargs)[source]

Inject a NR signal into the data. The NR signal is generated using the FIXME

Parameters
  • lenstrain (int) – Length of the strain data vector

  • tstart (float) – Start time of the data

  • length (float) – Length of the data

  • ifo (str) – Detector name

  • triggertime (float) – GPS time of the trigger

  • **kwargs (dict) – Dictionary of keyword arguments

Returns

  • hplus (numpy.ndarray) – Plus polarization of the NR signal

  • hcross (numpy.ndarray) – Cross polarization of the NR signal

pyRing.utils.bandpass_around_ringdown(strain, dt, f_min, mf, alpha_window=0.1)[source]

This function bandpasses the strain around the ringdown frequency of the BH.

Parameters
  • strain (array) – Strain time series.

  • dt (float) – Time step of the strain time series.

  • f_min (float) – Minimum frequency of the bandpass.

  • mf (float) – Final mass of the BH.

  • alpha_window (float) – Tukey window parameter.

Returns

strain – Bandpassed strain time series.

Return type

array

pyRing.utils.check_NR_dir()[source]

This function checks if the directory LVC-NR waveforms is present.

Parameters

None.

Returns

Return type

Nothing, but raises an exception if the directory is not present.

pyRing.utils.check_modes_naming_scheme(modes, quad_modes)[source]
pyRing.utils.chi_eff(q, a1, a2)[source]

This function returns the effective spin of a binary system as a function of the mass ratio and the spins of the components. Note: in the equal mass case, eta=0.25, implying chi_1=chi_2=0.5. Hence, in this case, chi_eff is the aritmetic mean of (a1,a2).

Parameters
  • q (float) – Mass ratio of the binary system.

  • a1 (float) – Spin of the first component of the binary system.

  • a2 (float) – Spin of the second component of the binary system.

Returns

chi_eff – Effective spin of the binary system.

Return type

float

pyRing.utils.cholesky_logdet_C(covariance)[source]

Compute the log determinant of a covariance matrix using Cholesky decomposition.

Parameters

covariance (array) – Covariance matrix.

Returns

logdet – Log determinant of the covariance matrix.

Return type

float

pyRing.utils.compute_SNR_FD(data, template, psd, df)[source]

This function computes the SNR between a data frequency series and a template frequency series in the frequency domain.

Parameters
  • data (array) – Data frequency series.

  • template (array) – Template frequency series.

  • psd (array) – PSD.

  • df (float) – Frequency step of the frequency series.

Returns

SNR – SNR of the template in the given data.

Return type

float

pyRing.utils.compute_SNR_TD(data, template, weights, method='direct-inversion')[source]

This function computes the SNR between a data time series and a template time series in the time domain, using various methods.

Parameters
  • data (array) – Data time series.

  • template (array) – Template time series.

  • weights (array) – Weights to be used in the inner product. In the case of the time domain, this can be the inverse covariance matrix (for the ‘direct-inversion’ method) or the Cholesky decomposition of the covariance matrix (for the ‘cholesky-solve-triangular’ method) or the ACF (for the ‘toeplitz-inversion’ method).

  • method (str) – Method to be used to compute the inner product. Options are: ‘direct-inversion’, ‘toeplitz-inversion’, ‘cholesky-solve-triangular’.

Returns

SNR – SNR of the template in the given data.

Return type

float

pyRing.utils.compute_remnant_parameters_from_inspiral_aligned_spins_parameters(m1, m2, chi1, chi2)[source]

Compute the remnant parameters from the inspiral aligned spins parameters. For documentation on final state fits, see https://lscsoft.docs.ligo.org/lalsuite/lalinference/namespacelalinference_1_1imrtgr_1_1nrutils.html#a351987f8201d32f50af2fd38a7e4190e

Parameters
  • m1 (float) – Mass of the first BH.

  • m2 (float) – Mass of the second BH.

  • chi1 (float) – Signed aligned spin component (i.e. can be both positive/parallel and negative/antiparallel wrt angular momentum axis) of the first BH.

  • chi2 (float) – Signed aligned spin component (i.e. can be both positive/parallel and negative/antiparallel wrt angular momentum axis) of the second BH.

Returns

  • Mf (float) – Final mass.

  • af (float) – Final spin.

pyRing.utils.construct_full_modes(modes, quad_modes)[source]

This function constructs the full list of modes (combining linear and quadratic modes) to be used in the ringdown fitting procedure.

Parameters
  • modes (list) – List of linear modes to be used in the fitting procedure.

  • quad_modes (dict) – Dictionary of quadratic modes to be used in the fitting procedure.

Returns

modes_full – Combined list of linear and quadratic modes to be used in the fitting procedure.

Return type

list

pyRing.utils.construct_interpolant(param_name, N_bins=32, par_file='ringdown/random_parameters_interpolation.txt')[source]

This function constructs a spline interpolant for the prior of a given parameter.

Parameters
  • param_name (str) – Name of the parameter.

  • N_bins (int) – Number of bins to be used to construct the spline interpolant.

  • par_file (str) – File containing the simulated events.

Returns

spline_interpolant – Spline interpolant for the prior of the given parameter.

Return type

scipy.interpolate.UnivariateSpline

pyRing.utils.eta(m1, m2)[source]

This function returns the symmetric mass ratio of a binary system as a function of the component masses.

Parameters
  • m1 (float) – Mass of the first component.

  • m2 (float) – Mass of the second component.

Returns

eta – Symmetric mass ratio of the binary system.

Return type

float

pyRing.utils.eta_from_q(q)[source]

This function returns the symmetric mass ratio of a binary system as a function of the mass ratio.

Parameters

q (float) – Mass ratio of the binary system.

Returns

eta – Symmetric mass ratio of the binary system.

Return type

float

pyRing.utils.final_state_surfinBH(Mtot, q, chi1, chi2, f_ref)[source]

This function computes the final mass and spin of a binary black hole system using the surfinBH package.

Parameters
  • Mtot (float) – Total mass of the binary system in solar masses.

  • q (float) – Mass ratio of the binary system.

  • chi1 (float) – Dimensionless spin of the more massive black hole. Input should be 3-vector, e.g. chi1 = (spin_1x, spin_1y, spin_1z).

  • chi2 (float) – Dimensionless spin of the less massive black hole. Input should be 3-vector, e.g. chi2 = (spin_2x, spin_2y, spin_2z).

  • f_ref (float) – Reference frequency in Hz.

Returns

  • Mf (float) – Final mass of the binary system in solar masses.

  • af (float) – Final dimensionless spin of the binary system.

pyRing.utils.get_injected_parameters(injection_parameters, names)[source]
pyRing.utils.import_datafile_path(filename)[source]

This function returns the path to a data file, including the pyRing relative path.

Parameters

filename (str) – Name of the data file.

Returns

package_path – Path to the data file.

Return type

str

pyRing.utils.inner_product_FD(h1, h2, psd, df)[source]

This function computes the inner product between two frequency series h1 and h2 using the PSD psd.

Parameters
  • h1 (array) – First frequency series.

  • h2 (array) – Second frequency series.

  • psd (array) – PSD.

  • df (float) – Frequency step of the frequency series.

Returns

inner_product – Inner product between h1 and h2.

Return type

float

pyRing.utils.inner_product_TD(h1, h2, InvCov)[source]

This function computes the inner product between two time series h1 and h2 using the inverse covariance matrix InvCov.

Parameters
  • h1 (array) – First time series.

  • h2 (array) – Second time series.

  • InvCov (array) – Inverse covariance matrix.

Returns

inner_product – Inner product between h1 and h2.

Return type

float

pyRing.utils.m1_from_m_q(m, q)[source]

This function returns the mass of the first component of a binary system as a function of the total mass and the mass ratio.

Parameters
  • m (float) – Total mass of the binary system.

  • q (float) – Mass ratio of the binary system.

Returns

m1 – Mass of the first component of the binary system.

Return type

float

pyRing.utils.m1_from_mc_q(mc, q)[source]

This function returns the mass of the first component of a binary system as a function of the chirp mass and the mass ratio.

Parameters
  • mc (float) – Chirp mass of the binary system.

  • q (float) – Mass ratio of the binary system.

Returns

m1 – Mass of the first component of the binary system.

Return type

float

pyRing.utils.m2_from_m_q(m, q)[source]

This function returns the mass of the second component of a binary system as a function of the total mass and the mass ratio.

Parameters
  • m (float) – Total mass of the binary system.

  • q (float) – Mass ratio of the binary system.

Returns

m2 – Mass of the second component of the binary system.

Return type

float

pyRing.utils.m2_from_mc_q(mc, q)[source]

This function returns the mass of the second component of a binary system as a function of the chirp mass and the mass ratio.

Parameters
  • mc (float) – Chirp mass of the binary system.

  • q (float) – Mass ratio of the binary system.

Returns

m2 – Mass of the second component of the binary system.

Return type

float

pyRing.utils.mc(m1, m2)[source]

This function returns the chirp mass of a binary system as a function of the component masses.

Parameters
  • m1 (float) – Mass of the first component.

  • m2 (float) – Mass of the second component.

Returns

mc – Chirp mass of the binary system.

Return type

float

pyRing.utils.mchirp_from_mtot_eta(mtot, eta)[source]

This function returns the chirp mass of a binary system as a function of the total mass and the symmetric mass ratio.

Parameters
  • mtot (float) – Total mass of the binary system.

  • eta (float) – Symmetric mass ratio of the binary system.

Returns

mc – Chirp mass of the binary system.

Return type

float

pyRing.utils.mchirp_from_mtot_q(mtot, q)[source]

This function returns the chirp mass of a binary system as a function of the total mass and the mass ratio.

Parameters
  • mtot (float) – Total mass of the binary system.

  • q (float) – Mass ratio of the binary system.

Returns

mc – Chirp mass of the binary system.

Return type

float

pyRing.utils.mtot(m1, m2)[source]

This function returns the total mass of a binary system as a function of the component masses.

Parameters
  • m1 (float) – Mass of the first component.

  • m2 (float) – Mass of the second component.

Returns

mtot – Total mass of the binary system.

Return type

float

pyRing.utils.print_fixed_parameters(fixed_params)[source]

This function prints the fixed parameters.

Parameters

fixed_params (dict) – Dictionary containing the fixed parameters.

Returns

Return type

Nothing, but prints the fixed parameters.

pyRing.utils.print_out_of_bounds_warning(name)[source]

This function prints a warning message when the injected values are outside the prior bounds.

Parameters

name (str) – Name of the parameter.

Returns

Return type

Nothing, but prints a warning message.

pyRing.utils.print_section(name)[source]

This function prints a section header.

Parameters

name (str) – Name of the section.

Returns

Return type

Nothing, but prints a section header.

pyRing.utils.print_subsection(name)[source]

This function prints a subsection header.

Parameters

name (str) – Name of the subsection.

Returns

Return type

Nothing, but prints a subsection header.

pyRing.utils.project_python_wrapper(hs, hvx, hvy, hp, hc, detector, ra, dec, psi, tgps)[source]

Compute the complex time series projected onto the given detector.

Parameters
  • hs (array of shape (n,)) – The complex time series of the breathing mode.

  • hvx (array of shape (n,)) – The complex time series of the longitudinal mode in the x direction.

  • hvy (array of shape (n,)) – The complex time series of the longitudinal mode in the y direction.

  • hp (array of shape (n,)) – The complex time series of the plus polarization.

  • hc (array of shape (n,)) – The complex time series of the cross polarization.

  • detector (laldetector structure) – The detector.

  • ra (double) – The right ascension.

  • dec (double) – The declination.

  • psi (double) – The polarisation angle.

  • tgps (double) – The time (GPS seconds).

pyRing.utils.q(m1, m2)[source]

This function returns the mass ratio of a binary system as a function of the component masses.

Parameters
  • m1 (float) – Mass of the first component.

  • m2 (float) – Mass of the second component.

Returns

q – Mass ratio of the binary system.

Return type

float

pyRing.utils.qnm_interpolate(s, l, m, n)[source]

This function interpolates the complex frequencies of the QNM modes.

Parameters
  • s (int) – Spin-weight of the mode.

  • l (int) – Orbital angular momentum of the mode.

  • m (int) – Azimuthal angular momentum of the mode.

  • n (int) – Radial quantum number of the mode.

Returns

  • w_r (interp1d object) – Interpolant function of the real part of the complex frequency.

  • w_i (interp1d object) – Interpolant function of the imaginary part of the complex frequency.

pyRing.utils.qnm_interpolate_KN(s, l, m, n)[source]

This function interpolates the complex frequencies of the QNM modes for the Kerr-Newman spacetime.

Parameters
  • s (int) – Spin-weight of the mode.

  • l (int) – Orbital angular momentum of the mode.

  • m (int) – Azimuthal angular momentum of the mode.

  • n (int) – Radial quantum number of the mode.

Returns

  • w_r (interp1d object) – Interpolant function of the real part of the complex frequency.

  • w_i (interp1d object) – Interpolant function of the imaginary part of the complex frequency.

pyRing.utils.qnm_interpolate_braneworld(s, l, m, n)[source]

This function interpolates the complex frequencies of the QNM modes for the Braneworld spacetime.

Parameters
  • s (int) – Spin-weight of the mode.

  • l (int) – Orbital angular momentum of the mode.

  • m (int) – Azimuthal angular momentum of the mode.

  • n (int) – Radial quantum number of the mode.

Returns

  • w_r (interp1d object) – Interpolant function of the real part of the complex frequency.

  • w_i (interp1d object) – Interpolant function of the imaginary part of the complex frequency.

pyRing.utils.railing_check(samples, prior_bins, tolerance)[source]

This function checks whether the density of samples is within the tolerance percentage for the bins at the lower and higher boundaries of the prior, i.e. if there is railing of the posterior against the prior.

Parameters
  • samples (array) – Samples from the posterior.

  • prior_bins (array) – Bins of the prior.

  • tolerance (float) – Tolerance percentage.

Returns

  • low_end_railing (bool) – True if the density of samples is within the tolerance percentage for the bin at the lower boundary of the prior.

  • high_end_railing (bool) – True if the density of samples is within the tolerance percentage for the bin at the higher boundary of the prior.

pyRing.utils.resize_time_series(inarr, N, dt, starttime, desiredtc)[source]

Zero pad inarr and align its peak to the desired tc in the segment.

Parameters
  • inarr (array) – Input time series.

  • N (int) – Length of the output time series.

  • dt (float) – Sampling time of the output time series.

  • starttime (float) – Start time of the output time series.

  • desiredtc (float) – Desired time of coalescence of the output time series.

Returns

outarr – Output time series.

Return type

array

pyRing.utils.review_warning()[source]

This function prints a warning message if the code block is not reviewed.

Parameters

None.

Returns

Return type

Nothing, but prints a warning message.

pyRing.utils.set_prefix(warning_message=True)[source]

Set the prefix path for the data files.

Parameters

warning_message (bool) – If True, a warning message is printed if the environment variable is not set.

Returns

prefix – Path to the data files.

Return type

str

pyRing.utils.whiten_FD(strain, interp_psd, dt, f_min, f_max)[source]

This function whitens the strain time series in the frequency domain.

Parameters
  • strain (array) – Strain time series.

  • interp_psd (array) – Interpolated PSD.

  • dt (float) – Time step of the strain time series.

  • f_min (float) – Minimum frequency of the bandpass.

  • f_max (float) – Maximum frequency of the bandpass.

Returns

white_ht – Whitened strain time series.

Return type

array

pyRing.utils.whiten_TD(x, cholesky_L, method='solve-triangular')[source]

Whiten in the time domain the time series x using the Cholesky decomposition of the covariance matrix.

Parameters
  • x (array) – Time series to be whitened.

  • cholesky_L (array) – Cholesky decomposition of the covariance matrix.

  • method (str) – Method to be used to solve the linear system.

Returns

x_whitened – Whitened time series.

Return type

array

pyRing.waveform module

class pyRing.waveform.Damped_sinusoids

Bases: object

Class implementing a superposition of Damped Sinusoids of arbitrary polarisation.

Parameters
  • A (dict) – Dictionary of amplitudes of the damped sinusoids.

  • f (dict) – Dictionary of frequencies of the damped sinusoids.

  • tau (dict) – Dictionary of damping times of the damped sinusoids.

  • phi (dict) – Dictionary of phases of the damped sinusoids.

  • t0 (dict) – Dictionary of start times of the damped sinusoids.

A

Dictionary of amplitudes of the damped sinusoids.

Type

dict

f

Dictionary of frequencies of the damped sinusoids.

Type

dict

tau

Dictionary of damping times of the damped sinusoids.

Type

dict

phi

Dictionary of phases of the damped sinusoids.

Type

dict

t0

Dictionary of start times of the damped sinusoids.

Type

dict

N

Dictionary of number of damped sinusoids for each polarisation.

Type

dict

Functions
---------
waveform(t)

Returns the waveform model.

A

dict

Type

A

N

dict

Type

N

f

dict

Type

f

phi

dict

Type

phi

t0

dict

Type

t0

tau

dict

Type

tau

waveform(self, ndarray t) → ndarray
Returns five polarisations (the ones independent in a L-shaped GW detector, see https://arxiv.org/abs/1710.03794) allowed for a metric theory of gravity: hs (scalar mode), {hvx, hvy} (vector modes), {hp, hc} (tensor modes).
We employ the conventions:
h_s = sum_{i} A_i * cos(omega*t+phi) * e^(-(t-t^{start}_i/tau)
h_vx - i h_vy = sum_{i} A_i * e^(i*omega*t+phi) * e^(-(t-t^{start}_i/tau)
h_+ - i h_x = sum_{i} A_i * e^(i*omega*t+phi) * e^(-(t-t^{start}_i/tau)
Parameters

t (np.ndarray) – Time array.

Returns

h – Waveform model.

Return type

np.ndarray

class pyRing.waveform.IMR_WF

Bases: object

Call an IMR waveform from LAL

cosiota

‘double’

Type

cosiota

dist

‘double’

Type

dist

dt

‘double’

Type

dt

m1

‘double’

Type

m1

m2

‘double’

Type

m2

phi

‘double’

Type

phi

s1z

‘double’

Type

s1z

s2z

‘double’

Type

s2z

signal_seglen

‘double’

Type

signal_seglen

starttime

‘double’

Type

starttime

t0

‘double’

Type

t0

waveform(self, ndarray times) → ndarray
class pyRing.waveform.KHS_2012

Bases: object

Multi mode ringdown non-precessing model.
M_tot is the initial total mass of the binary, m_i the single mass, chi_i the single spin.
In this model t=0 corresponds to 20M after the merger.

Input parameters:
t0 : start time of the ringdown
Mf : final mass in solar masses
af : dimensionless final spin
eta : symmetric mass ratio of the progenitors
chi_eff : symmetric spin of the progenitors (defined as: 1/2*(sqrt(1-4*nu) chi1 + (m1*chi1 - m2*chi2)/(m1+m2)))
r : distance in Mpc
iota : inclination in radians
phi : azimuthal angle in radians

Optional parameters:
single_l, single_n : select a specific mode
single_mode : flag to request only a specific mode
Mf

‘double’

Type

Mf

TGR_params

dict

Type

TGR_params

af

‘double’

Type

af

chi_eff

‘double’

Type

chi_eff

eta

‘double’

Type

eta

iota

‘double’

Type

iota

multipoles

list

Type

multipoles

phi

‘double’

Type

phi

r

‘double’

Type

r

single_l

‘int’

Type

single_l

single_m

‘int’

Type

single_m

single_mode

‘unsigned int’

Type

single_mode

t0

‘double’

Type

t0

waveform(self, ndarray times) → ndarray

Returns h_+ - i* h_x

class pyRing.waveform.KerrBH

Bases: object

Multi mode ringdown model for a Kerr black hole using predictions of the frequencies and damping times as function of mass and spin, as predicted by perturbation theory.

[Input parameters]

t0 : Start time of the ringdown, currently common for all modes. #IMPROVEME: allow for a different start time for each mode.
Mf : Final mass in solar masses.
af : Dimensionless final spin.
amps : Amplitudes of the (s,l,m,n) modes. Expected syntax: amps[(s,l,m,n)] = value. The keys of this dictionary set the modes used in the waveform.
r : Distance in Mpc.
iota : Inclination in radians.
phi : Azimuthal angle in radians.

[Optional parameters]

[[Units and spectrum]]

reference_amplitude : If non-zero, value with which to replace the Mf/r prefactor. Default: 0.0.
geom : Flag to compute only the h_{l,m} modes, without spherical harmonics. Default: 0.
qnm_fit : Flag to request the use of an interpolation for QNM complex frequency, instead of analytical fits (not available for s!=2 or n>2). Default: 1.
interpolants : QNM complex frequencies interpolants, only used if qnm_fit=0. Default: None.

[[Additional Kerr]]

Spheroidal : Flag to activate the use of spheroidal harmonics instead of spherical. Relies on the pykerr package. Default: 0.
amp_non_prec_sym : Flag to enforce non-precessing symmetry on the amplitudes. Default: 0.
tail_parameters : Dictionary of tail modes. Default: None.
quadratic_modes : Amplitudes of the quadratic contributions (both sum and difference of parent frequencies) to the (s,l,m,n) mode generated by (s1,l1,m1,n1)x(s2,l2,m2,n2). If quad_lin_prop=1, instead of the amplitude values, contains the proportionality constant (lpha) wrt the product of linear terms. Expected syntax: quad_amps[term][((s,l,m,n), (s1,l1,m1,n1), (s2,l2,m2,n2))] = value, with term=[‘sum’,’diff’]. Default: None.
quad_lin_prop : Flag to fix the quadratic amplitudes as lpha A_1 * A_2, with (A_1, A_2) the corresponding linear amplitudes. Default: 0.
qnm_cached : Dictionary containing cached values of the QNM frequencies for specific values of Mf,af. Expected syntax: qnm_cached[(2, l, m, n)] = {‘f’: freq, ‘tau’: tau}. Default: None.

[[Beyond Kerr]]

TGR_params : Additional non-GR parameters to be sampled. Default: None.
AreaQuantization : Flag to use a prescription to impose QNM frequencies derived from the area quantisation proposal. Default: 0.
ParSpec : Flag to use the ParSpec parametrisation of beyond-GR modifications to QNMs. Default: 0.
charge : Flag to include the effect of charge. Default: 0.
braneworld : Flag to include the effect of charge in the braneworld scenario. Default: 0.
AreaQuantization

‘unsigned int’

Type

AreaQuantization

Mf

‘double’

Type

Mf

ParSpec

‘unsigned int’

Type

ParSpec

Spheroidal

‘unsigned int’

Type

Spheroidal

TGR_params

dict

Type

TGR_params

af

‘double’

Type

af

amp_non_prec_sym

‘unsigned int’

Type

amp_non_prec_sym

amps

dict

Type

amps

braneworld

‘unsigned int’

Type

braneworld

charge

‘unsigned int’

Type

charge

geom

‘unsigned int’

Type

geom

interpolants

dict

Type

interpolants

iota

‘double’

Type

iota

neg_quad_freq

‘unsigned int’

Type

neg_quad_freq

phi

‘double’

Type

phi

qnm_cached

dict

Type

qnm_cached

qnm_fit

‘unsigned int’

Type

qnm_fit

qnms

dict

Type

qnms

qnms_ParSpec

dict

Type

qnms_ParSpec

quad_lin_prop

‘unsigned int’

Type

quad_lin_prop

quadratic_modes

dict

Type

quadratic_modes

r

‘double’

Type

r

reference_amplitude

‘double’

Type

reference_amplitude

swshs

dict

Type

swshs

t0

‘double’

Type

t0

tail_parameters

dict

Type

tail_parameters

waveform(self, ndarray times) → ndarray
We employ the conventions of arXiv:gr-qc/0512160 (Eq. 2.9):
h_s = Re(sum_{lmn} S_{lmn} h_{lmn})
h_vx + i h_vy = sum_{lmn} S_{lmn} h_{lmn}
h_+ + i h_x = sum_{lmn} S_{lmn} h_{lmn}
Non-precessing symmetry implies the property: h_{l,-m} = (-1)**l h^*_{l,m}
(see: Blanchet, “Gravitational Radiation from Post-Newtonian Sources and Inspiralling Compact Binaries”).
class pyRing.waveform.MMRDNP

Bases: object

Multi mode ringdown non-precessing model.
Mi is the initial total mass of the binary, m_i the single masses, chi_i the single spins.
The model was calibrated such that t=0 corresponds to 20M after |\dot{h}_22| peak.

Input parameters:
t0 : Start time of the ringdown.

Mf : Final mass in solar masses.
af : Dimensionless final spin.

Mi : Initial mass in solar masses.
eta : Symmetric mass ratio of the progenitors.
chi_s : (m_1*chi_1 + m_2*chi_2)/M_tot
chi_a : (m_1*chi_1 - m_2*chi_2)/M_tot

r : Distance in Mpc.
iota : Inclination in radians.
phi : Azimuthal angle in radians.

TGR_params : Additional non-GR parameters to be sampled.

Optional parameters:
single_mode : Flag requesting a single specific mode.
single_l : Indices of the specific polar mode to be used. Requires single_mode=True in order to be used.
single_m : Indices of the specific azimuthal mode to be used. Requires single_mode=True in order to be used.
geom : Flag to compute only the h_{l,m} modes, without spherical harmonics.
qnm_fit : Flag to switch between analytical fits (qnm_fit=1), not available for s!=2 or n>2) and interpolants for QNM complex frequencies (qnm_fit=0). Default: 1.
interpolants : QNM complex frequencies interpolants, only used if qnm_fit=0. Default: None.
qnm_cached : Dictionary containing cached values of the QNM frequencies for specific values of Mf,af. Expected syntax: qnm_cached[(2, l, m, n)] = {‘f’: freq, ‘tau’: tau}. Default: None.
Returns

h_s, h_vx, h_vy, h_p, h_c

Return type

np.array

Mf

‘double’

Type

Mf

Mi

‘double’

Type

Mi

TGR_params

dict

Type

TGR_params

af

‘double’

Type

af

chi_a

‘double’

Type

chi_a

chi_s

‘double’

Type

chi_s

delta

‘double’

Type

delta

eta

‘double’

Type

eta

geom

‘unsigned int’

Type

geom

interpolants

dict

Type

interpolants

iota

‘double’

Type

iota

multipoles

dict

Type

multipoles

phi

‘double’

Type

phi

qnm_cached

dict

Type

qnm_cached

qnm_fit

‘unsigned int’

Type

qnm_fit

r

‘double’

Type

r

single_l

‘int’

Type

single_l

single_m

‘int’

Type

single_m

single_mode

‘unsigned int’

Type

single_mode

t0

‘double’

Type

t0

waveform(self, ndarray times) → ndarray

We employ the convention: h_+ - i h_x = sum_{lm} Y_{lm} h_{lm} Non-precessing symmetry implies the property: h_{l,-m} = (-1)**l h^*_{l,m} (see: Blanchet, “Gravitational Radiation from Post-Newtonian Sources and Inspiralling Compact Binaries”). This model does not support extra scalar/vector polarisations, which are set to zero.

class pyRing.waveform.MMRDNS

Bases: object

Multi mode ringdown model from non-spinning progenitors.

Input parameters:
t0 : Start time of the ringdown.
Mf : Final mass in solar masses.
af : Dimensionless final spin.
eta : Symmetric mass ratio of the progenitors.
r : Distance in Mpc.
iota : Inclination in radians.
phi : Azimuthal angle in radians.

Optional parameters:
TGR_params : Additional non-GR parameters to be sampled.
single_mode : Flag to request a single specific mode.
single_l, single_m, single_n : Indices of the specific mode to be selected. Requires single_mode = True in order to be read.
Spheroidal : Flag to activate the use of spheroidal harmonics instead of spherical. Relies on the pykerr package.
qnm_fit : Flag to request the use of an interpolation for QNM complex frequency, instead of analytical fits (not available for n>2)
interpolants : QNM complex frequencies interpolants.
Returns

h_s, h_vx, h_vy, h_p, h_c

Return type

5 numpy arrays containing the waveform.

Mf

‘double’

Type

Mf

Spheroidal

‘unsigned int’

Type

Spheroidal

TGR_params

dict

Type

TGR_params

af

‘double’

Type

af

eta

‘double’

Type

eta

interpolants

dict

Type

interpolants

iota

‘double’

Type

iota

multipoles

list

Type

multipoles

phi

‘double’

Type

phi

qnm_fit

‘unsigned int’

Type

qnm_fit

r

‘double’

Type

r

single_l

‘int’

Type

single_l

single_m

‘int’

Type

single_m

single_mode

‘unsigned int’

Type

single_mode

single_n

‘int’

Type

single_n

t0

‘double’

Type

t0

waveform(self, ndarray times) → ndarray
We employ the convention h_+ - i h_x = sum_{lmn} S_{lmn} h_{lmn}
Non-precessing symmetry implies the property: h_{l,-m} = (-1)**l h^*_{l,m}
(see: Blanchet, “Gravitational Radiation from Post-Newtonian Sources and Inspiralling Compact Binaries”).
This model does not support extra scalar/vector polarisations, which are set to zero.
class pyRing.waveform.Morlet_Gabor_wavelets

Bases: object

Class implementing a superposition of Morlet-Gabor wavelets of arbitrary polarisation.

Parameters
  • A (dict) – Dictionary of amplitudes of the Morlet-Gabor wavelets.

  • f (dict) – Dictionary of frequencies of the Morlet-Gabor wavelets.

  • tau (dict) – Dictionary of damping times of the Morlet-Gabor wavelets.

  • phi (dict) – Dictionary of phases of the Morlet-Gabor wavelets.

  • t0 (dict) – Dictionary of start times of the Morlet-Gabor wavelets.

A

Dictionary of amplitudes of the Morlet-Gabor wavelets.

Type

dict

f

Dictionary of frequencies of the Morlet-Gabor wavelets.

Type

dict

tau

Dictionary of damping times of the Morlet-Gabor wavelets.

Type

dict

phi

Dictionary of phases of the Morlet-Gabor wavelets.

Type

dict

t0

Dictionary of start times of the Morlet-Gabor wavelets.

Type

dict

N

Dictionary of number of Morlet-Gabor wavelets for each polarisation.

Type

dict

Functions
---------
waveform(t)

Returns the waveform model.

A

dict

Type

A

N

dict

Type

N

f

dict

Type

f

phi

dict

Type

phi

t0

dict

Type

t0

tau

dict

Type

tau

waveform(self, ndarray t) → ndarray

Returns five polarisations (the ones independent in a L-shaped GW detector) allowed for a metric theory of gravity: hs (scalar mode), {hvx, hvy} (vector modes), {hp, hc} (tensor modes). We employ the conventions: h_s = sum_{i} A_i * cos(omega*t+phi) * e^(-(t-t^{start}_i/tau)

h_vx - i h_vy = sum_{i} A_i * e^(i*omega*t+phi) * e^(-(t-t^{start}_i/tau) h_+ - i h_x = sum_{i} A_i * e^(i*omega*t+phi) * e^(-(t-t^{start}_i/tau)

Parameters

t (np.ndarray) – Time array.

Returns

h – Waveform model.

Return type

np.ndarray

class pyRing.waveform.QNM

Bases: object

Class to compute the complex frequency and damping time of a QNM.

Parameters
  • s (int) – Spin-weight of the QNM.

  • l (int) – Orbital angular number of the QNM.

  • m (int) – Azimuthal number of the QNM.

  • n (int) – Radial (overtone) number of the QNM.

  • interpolants (dict) – Dictionary of interpolants for the QNM frequencies and damping times.

  • geom (int, optional) – Geometric units flag. If 1, the QNM frequencies are returned in geometric units, otherwise they are returned in standard units.

s

Spin-weight of the QNM.

Type

int

l

Orbital angular number of the QNM.

Type

int

m

Azimuthal number of the QNM.

Type

int

n

Radial (overtone) number of the QNM.

Type

int

geom

Geometric units flag. If 1, the QNM frequencies are returned in geometric units, otherwise they are returned in standard units.

Type

int

omegar_interp

Interpolant for the real part of the QNM frequency.

Type

scipy.interpolate.interp1d

omegai_interp

Interpolant for the imaginary part of the QNM frequency.

Type

scipy.interpolate.interp1d

prefactor_freq

Prefactor for the QNM frequency.

Type

float

prefactor_tau

Prefactor for the QNM damping time.

Type

float

Functions
---------
f

Returns the real part of the QNM frequency.

Type

float

tau

Returns the imaginary part of the QNM frequency.

Type

float

f_KN

Returns the real part of the QNM frequency for the Kerr-Newman metric.

Type

float

tau_KN

Returns the imaginary part of the QNM frequency for the Kerr-Newman metric.

Type

float

f_BW

Returns the real part of the QNM frequency for the braneworld model.

Type

float

tau_BW

Returns the imaginary part of the QNM frequency for the braneworld model.

Type

float

f(self, double M, double a) → double
f_BW(self, double M, double a, double beta) → double
f_KN(self, double M, double a, double Q) → double
geom

‘unsigned int’

Type

geom

l

‘unsigned int’

Type

l

m

‘int’

Type

m

n

‘unsigned int’

Type

n

omegai_interp

object

Type

omegai_interp

omegar_interp

object

Type

omegar_interp

prefactor_freq

‘double’

Type

prefactor_freq

prefactor_tau

‘double’

Type

prefactor_tau

s

‘unsigned int’

Type

s

tau(self, double M, double a) → double
tau_BW(self, double M, double a, double beta) → double
tau_KN(self, double M, double a, double Q) → double
class pyRing.waveform.QNM_220_area_quantized

Bases: object

Class to compute the complex frequency and damping time of the 220 QNM coming from quantized area presciption.

Parameters
  • l_QA (int) – Orbital angular number of the QNM.

  • m_QA (int) – Azimuthal number of the QNM.

  • n_QA (int) – Radial (overtone) number of the QNM.

l_QA

Orbital angular number of the QNM.

Type

int

m_QA

Azimuthal number of the QNM.

Type

int

n_QA

Radial (overtone) number of the QNM.

Type

int

q_coeff_GR

List of coefficients for the quality factor QNM frequency.

Type

list

Functions
---------
f_QA

Returns the real part of the QNM frequency.

Type

float

q_QA

Returns the quality factor of the QNM frequency.

Type

float

tau_QA

Returns the imaginary part of the QNM frequency.

Type

float

f_QA(self, double M, double a, double alpha) → double
l_QA

‘unsigned int’

Type

l_QA

m_QA

‘int’

Type

m_QA

n_QA

‘unsigned int’

Type

n_QA

q_GR(self, double a) → double
q_coeff_GR

object

Type

q_coeff_GR

tau_QA(self, double M, double a, double alpha) → double
class pyRing.waveform.QNM_ParSpec

Bases: object

Class to compute the complex frequency and damping time of a QNM using the ParSpec fits.

Parameters
  • l (int) – Orbital angular number of the QNM.

  • m (int) – Azimuthal number of the QNM.

  • n (int) – Radial (overtone) number of the QNM.

  • fit (str, optional) – Fit to use. Either ‘high_spin’ or ‘low_spin’. Default is ‘high_spin’.

  • geom (int, optional) – Geometric units flag. If 1, the QNM frequencies are returned in geometric units, otherwise they are returned in the International System of Units. Default is 0.

l

Orbital angular number of the QNM.

Type

int

m

Azimuthal number of the QNM.

Type

int

n

Radial (overtone) number of the QNM.

Type

int

f_coeff

List of coefficients for the real part of the complex QNM frequency.

Type

list

tau_coeff

List of coefficients for the imaginary part of the complex QNM frequency.

Type

list

Functions
---------
f

Returns the real part of the QNM frequency.

Type

float

tau

Returns the imaginary part of the QNM frequency.

Type

float

f(self, double M, double a, double gamma, ndarray dw_vec) → double
f_coeff

object

Type

f_coeff

l

‘unsigned int’

Type

l

m

‘int’

Type

m

n

‘unsigned int’

Type

n

prefactor_freq

‘double’

Type

prefactor_freq

prefactor_tau

‘double’

Type

prefactor_tau

tau(self, double M, double a, double gamma, ndarray dt_vec) → double
tau_coeff

object

Type

tau_coeff

class pyRing.waveform.QNM_braneworld_fit

Bases: object

Class to compute the complex frequency and damping time of the QNM coming from braneworld fit.

Parameters
  • l_BW (int) – Orbital angular number of the QNM.

  • m_BW (int) – Azimuthal number of the QNM.

  • n_BW (int) – Radial (overtone) number of the QNM.

l_BW

Orbital angular number of the QNM.

Type

int

m_BW

Azimuthal number of the QNM.

Type

int

n_BW

Radial (overtone) number of the QNM.

Type

int

Functions
---------
f_BW

Returns the real part of the QNM frequency.

Type

float

q_BW

Returns the quality factor of the QNM frequency.

Type

float

tau_BW

Returns the imaginary part of the QNM frequency.

Type

float

f_BW(self, double M, double a, double beta) → double
l_BW

‘unsigned int’

Type

l_BW

m_BW

‘int’

Type

m_BW

n_BW

‘unsigned int’

Type

n_BW

q_BW(self, double a, double beta) → double
tau_BW(self, double M, double a, double beta) → double
class pyRing.waveform.QNM_fit

Bases: object

Class to compute the complex frequency and damping time of a QNM using fits to the Berti et al. (2015) fits.

Parameters
  • l (int) – Orbital angular number of the QNM.

  • m (int) – Azimuthal number of the QNM.

  • n (int) – Radial (overtone) number of the QNM.

  • charge (int, optional) – Charge flag. If not 0, compute the QNM for a charged BH.

  • geom (int, optional) – Geometric units flag. If 1, the QNM frequencies are returned in geometric units, otherwise they are returned in the International System of Units. Default is 0.

l

Orbital angular number of the QNM.

Type

int

m

Azimuthal number of the QNM.

Type

int

n

Radial (overtone) number of the QNM.

Type

int

charge

Charge flag. If not 0, compute the QNM for a charged BH.

Type

int

f_coeff

List of coefficients for the real part of the complex QNM frequency.

Type

list

q_coeff

List of coefficients for the quality factor of the complex QNM frequency.

Type

list

Functions
---------
f

Returns the real part of the QNM frequency.

Type

float

q

Returns the quality factor of the QNM frequency.

Type

float

tau

Returns the imaginary part of the QNM frequency.

Type

float

f_KN

Returns the real part of the QNM frequency for the Kerr-Newman metric.

Type

float

tau_KN

Returns the imaginary part of the QNM frequency for the Kerr-Newman metric.

Type

float

q_KN

Returns the quality factor of the QNM frequency for the Kerr-Newman metric.

Type

float

charge

‘unsigned int’

Type

charge

f(self, double M, double a) → double
f_KN(self, double M, double a, double Q) → double
f_coeff

object

Type

f_coeff

l

‘unsigned int’

Type

l

m

‘int’

Type

m

n

‘unsigned int’

Type

n

prefactor_freq

‘double’

Type

prefactor_freq

q(self, double a) → double
q_KN(self, double a, double Q) → double
q_coeff

object

Type

q_coeff

tau(self, double M, double a) → double
tau_KN(self, double M, double a, double Q) → double
class pyRing.waveform.SWSH(int s, int l, int m)

Bases: object

Spin weighted spherical harmonics -s_Y_{lm} Defined in Kidder (https://arxiv.org/pdf/0710.0614.pdf) Eq.s (4, 5). Note that this function returns -s_Y_{l,m} as defined by Kidder. Thus, for gravitational perturbation s=2 must be passed.

Parameters
  • s (int) – Spin of the spherical harmonic.

  • l (int) – Orbital angular number of the spherical harmonic.

  • m (int) – Azimuthal angular number of the spherical harmonic.

s

Spin of the spherical harmonic.

Type

int

l

Orbital angular number of the spherical harmonic.

Type

int

m

Azimuthal angular number of the spherical harmonic.

Type

int

swsh_prefactor

Prefactor of the spherical harmonic.

Type

double

Functions
---------
evaluate(theta, phi)

Returns the value of the spherical harmonic for the given angles.

evaluate(self, double theta, double phi) → double complex

SWSH for angles theta [0,pi] and phi [0,2pi].

Parameters
  • theta (double) – Polar angle.

  • phi (double) – Azimuthal angle.

Returns

result – Value of the SWSH for the given angles.

Return type

complex

l

‘int’

Type

l

m

‘int’

Type

m

s

‘int’

Type

s

swsh_prefactor

‘double’

Type

swsh_prefactor

class pyRing.waveform.TEOBPM

Bases: object

Post-merger EOB model
References: arxiv.1406.0401, arXiv:1606.03952, arXiv:2001.09082.

Input parameters:
t0 : start time of the waveform (s)
m1 : heavier BH mass (solar masses)
m2 : lighter BH mass (solar masses)
chi1 : heavier BH spin (adimensional)
chi2 : lighter BH spin (adimensional)
phases : phases of modes at peak (rad)
r : distance (Mpc)
iota : inclination (rad)
phi : azimuthal angle (rad)
modes : list of modes to be used [(l,m)]
TGR_params : Additional non-GR parameters to be sampled.

Optional parameters:
geom : Flag to compute only the h_{l,m} modes, without spherical harmonics.
NR_fit_coeffs : Dictionary containing NR-calibrated quantities and fit coefficients for the model. If not None, overwrites the default values. Structure: dict{‘Mf’:, ‘af’:, (l,m): {‘omg_peak’:,’A_peak_over_nu’:, ‘c3A’:, ‘c3p’:, ‘c4p’:}}. Default: None.
DeltaPhi(self, int l, int m)
DeltaT(self, int l, int m)
EOBPM_SetupFitCoefficients(self, int l, int m, dict NR_fit_coeffs)
JimenezFortezaRemnantMass(self)
JimenezFortezaRemnantSpin(self)
M

‘double’

Type

M

Mf

‘double’

Type

Mf

NR_fit_coeffs

dict

Type

NR_fit_coeffs

S_bar(self)
S_hat(self)
Sbar

‘double’

Type

Sbar

Shat

‘double’

Type

Shat

TEOBPM_Amplitude(self, double tau, double sigma_real, double a1, double a2, double a3, double a4)
TEOBPM_Phase(self, double tau, double sigma_imag, double phi_0, double p1, double p2, double p3, double p4)
TGR_params

dict

Type

TGR_params

X1

‘double’

Type

X1

X12

‘double’

Type

X12

X2

‘double’

Type

X2

X_1(self)
X_12(self)
X_2(self)
a0

‘double’

Type

a0

a12

‘double’

Type

a12

a_0(self)
a_12(self)
af

‘double’

Type

af

alpha1(self, int l, int m)
alpha21(self, int l, int m)
amplitude_peak(self, double omega_peak, int l, int m)
c3_A(self, int l, int m)
c3_phi(self, int l, int m)
c4_phi(self, int l, int m)
chi1

‘double’

Type

chi1

chi2

‘double’

Type

chi2

dOmega(self, double omega1, double omega_peak)
fit_coefficients

dict

Type

fit_coefficients

full_modes

‘unsigned int’

Type

full_modes

geom

‘unsigned int’

Type

geom

iota

‘double’

Type

iota

m1

‘double’

Type

m1

m2

‘double’

Type

m2

modes

list

Type

modes

multipoles

list

Type

multipoles

nu

‘double’

Type

nu

omega1(self, int l, int m)
omega_peak(self, int l, int m)
phases

dict

Type

phases

phi

‘double’

Type

phi

r

‘double’

Type

r

sym_mass_ratio(self)
t0

‘double’

Type

t0

waveform(self, ndarray times)
pyRing.waveform.damped_sinusoid(double A, double f, double tau, double phi, double t0, ndarray t) → ndarray

Function to compute a damped sinusoid waveform model.

Parameters
  • A (float) – Amplitude of the damped sinusoid.

  • f (float) – Frequency of the damped sinusoid.

  • tau (float) – Damping time of the damped sinusoid.

  • phi (float) – Phase of the damped sinusoid.

  • t0 (float) – Start time of the damped sinusoid.

  • t (np.ndarray) – Time array.

Returns

h – Damped sinusoid waveform model.

Return type

np.ndarray

pyRing.waveform.tail_factor(double A, double phi, double p, double t0, ndarray t) → ndarray

Function to compute the tail factor of the damped sinusoid waveform model.

Parameters
  • A (float) – Amplitude of the damped sinusoid.

  • phi (float) – Phase of the damped sinusoid.

  • p (float) – Power-law exponent of the damped sinusoid.

  • t0 (float) – Start time of the damped sinusoid.

  • t (np.ndarray) – Time array.

Returns

h – Tail factor of the damped sinusoid waveform model.

Return type

np.ndarray

Module contents