pycbc.noise package

Submodules

pycbc.noise.gaussian module

This module contains functions to generate gaussian noise colored with a noise spectrum.

pycbc.noise.gaussian.frequency_noise_from_psd(psd, seed=None)[source]

Create noise with a given psd.

Return noise coloured with the given psd. The returned noise FrequencySeries has the same length and frequency step as the given psd. Note that if unique noise is desired a unique seed should be provided.

Parameters:
  • psd (FrequencySeries) – The noise weighting to color the noise.

  • seed ({0, int} or None) – The seed to generate the noise. If None specified, the seed will not be reset.

Returns:

noise – A FrequencySeries containing gaussian noise colored by the given psd.

Return type:

FrequencySeriesSeries

pycbc.noise.gaussian.noise_from_psd(length, delta_t, psd, seed=None)[source]

Create noise with a given psd.

Return noise with a given psd. Note that if unique noise is desired a unique seed should be provided.

Parameters:
  • length (int) – The length of noise to generate in samples.

  • delta_t (float) – The time step of the noise.

  • psd (FrequencySeries) – The noise weighting to color the noise.

  • seed ({0, int}) – The seed to generate the noise.

Returns:

noise – A TimeSeries containing gaussian noise colored by the given psd.

Return type:

TimeSeries

pycbc.noise.gaussian.noise_from_string(psd_name, length, delta_t, seed=None, low_frequency_cutoff=10.0)[source]

Create noise from an analytic PSD

Return noise from the chosen PSD. Note that if unique noise is desired a unique seed should be provided.

Parameters:
  • psd_name (str) – Name of the analytic PSD to use.

  • low_fr

  • length (int) – The length of noise to generate in samples.

  • delta_t (float) – The time step of the noise.

  • seed ({None, int}) – The seed to generate the noise.

  • low_frequency_cutof ({10.0, float}) – The low frequency cutoff to pass to the PSD generation.

Returns:

noise – A TimeSeries containing gaussian noise colored by the given psd.

Return type:

TimeSeries

pycbc.noise.reproduceable module

pycbc.noise.reproduceable.block(seed, sample_rate)[source]

Return block of normal random numbers

Parameters:
  • seed ({None, int}) – The seed to generate the noise.sd

  • sample_rate (float) – Sets the variance of the white noise

Returns:

noise – Array of random numbers

Return type:

numpy.ndarray

pycbc.noise.reproduceable.colored_noise(psd, start_time, end_time, seed=0, sample_rate=16384, low_frequency_cutoff=1.0, filter_duration=128, scale=1.0)[source]

Create noise from a PSD

Return noise from the chosen PSD. Note that if unique noise is desired a unique seed should be provided.

Parameters:
  • psd (pycbc.types.FrequencySeries) – PSD to color the noise

  • start_time (int) – Start time in GPS seconds to generate noise

  • end_time (int) – End time in GPS seconds to generate nosie

  • seed ({None, int}) – The seed to generate the noise.

  • sample_rate ({16384, float}) – The sample rate of the output data. Keep constant if you want to ensure continuity between disjoint time spans.

  • low_frequency_cutof ({1.0, float}) – The low frequency cutoff to pass to the PSD generation.

  • filter_duration ({128, float}) – The duration in seconds of the coloring filter

Returns:

noise – A TimeSeries containing gaussian noise colored by the given psd.

Return type:

TimeSeries

pycbc.noise.reproduceable.noise_from_string(psd_name, start_time, end_time, seed=0, sample_rate=16384, low_frequency_cutoff=1.0, filter_duration=128, scale=1.0)[source]

Create noise from an analytic PSD

Return noise from the chosen PSD. Note that if unique noise is desired a unique seed should be provided.

Parameters:
  • psd_name (str) – Name of the analytic PSD to use.

  • start_time (int) – Start time in GPS seconds to generate noise

  • end_time (int) – End time in GPS seconds to generate nosie

  • seed ({None, int}) – The seed to generate the noise.

  • sample_rate ({16384, float}) – The sample rate of the output data. Keep constant if you want to ensure continuity between disjoint time spans.

  • low_frequency_cutof ({10.0, float}) – The low frequency cutoff to pass to the PSD generation.

  • filter_duration ({128, float}) – The duration in seconds of the coloring filter

Returns:

noise – A TimeSeries containing gaussian noise colored by the given psd.

Return type:

TimeSeries

pycbc.noise.reproduceable.normal(start, end, sample_rate=16384, seed=0)[source]

Generate data with a white Gaussian (normal) distribution

Parameters:
  • start_time (int) – Start time in GPS seconds to generate noise

  • end_time (int) – End time in GPS seconds to generate noise

  • sample-rate (float) – Sample rate to generate the data at. Keep constant if you want to ensure continuity between disjoint time spans.

  • seed ({None, int}) – The seed to generate the noise.

Returns:

noise – A TimeSeries containing gaussian noise

Return type:

TimeSeries

Module contents