dft

function of dascore.transform.fourier source

dft(
    patch: Patch ,
    dim: str | None | collections.abc.Sequence[str, None, collections.abc.Sequence[str]] ,
    real: str | bool | None[str, bool, None] = None,
)-> ‘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.
Note
  • 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 becomes ft_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 note in the Notes section of DASCore’s documentation for more details.

See Also

-idft

Examples

import dascore as dc
patch = dc.get_example_patch()
# perform dft (fft) on time axis
dft_time = patch.dft(dim="time")
# make it a real fft (no negative frequencies)
dft_time_real = patch.dft(dim="time", real=True)
# dft on specified dimensions, specify real dimension
dft_some_real = patch.dft(dim=("time", "distance"), real="time")