fourierror.numerical#

Monte Carlo propagation of uncertainty through the discrete Fourier transform.

Samples are drawn from a multivariate normal distribution described by the input values and covariance, each sample is transformed, and the mean and covariance of the transformed samples are returned.

fourierror.numerical.dft(data, coord, n_samples=5000, random_state=None, diag_tol=1e-12)#

Perform a numerical discrete Fourier transform.

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.

  • n_samples (int) – Number of samples to use to obtain numerical solution. Optional, defaults to 5000.

  • random_state (None | int | Generator) – Seed or generator passed to the random sampler, to enable reproducibility. Optional, defaults to None.

  • 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 holding the sample mean and covariance of (2 / n) * numpy.fft.fft of the samples, 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.numerical.fft(data, coord, n_samples=5000, random_state=None, diag_tol=1e-12)#

Perform a numerical fast Fourier transform.

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 fast Fourier transform over. It must be evenly spaced; a TypeError is raised otherwise.

  • n_samples (int) – Number of samples to use to obtain numerical solution. Optional, defaults to 5000.

  • random_state (None | int | Generator) – Seed or generator passed to the random sampler, to enable reproducibility. Optional, defaults to None.

  • 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 holding the sample mean and covariance of (2 / n) * numpy.fft.fft of the samples, 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.