uwacan.spectral.fft#

fft(time_data, nfft=None)[source]#

Compute the fft of a time signal.

This computes the single-sided fft of the input data, intended to go from real time data to frequency data. The output array has nfft//2+1 frequency bins. No scaling is applied to the output, i.e., it has the same normalization as numpy.fft.rfft.

Parameters:
time_data_core.TimeData or xr.DataArray or numpy.ndarray

The input time-domain data to compute the spectrum for. The data can be one of the following:

  • TimeData: Wrapped time data from uwacan.

  • xarray.DataArray: An xarray DataArray with a ‘time’ dimension.

  • numpy.ndarray: A NumPy array containing time-series data. The fft will be over the last axis.

nfftint, optional

The number of bins to use for the fft. Defaults to the length of the time signal.

Returns:
_core.FrequencyData or xr.DataArray or numpy.ndarray

The computed single-sided fft of the input data. The return type matches the input type: