gw.domains.base_frequency_domain.BaseFrequencyDomain

gw.domains.base_frequency_domain.BaseFrequencyDomain()

Attributes

Name Description
delta_f
f_min
frequency_mask
frequency_mask_length
noise_std Standard deviation per bin for white noise,
sample_frequencies
sample_frequencies_torch
sample_frequencies_torch_cuda

Methods

Name Description
add_phase Add a (frequency-dependent) phase to a frequency series. Allows for batching,
check_data_compatibility Check that the trailing dimension of data is compatible with the domain, i.e.,
get_sample_frequencies_astype Returns a 1D frequency array compatible with the last index of data array.
time_translate_data Time translate frequency-domain data by dt. Time translation corresponds (in

add_phase

gw.domains.base_frequency_domain.BaseFrequencyDomain.add_phase(data, phase)

Add a (frequency-dependent) phase to a frequency series. Allows for batching, as well as additional channels (such as detectors). Accounts for the fact that the data could be a complex frequency series or real and imaginary parts.

Convention: the phase \(\phi(f)\) is defined via \(\exp[- i \phi(f)]\).

Parameters

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

Returns

Name Type Description
New array or tensor of the same shape as data.

check_data_compatibility

gw.domains.base_frequency_domain.BaseFrequencyDomain.check_data_compatibility(
    data,
)

Check that the trailing dimension of data is compatible with the domain, i.e., compare against the domain length.

Parameters

Name Type Description Default
data np.ndarray required

Returns

Name Type Description
bool Whether the data are compatible with domain.

get_sample_frequencies_astype

gw.domains.base_frequency_domain.BaseFrequencyDomain.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).

Parameters

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

Returns

Name Type Description
Frequency array compatible with last index, of the same type as input

time_translate_data

gw.domains.base_frequency_domain.BaseFrequencyDomain.time_translate_data(
    data,
    dt,
)

Time translate frequency-domain data by dt. Time translation corresponds (in frequency domain) to multiplication by \[ \exp(-2 \pi i f \cdot dt). \]

This method allows for multiple batch dimensions. For torch.Tensor data, allow for either a complex or a (real, imag) representation.

Parameters

Name Type Description Default
data array - like(numpy, torch) Shape (B, C, N), where - B corresponds to any dimension >= 0, - C is either absent (for complex data) or has dimension >= 2 (for data represented as real and imaginary parts), and - N is either len(self) or len(self)-self.min_idx (for truncated data). required
dt torch tensor, or scalar (if data is numpy) Shape (B) required

Returns

Name Type Description
Array-like of the same form as data.