import dascore as dc
= dc.get_example_patch()
patch # perform dft (fft) on time axis
= patch.dft(dim="time")
dft_time # make it a real fft (no negative frequencies)
= patch.dft(dim="time", real=True)
dft_time_real # dft on specified dimensions, specify real dimension
= patch.dft(dim=("time", "distance"), real="time") dft_some_real
dft
dft(
patch: Patch ,
dim: str | None | collections.abc.Sequence[str, None, collections.abc.Sequence[str]] ,
real: str | bool | None[str, bool, None] = None,
pad: bool = True,
)-> ‘PatchType’
Perform the discrete Fourier transform (dft) on specified dimension(s).
Parameters
Parameter | Description |
---|---|
patch | Patch to transform. |
dim |
A single, or multiple dimensions over which to perform dft. If None, perform dft over all dimensions. |
real |
Either 1) The name of the axis over which to perform a rfft, 2) True, which means the last (possibly only) dimenson should have an rfft performed, or 3) None, meaning no rfft. |
pad |
If True, pad patch before peforming dft along desired dimensions to the next fast length. This can avoid major slow-downs when dimension lengths are prime numbers. |
Simply uses numpy’s fft module but outputs are scaled by the sample spacing along each transformed dimension and coordinates corresponding to frequency bins are shifted so they remain ordered.
Each transformed dimension is renamed with a preceding
ft_
. e.g.,time
becomesft_time
(ft stands for fourier transform).Each transformed dimension has units of 1/original units.
Output data units are the original data units multiplied by the units of each transformed dimension.
Non-dimensional coordiantes associated with transformed coordinates will be dropped in the output.
See the FFT notes for more details.
See Also
-idft