fourierror.analytical#
Analytical propagation of uncertainty through the discrete Fourier transform.
The covariance of the real and imaginary parts of the transform is computed
exactly by linear propagation, J C J^T, where J is the (linear) DFT
matrix and C the covariance of the input.
- fourierror.analytical.dft(data, coord, diag_tol=1e-12)#
Perform a discrete Fourier transform with analytical uncertainty propagation.
- Parameters:
data (
DataArray) – A one-dimensional scipp DataArray with variances, holding the data to be Fourier transformed. Its variances are taken as uncorrelated, unless it is aCovDataArray, whose full covariance is used.coord (
str) – The coordinate to compute the Fourier transform over. It must be evenly spaced; aTypeErroris raised otherwise.diag_tol (
float) – Tolerance used to decide if the output covariance matrices are diagonal. Optional, defaults to 1e-12.
- Raises:
ValueError – If
datais not one-dimensional, has no variances and is not aCovDataArray, orcoordis not a coordinate along the dimension ofdata.- Return type:
- Returns:
A scipp DataGroup with
realandimagentries for the Fourier transformed result,(2 / n) * numpy.fft.fft(values), on anomegaaxis of angular frequencies (seefrequencies()). Each entry is aCovDataArrayif its covariance is not diagonal, otherwise a plainscipp.DataArray.
- fourierror.analytical.fft(data, coord, diag_tol=1e-12)#
Perform a fast Fourier transform with analytical uncertainty propagation.
Equivalent to
dft(), but uses FFTs for both the values and the covariance, so scales better with the number of points.- Parameters:
data (
DataArray) – A one-dimensional scipp DataArray with variances, holding the data to be Fourier transformed. Its variances are taken as uncorrelated, unless it is aCovDataArray, whose full covariance is used.coord (
str) – The coordinate to compute the Fourier transform over. It must be evenly spaced; aTypeErroris raised otherwise.diag_tol (
float) – Tolerance used to decide if the output covariance matrices are diagonal. Optional, defaults to 1e-12.
- Raises:
ValueError – If
datais not one-dimensional, has no variances and is not aCovDataArray, orcoordis not a coordinate along the dimension ofdata.- Return type:
- Returns:
A scipp DataGroup with
realandimagentries for the Fourier transformed result,(2 / n) * numpy.fft.fft(values), on anomegaaxis of angular frequencies (seefrequencies()). Each entry is aCovDataArrayif its covariance is not diagonal, otherwise a plainscipp.DataArray.