# Fourier¶

class emg3d.time.Fourier(time, fmin, fmax, signal=0, ft='dlf', ftarg=None, **kwargs)[source]

Bases: object

Time-domain CSEM computation.

Class to carry out time-domain modelling with the frequency-domain code emg3d following [WeMS21]. Instances of the class take care of computing the required frequencies, the interpolation from coarse, limited-band frequencies to the required frequencies, and carrying out the actual transform.

Everything related to the Fourier transform is done by utilising the capabilities of the 1D modeller empymod. The input parameters time, signal, ft, and ftarg are passed to the function empymod.utils.check_time to obtain the required frequencies. The actual transform is subsequently carried out by calling empymod.model.tem. See these functions for more details about the exact implementations of the Fourier transforms and its parameters. Note that also the verb-argument follows the definition in empymod.

The mapping from computed frequencies to the frequencies required for the Fourier transform is done in three steps:

• Data for $$f>f_\mathrm{max}$$ is set to 0+0j.

• Data for $$f<f_\mathrm{min}$$ is interpolated by adding an additional data point at a frequency of 1e-100 Hz. The data for this point is data.real[0]+0j, hence the real part of the lowest computed frequency and zero imaginary part. Interpolation is carried out using PCHIP from scipy.interpolate.pchip_interpolate.

• Data for $$f_\mathrm{min}\le f \le f_\mathrm{max}$$ is computed with cubic spline interpolation (on a log-scale) using scipy.interpolate.InterpolatedUnivariateSpline.

Note

The package empymod has to be installed in order to use Fourier: pip install empymod or conda install -c conda-forge empymod.

Parameters
timendarray

Desired times (s).

fmin, fmaxfloat

Minimum and maximum frequencies (Hz) to compute:

• Data for freq > fmax is set to 0+0j.

• Data for freq < fmin is interpolated, using an extra data-point at f = 1e-100 Hz, with value data.real[0]+0j. (Hence zero imaginary part, and the lowest computed real value.)

signal{-1, 0, 1}, default: 0

Source signal:

• -1 : Switch-off time-domain response

• 0 : Impulse time-domain response

• +1 : Switch-on time-domain response

ft{‘sin’, ‘cos’, ‘fftlog’}, default: ‘sin’

Flag to choose either the Digital Linear Filter method (Sine- or Cosine-Filter) or the FFTLog for the Fourier transform.

ftargdict, default depends on ft

Fourier transform arguments.

• If ft='dlf':

• dlf: string of filter name in empymod.filters or the filter method itself; default: 'key_201_CosSin_2012'.

• pts_per_dec: points per decade; default: -1.

• If 0: Standard DLF;

• If < 0: Lagged Convolution DLF;

• If > 0: Splined DLF.

• If ft='fftlog':

• pts_per_dec: samples per decade; default: 10.

• add_dec: additional decades [left, right]; default: [-2, 1].

• q: exponent of power law bias, -1 <= q <= 1 ; default: 0.

input_freqndarray, default: None

Frequencies to use for computation. Mutually exclusive with every_x_freq.

every_x_freqint, default: None

Every every_x_freq-th frequency of the required frequency-range is used for computation. Mutually exclusive with input_freq.

Attributes Summary

 every_x_freq If set, freq_coarse is every_x_freq-frequency of freq_required. fmax Maximum frequency (Hz) to compute. fmin Minimum frequency (Hz) to compute. freq_coarse Coarse frequency range, can be different from freq_required. freq_compute Frequencies at which the model has to be computed. freq_extrapolate These are the frequencies to extrapolate. freq_interpolate These are the frequencies to interpolate. freq_required Frequencies required to carry out the Fourier transform. ft Type of Fourier transform. ftarg Fourier transform arguments. ifreq_compute Indices of freq_coarse which have to be computed. ifreq_extrapolate Indices of the frequencies to extrapolate. ifreq_interpolate Indices of the frequencies to interpolate. input_freq If set, freq_coarse is set to input_freq. signal Signal in time domain {-1, 0, 1}. time Desired times (s).

Methods Summary

 fourier_arguments(ft, ftarg) Set Fourier type and its arguments. freq2time(fdata, off) Compute corresponding time-domain signal. interpolate(fdata) Interpolate from computed data to required data.

Attributes Documentation

every_x_freq

If set, freq_coarse is every_x_freq-frequency of freq_required.

fmax

Maximum frequency (Hz) to compute.

fmin

Minimum frequency (Hz) to compute.

freq_coarse

Coarse frequency range, can be different from freq_required.

freq_compute

Frequencies at which the model has to be computed.

freq_extrapolate

These are the frequencies to extrapolate.

In the end it is done via interpolation, using an extra data-point at f = 1e-100 Hz, with value data.real[0]+0j. (Hence zero imaginary part, and the lowest computed real value.)

freq_interpolate

These are the frequencies to interpolate.

If freq_required is equal freq_coarse, then this is equal to freq_compute.

freq_required

Frequencies required to carry out the Fourier transform.

ft

Type of Fourier transform.

Set via fourier_arguments(ft, ftarg).

ftarg

Fourier transform arguments.

Set via fourier_arguments(ft, ftarg).

ifreq_compute

Indices of freq_coarse which have to be computed.

ifreq_extrapolate

Indices of the frequencies to extrapolate.

ifreq_interpolate

Indices of the frequencies to interpolate.

input_freq

If set, freq_coarse is set to input_freq.

signal

Signal in time domain {-1, 0, 1}.

time

Desired times (s).

Methods Documentation

fourier_arguments(ft, ftarg)[source]

Set Fourier type and its arguments.

freq2time(fdata, off)[source]

Compute corresponding time-domain signal.

Carry out the actual Fourier transform.

Parameters
fdatandarray

Frequency-domain data corresponding to Fourier.freq_compute.

offfloat

Corresponding offset (m).

Returns
tdatandarray

Time-domain data corresponding to Fourier.time.

interpolate(fdata)[source]

Interpolate from computed data to required data.

Parameters
fdatandarray

Frequency-domain data corresponding to freq_compute.

Returns
full_datandarray

Frequency-domain data corresponding to freq_required.