def ffht(fEM, time, freq, ftarg):
"""Fourier Transform using a Cosine- or a Sine-filter.
It follows the Filter methodology [Anderson_1975]_, see `fht` for more
information.
The function is called from one of the modelling routines in :mod:`model`.
Consult these modelling routines for a description of the input and output
parameters.
This function is based on `get_CSEM1D_TD_FHT.m` from the source code
distributed with [Key_2012]_.
Returns
-------
tEM : array
Returns time-domain EM response of `fEM` for given `time`.
conv : bool
Only relevant for QWE/QUAD.
"""
# Get ftarg values
fftfilt, pts_per_dec, ftkind = ftarg
# Settings depending if cos/sin plus scaling
if ftkind == 'sin':
fEM = -fEM.imag
else:
fEM = fEM.real
if pts_per_dec: # Use pts_per_dec frequencies per decade
# 1. Interpolate in frequency domain
sfEM = iuSpline(np.log10(2*np.pi*freq), fEM)
ifEM = sfEM(np.log10(fftfilt.base/time[:, None]))
# 2. Filter
tEM = np.dot(ifEM, getattr(fftfilt, ftkind))
else: # Standard FHT procedure
# Get new times in frequency domain
_, itime = get_spline_values(fftfilt, time)
# Re-arranged fEM with shape (ntime, nfreq). Each row starts one
# 'freq' higher.
fEM = np.concatenate((np.tile(fEM, itime.size).squeeze(),
np.zeros(itime.size)))
fEM = fEM.reshape(itime.size, -1)[:, :fftfilt.base.size]
# 1. Filter
stEM = np.dot(fEM, getattr(fftfilt, ftkind))
# 2. Interpolate in time domain
itEM = iuSpline(np.log10((itime)[::-1]), stEM[::-1])
tEM = itEM(np.log10(time))
# Return the electromagnetic time domain field
# (Second argument is only for QWE)
return tEM/time, True
评论列表
文章目录