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+1frequency bins. No scaling is applied to the output, i.e., it has the same normalization asnumpy.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 fromuwacan.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:
If
time_datais aTimeData, returns aFrequencyDataobject.If
time_datais anxarray.DataArray, returns anxarray.DataArraywith a ‘frequency’ dimension.If
time_datais anumpy.ndarray, returns a NumPy array containing the fft data.