gw.dataset.waveform_dataset.WaveformDataset

gw.dataset.waveform_dataset.WaveformDataset(
    file_name=None,
    dictionary=None,
    transform=None,
    precision=None,
    domain_update=None,
    svd_size_update=None,
    leave_waveforms_on_disk=False,
)

This class stores a dataset of waveforms (polarizations) and corresponding parameters.

It can load the dataset either from an HDF5 file or suitable dictionary.

It is possible to either load the entire dataset into memory or to load the dataset during training (leave_waveforms_on_disk=True) to reduce the memory footprint. At the moment, it is only possible to load the waveforms on-demand since the standardization dict for all parameters in the dataset has to be computed at the beginning of training.

The waveform data is consumed through a getitem() or getitems() call which optionally loads the polarizations and applies a chain of transformations, which are classes that implement a call() method.

For constructing, provide either file_name, or dictionary containing data and settings entries, or neither.

Parameters

Name Type Description Default
file_name str HDF5 file containing a dataset None
dictionary dict Contains settings and data entries. The dictionary keys should be ‘settings’, ‘parameters’, and ‘polarizations’. None
transform Transform Transform to be applied to dataset samples when accessed through getitem None
precision str(single, double) If provided, changes precision of loaded dataset. None
domain_update dict If provided, update domain from existing domain using new settings. None
svd_size_update int If provided, reduces the SVD size when decompressing (for speed). None
leave_waveforms_on_disk bool If True, the values for the waveforms are not loaded into RAM when initializing the waveform dataset. Instead, they are loaded lazily in getitem(). False

Attributes

Name Description
complex_type
dataset_type
decompression_transform
domain
file_handle
file_name
precision
real_type
svd_size_update
transform

Methods

Name Description
initialize_decompression Sets up decompression transforms. These are applied to the raw dataset before
load_supplemental Method called immediately after loading a dataset.
parameter_mean_std
update_domain Update the domain based on new configuration.

initialize_decompression

gw.dataset.waveform_dataset.WaveformDataset.initialize_decompression(
    svd_size_update=None,
)

Sets up decompression transforms. These are applied to the raw dataset before self.transform. E.g., SVD decompression.

Parameters

Name Type Description Default
svd_size_update int If provided, reduces the SVD size when decompressing (for speed). None

load_supplemental

gw.dataset.waveform_dataset.WaveformDataset.load_supplemental(
    domain_update=None,
    svd_size_update=None,
)

Method called immediately after loading a dataset.

Creates (and possibly updates) domain, updates dtypes, and initializes any decompression transform. Also zeros data below f_min, and truncates above f_max.

Parameters

Name Type Description Default
domain_update dict If provided, update domain from existing domain using new settings. None
svd_size_update int If provided, reduces the SVD size when decompressing (for speed). None

parameter_mean_std

gw.dataset.waveform_dataset.WaveformDataset.parameter_mean_std()

update_domain

gw.dataset.waveform_dataset.WaveformDataset.update_domain(domain_update=None)

Update the domain based on new configuration.

The waveform dataset provides waveform polarizations in a particular domain. In Frequency domain, this is [0, domain._f_max]. Furthermore, data is set to 0 below domain._f_min. In practice one may want to train a network based on slightly different domain settings, which corresponds to truncating the likelihood integral.

This method provides functionality for that. It truncates and/or zeroes the dataset to the range specified by the domain, by calling domain.update_data.

Parameters

Name Type Description Default
domain_update dict Settings dictionary. Must contain a subset of the keys contained in domain_dict. None