gw.domains.uniform_frequency_domain.UniformFrequencyDomain

gw.domains.uniform_frequency_domain.UniformFrequencyDomain(
    f_min,
    f_max,
    delta_f,
)

Defines the physical domain on which the data of interest live.

The frequency bins are assumed to be uniform between [0, f_max] with spacing delta_f.

Given a finite length of time domain data, the Fourier domain data starts at a frequency f_min and is zero below this frequency.

window_kwargs specify windowing used for FFT to obtain FD data from TD data in practice.

Parameters

Name Type Description Default
f_min float required
f_max float required
delta_f float required

Attributes

Name Description
delta_f The frequency spacing of the uniform grid [Hz].
domain_dict Enables to rebuild the domain via calling build_domain(domain_dict).
duration Waveform duration in seconds.
f_max The maximum frequency [Hz] is typically set to half the sampling
f_min The minimum frequency [Hz].
frequency_mask Mask which selects frequency bins greater than or equal to the
frequency_mask_length Number of samples in the subdomain domain[frequency_mask].
max_idx
min_idx
sample_frequencies
sampling_rate

Methods

Name Description
get_sample_frequencies_astype Returns a 1D frequency array compatible with the last index of data array.
update Update the domain with new settings. This is only allowed if the new settings
update_data Adjusts data to be compatible with the domain:

get_sample_frequencies_astype

gw.domains.uniform_frequency_domain.UniformFrequencyDomain.get_sample_frequencies_astype(
    data,
)

Returns a 1D frequency array compatible with the last index of data array.

Decides whether array is numpy or torch tensor (and cuda vs cpu), and whether it contains the leading zeros below f_min.

Parameters

Name Type Description Default
data Union[np.array, torch.Tensor] Sample data required

Returns

Name Type Description
frequency array compatible with last index

update

gw.domains.uniform_frequency_domain.UniformFrequencyDomain.update(new_settings)

Update the domain with new settings. This is only allowed if the new settings are “compatible” with the old ones. E.g., f_min should be larger than the existing f_min.

Parameters

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

update_data

gw.domains.uniform_frequency_domain.UniformFrequencyDomain.update_data(
    data,
    axis=-1,
    low_value=0.0,
)

Adjusts data to be compatible with the domain:

  • Below f_min, it sets the data to low_value (typically 0.0 for a waveform, but for a PSD this might be a large value).
  • Above f_max, it truncates the data array.

Parameters

Name Type Description Default
data np.ndarray Data array required
axis int Which data axis to apply the adjustment along. -1
low_value float Below f_min, set the data to this value. 0.0

Returns

Name Type Description
np.ndarray The new data array.