pygwb.parameters.Parameters

class pygwb.parameters.Parameters(t0: float = 0, tf: float = 100, interferometer_list: ~typing.List = <factory>, data_type: str = 'public', channel: str = 'GWOSC-16KHZ_R1_STRAIN', frametype: str = '', new_sample_rate: int = 4096, input_sample_rate: int = 16384, cutoff_frequency: float = 11, segment_duration: int = 192, number_cropped_seconds: int = 2, window_downsampling: str = 'hamming', ftype: str = 'fir', frequency_resolution: float = 0.03125, polarization: str = 'tensor', alpha: float = 0, fref: float = 25, flow: float = 20, fhigh: float = 1726, local_data_path: str = '', notch_list_path: str = '', coarse_grain_psd: bool = False, coarse_grain_csd: bool = True, overlap_factor_welch: float = 0.5, N_average_segments_psd: int = 2, window_fft_dict: dict = <factory>, window_fft_dict_welch: dict = <factory>, calibration_epsilon: float = 0, overlap_factor: float = 0.5, delta_sigma_cut: float = 0.2, alphas_delta_sigma_cut: ~typing.List = <factory>, save_data_type: str = 'npz', time_shift: int = 0, path_gate_data: str = '', gate_data: bool = False, gate_tzero: float = 1.0, gate_tpad: float = 0.5, gate_threshold: float = 50.0, cluster_window: float = 0.5, gate_whiten: bool = True, tag: str = '', return_naive_and_averaged_sigmas: bool = False)[source]

Bases: object

A dataclass which contains all parameters required for initialising a pygwb Interferometer, a pygwb Baseline, and run pygwb_pipe.

t0

Initial time.

Type:

float

tf

Final time.

Type:

float

data_type

Type of data to access/download; options are private, public, local. Default is public.

Type:

str

channel

Channel name; needs to match an existing channel. Default is “GWOSC-16KHZ_R1_STRAIN”.

Type:

str

frametype

Frame type; Optional, desired channel needs to be found in listed frametype. Only used when data_type=private. Default is empty.

Type:

str

new_sample_rate

Sample rate to use when downsampling the data (Hz). Default is 4096 Hz.

Type:

int

input_sample_rate

Sample rate of the read data (Hz). Default is 16384 Hz.

Type:

int

cutoff_frequency

Lower frequency cutoff; applied in filtering in preprocessing (Hz). Default is 11 Hz.

Type:

int

segment_duration

Duration of the individual segments to analyse (seconds). Default is 192 seconds.

Type:

int

number_cropped_seconds

Number of seconds to crop at the start and end of the analysed data (seconds). Default is 2 seconds.

Type:

int

window_downsampling

Type of window to use in preprocessing. Default is “hamming”.

Type:

str

ftype

Type of filter to use in downsampling. Default is “fir”.

Type:

str

frequency_resolution

Frequency resolution of the final output spectrum (Hz). Default is 1/32 Hz.

Type:

float

polarization

Polarization type for the overlap reduction function calculation; options are scalar, vector, tensor. Default is tensor.

Type:

str

alpha

Spectral index to filter the data for. Default is 0.

Type:

float

fref

Reference frequency to filter the data at (Hz). Default is 25 Hz.

Type:

int

flow

Lower frequency to include in the analysis (Hz). Default is 20 Hz.

Type:

int

fhigh

Higher frequency to include in the analysis (Hz). Default is 1726 Hz.

Type:

int

interferometer_list

List of interferometers to run the analysis with. Default is [“H1”, “L1”].

Type:

list

local_data_path

Path(s) to local data, if the local data option is chosen. Default is empty.

Type:

str

notch_list_path

Path to the notch list file. Default is empty.

Type:

str

coarse_grain_psd

Whether to apply coarse graining to obtain PSD spectra. Default is False.

Type:

bool

coarse_grain_csd

Whether to apply coarse graining to obtain CSD spectra. Default is True.

Type:

bool

overlap_factor_welch

Overlap factor to use when if using Welch’s method to estimate spectra (NOT coarsegraining). For “hann” window use 0.5 overlap_factor and for “boxcar” window use 0 overlap_factor. Default is 0.5 (50% overlap), which is optimal when using Welch’s method with a “hann” window.

Type:

float

N_average_segments_psd

Number of segments to average over when calculating the psd with Welch method. Default is 2.

Type:

int

window_fft_dict

Dictionary containing name and parameters describing which window to use when producing fftgrams for psds and csds. Default is “hann”.

Type:

dict

window_fft_dict_welch

Dictionary containing name and parameters relative to which window to use when producing fftgrams for pwelch calculation. Default is “hann”.

Type:

dict

calibration_epsilon

Calibration coefficient. Default is 0.

Type:

float

overlap_factor

Factor by which to overlap consecutive segments for analysis. Default is 0.5 (50%% overlap).

Type:

float

delta_sigma_cut

Cutoff value for the delta sigma cut. Default is 0.2.

Type:

float

alphas_delta_sigma_cut

List of spectral indexes to use in delta sigma cut calculation. Default is [-5, 0, 3].

