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 a CovDataArray, whose full covariance is used.

  • coord (str) – The coordinate to compute the Fourier transform over. It must be evenly spaced; a TypeError is raised otherwise.

  • diag_tol (float) – Tolerance used to decide if the output covariance matrices are diagonal. Optional, defaults to 1e-12.

Raises:

ValueError – If data is not one-dimensional, has no variances and is not a CovDataArray, or coord is not a coordinate along the dimension of data.

Return type:

DataGroup

Returns:

A scipp DataGroup with real and imag entries for the Fourier transformed result, (2 / n) * numpy.fft.fft(values), on an omega axis of angular frequencies (see frequencies()). Each entry is a CovDataArray if its covariance is not diagonal, otherwise a plain scipp.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 a CovDataArray, whose full covariance is used.

  • coord (str) – The coordinate to compute the Fourier transform over. It must be evenly spaced; a TypeError is raised otherwise.

  • diag_tol (float) – Tolerance used to decide if the output covariance matrices are diagonal. Optional, defaults to 1e-12.

Raises:

ValueError – If data is not one-dimensional, has no variances and is not a CovDataArray, or coord is not a coordinate along the dimension of data.

Return type:

DataGroup

Returns:

A scipp DataGroup with real and imag entries for the Fourier transformed result, (2 / n) * numpy.fft.fft(values), on an omega axis of angular frequencies (see frequencies()). Each entry is a CovDataArray if its covariance is not diagonal, otherwise a plain scipp.DataArray.