bilby.gw.detector.psd.PowerSpectralDensity

class bilby.gw.detector.psd.PowerSpectralDensity(frequency_array=None, psd_array=None, asd_array=None, psd_file=None, asd_file=None)[source]

Bases: object

__init__(frequency_array=None, psd_array=None, asd_array=None, psd_file=None, asd_file=None)[source]

Instantiate a new PowerSpectralDensity object.

Examples

Using the from method directly (here psd_file is a string containing the path to the file to load):

>>> power_spectral_density = PowerSpectralDensity.from_power_spectral_density_file(psd_file)

Alternatively (and equivalently) setting the psd_file directly:

>>> power_spectral_density = PowerSpectralDensity(psd_file=psd_file)
Attributes:
asd_array: array_like

Array representation of the ASD

asd_file: str

Name of the ASD file

frequency_array: array_like

Array containing the frequencies of the ASD/PSD values

psd_array: array_like

Array representation of the PSD

psd_file: str

Name of the PSD file

power_spectral_density_interpolated: scipy.interpolated.interp1d

Interpolated function of the PSD

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__([frequency_array, psd_array, ...])

Instantiate a new PowerSpectralDensity object.

from_aligo()

from_amplitude_spectral_density_array(...)

from_amplitude_spectral_density_file(asd_file)

Set the amplitude spectral density from a given file

from_channel_name(channel, psd_start_time, ...)

Generate power spectral density from a given channel name by loading data using strain_data.set_from_channel_name

from_frame_file(frame_file, psd_start_time, ...)

Generate power spectral density from a frame file

from_power_spectral_density_array(...)

from_power_spectral_density_file(psd_file)

Set the power spectral density from a given file

get_amplitude_spectral_density_array(...)

get_noise_realisation(sampling_frequency, ...)

Generate frequency Gaussian noise scaled to the power spectral density.

get_power_spectral_density_array(frequency_array)

Attributes

asd_array

asd_file

power_spectral_density_interpolated

psd_array

psd_file

static from_amplitude_spectral_density_file(asd_file)[source]

Set the amplitude spectral density from a given file

Parameters:
asd_file: str

File containing amplitude spectral density, format ‘f h_f’

static from_channel_name(channel, psd_start_time, psd_duration, fft_length=4, sampling_frequency=4096, roll_off=0.2, overlap=0, name=None, outdir=None, analysis_segment_start_time=None)[source]

Generate power spectral density from a given channel name by loading data using strain_data.set_from_channel_name

Parameters:
psd_start_time: float

Beginning of segment to analyse.

psd_duration: float, optional

Duration of data (in seconds) to generate PSD from.

fft_length: float, optional

Number of seconds in a single fft.

sampling_frequency: float, optional

Sampling frequency for time series. This is twice the maximum frequency.

roll_off: float, optional

Rise time in seconds of tukey window.

overlap: float,

Number of seconds of overlap between FFTs.

channel: str

Name of channel to use to generate PSD in the format IFO:Channel

name, outdir: str, optional

Name (and outdir) of the detector for which a PSD is to be generated.

analysis_segment_start_time: float, optional

The start time of the analysis segment, if given, this data will be removed before creating the PSD.

static from_frame_file(frame_file, psd_start_time, psd_duration, fft_length=4, sampling_frequency=4096, roll_off=0.2, overlap=0, channel=None, name=None, outdir=None, analysis_segment_start_time=None)[source]

Generate power spectral density from a frame file

Parameters:
frame_file: str, optional

Frame file to read data from.

psd_start_time: float

Beginning of segment to analyse.

psd_duration: float, optional

Duration of data (in seconds) to generate PSD from.

fft_length: float, optional

Number of seconds in a single fft.

sampling_frequency: float, optional

Sampling frequency for time series. This is twice the maximum frequency.

roll_off: float, optional

Rise time in seconds of tukey window.

overlap: float,

Number of seconds of overlap between FFTs.

channel: str, optional

Name of channel to use to generate PSD.

name, outdir: str, optional

Name (and outdir) of the detector for which a PSD is to be generated.

analysis_segment_start_time: float, optional

The start time of the analysis segment, if given, this data will be removed before creating the PSD.

static from_power_spectral_density_file(psd_file)[source]

Set the power spectral density from a given file

Parameters:
psd_file: str, optional

File containing power spectral density, format ‘f h_f’

get_noise_realisation(sampling_frequency, duration)[source]

Generate frequency Gaussian noise scaled to the power spectral density.

Parameters:
sampling_frequency: float

sampling frequency of noise

duration: float

duration of noise

Returns:
array_like: frequency domain strain of this noise realisation
array_like: frequencies related to the frequency domain strain