NumpyFFTBase¶
- class baseband_tasks.fourier.numpy.NumpyFFTBase(direction='forward')[source] [edit on github]¶
Bases:
FFTBase
Single pre-defined FFT based on
numpy.fft
.To use, initialize an instance, then call the instance to perform the transform.
- Parameters:
- direction‘forward’ or ‘backward’, optional
Direction of the FFT.
Attributes Summary
Axis over which to perform the FFT.
Direction of the FFT ('forward' or 'backward').
FFT sample frequencies.
Data type of the frequency-domain data.
Shape of the frequency-domain data.
Use orthogonal normalization.
Rate of samples in the time domain.
Data type of the time-domain data.
Shape of the time-domain data.
Methods Summary
__call__
(a)Perform FFT.
inverse
()Return inverse transform.
Attributes Documentation
- axis¶
Axis over which to perform the FFT.
- direction¶
Direction of the FFT (‘forward’ or ‘backward’).
- frequency¶
FFT sample frequencies.
Uses
numpy.fft.fftfreq
for complex time-domain data, which returns, for an array of length n and a time-domainsample_rate
,f = [0, 1, …, n/2-1, -n/2, …, -1] * sample_rate / n
if n is even, and
f = [0, 1, …, (n-1)/2, -(n-1)/2, …, -1] * sample_rate / n
if n is odd.
For real time-domain data,
numpy.fft.rfftfreq
is used, which returnsf = [0, 1, …, n/2-1, n/2] * sample_rate / n
if n is even, and
f = [0, 1, …, (n-1)/2-1, (n-1)/2] * sample_rate / n
if n is odd.
If
sample_rate
isNone
, a unitless rate of 1 is used.
- frequency_dtype¶
Data type of the frequency-domain data.
- frequency_shape¶
Shape of the frequency-domain data.
- ortho¶
Use orthogonal normalization.
If
True
, both forward and backward transforms are scaled by 1 / sqrt(n), where n is the size of time-domain array’s transform axis. IfFalse
, forward transforms are unscaled and inverse ones scaled by 1 / n.
- sample_rate¶
Rate of samples in the time domain.
- time_dtype¶
Data type of the time-domain data.
- time_shape¶
Shape of the time-domain data.
Methods Documentation
- __call__(a) [edit on github]¶
Perform FFT.
To display the direction of the transform and shapes and dtypes of the arrays, use
print
orrepr
.- Parameters:
- aarray_like
Input data.
- Returns:
- out
ndarray
Transformed data.
- out
- inverse() [edit on github]¶
Return inverse transform.
If the type of fourier transform allows it (e.g., PyFFTW), the inverse transform will have its input array matched to the output array and vice versa, i.e., a sequence transforming some input data, do in-place calculations on the output fourier spectrum, and then transform back, will overwrite the input data. If this is not wanted, instantiate a new class directly (e.g.,
forward.__class__(direction='backward')
.- Returns:
- inverse_transform
FFTBase
subclass Returns a new instance of the calling class with reversed transform direction.
- inverse_transform