Type:

list

save_data_type

Suffix for the output data file. Options are hdf5, npz, json, pickle. Default is json.

Type:

str

time_shift

Seconds to timeshift the data by in preprocessing. Default is 0.

Type:

int

gate_data

Whether to apply self-gating to the data in preprocessing. Default is False.

Type:

bool

gate_tzero

Half-width time duration (seconds) in which the timeseries is set to zero. Default is 1.0.

Type:

float

gate_tpad

Half-width time duration (seconds) in which the Planck window is tapered. Default is 0.5.

Type:

float

gate_threshold

Amplitude threshold, if the data exceeds this value a gating window will be placed. Default is 50.

Type:

float

cluster_window

Time duration (seconds) over which gating points will be clustered. Default is 0.5.

Type:

float

gate_whiten

Whether to whiten when gating. Default is True.

Type:

bool

tag

Hint for the read_data function to retrieve one specific type of data, e.g.: C00, C01.

Type:

str

return_naive_and_averaged_sigmas

Option to return naive and sliding sigmas from delta sigma cut.

Type:

bool

__init__(t0: float = 0, tf: float = 100, interferometer_list: ~typing.List = <factory>, data_type: str = 'public', channel: str = 'GWOSC-16KHZ_R1_STRAIN', frametype: str = '', new_sample_rate: int = 4096, input_sample_rate: int = 16384, cutoff_frequency: float = 11, segment_duration: int = 192, number_cropped_seconds: int = 2, window_downsampling: str = 'hamming', ftype: str = 'fir', frequency_resolution: float = 0.03125, polarization: str = 'tensor', alpha: float = 0, fref: float = 25, flow: float = 20, fhigh: float = 1726, local_data_path: str = '', notch_list_path: str = '', coarse_grain_psd: bool = False, coarse_grain_csd: bool = True, overlap_factor_welch: float = 0.5, N_average_segments_psd: int = 2, window_fft_dict: dict = <factory>, window_fft_dict_welch: dict = <factory>, calibration_epsilon: float = 0, overlap_factor: float = 0.5, delta_sigma_cut: float = 0.2, alphas_delta_sigma_cut: ~typing.List = <factory>, save_data_type: str = 'npz', time_shift: int = 0, path_gate_data: str = '', gate_data: bool = False, gate_tzero: float = 1.0, gate_tpad: float = 0.5, gate_threshold: float = 50.0, cluster_window: float = 0.5, gate_whiten: bool = True, tag: str = '', return_naive_and_averaged_sigmas: bool = False) None
__call__(*args, **kwargs)

Call self as a function.

Methods

__init__([t0, tf, interferometer_list, ...])

parse_ifo_parameters()

Parse the parameters of the analysis pipeline into a dictionary with arguments per interferometer of the pipeline.

save_paramfile(output_path)

Save parameters to a parameters ini file.

update_from_arguments(args)

Update parameters from a set of arguments.

update_from_dictionary(kwargs)

Update parameters from a dictionary.

update_from_file(path)

Update parameters from an ini file.

Attributes

N_average_segments_psd

alpha

calibration_epsilon

channel

cluster_window

coarse_grain_csd

coarse_grain_psd

cutoff_frequency

data_type

delta_sigma_cut

fhigh

flow

frametype

fref

frequency_resolution

ftype

gate_data

gate_threshold

gate_tpad

gate_tzero

gate_whiten

input_sample_rate

local_data_path

new_sample_rate

notch_list_path

number_cropped_seconds

overlap_factor

overlap_factor_welch

path_gate_data

polarization

return_naive_and_averaged_sigmas

save_data_type

segment_duration

t0

tag

tf

time_shift

window_downsampling

interferometer_list

window_fft_dict

window_fft_dict_welch

alphas_delta_sigma_cut

parse_ifo_parameters()[source]

Parse the parameters of the analysis pipeline into a dictionary with arguments per interferometer of the pipeline.

Returns:
param_dict: dict

A dictionary containing the parameters of the analysis per interferometer used in the analysis.

save_paramfile(output_path)[source]

Save parameters to a parameters ini file.

Parameters:

output_path (str) – Full path for output parameters ini file.

update_from_arguments(args: List[str]) None[source]

Update parameters from a set of arguments.

Parameters:

args (list) – List of arguments to update in the class. Format must coincide to argparse formatting, e.g., [’–t0’, ‘0’, ‘–tf’, ‘100’].

Notes

Not all possible options are available through argument updating. The two exceptions are the dictionary attributes which can not be parsed easily by argparse. These are * window_fft_dict: this is composed by the single argument

– window_fftgram

This is the only option currently supported. To use windows that require extra parameters, pass these as part of an .ini file, in the relevant section [window_fft_specs]. * window_fft_dict_welch: this is composed by the single argument

– window_fftgram_welch

update_from_dictionary(kwargs)[source]

Update parameters from a dictionary.

Parameters:

kwargs (dict) – Dictionary of parameters to update.

update_from_file(path: str) None[source]

Update parameters from an ini file.

Parameters:

path (str) – Path to parameters ini file to use to update class.