fourierror.utility#

Helpers shared by the analytical and numerical transforms.

fourierror.utility.validate_input(data, coord)#

Check that data and coord are valid input for a Fourier transform.

Parameters:
  • data (DataArray) – The data to be Fourier transformed.

  • coord (str) – The coordinate to compute the Fourier transform over.

Raises:

ValueError – If data is not one-dimensional, if it has neither variances nor a covariance (i.e. it is not a CovDataArray), or if coord is not a coordinate along the dimension of data.

Return type:

None

fourierror.utility.is_diagonal(A, tol=1e-12)#

Check whether a matrix is diagonal to within a tolerance.

Parameters:
  • A – The matrix to check, as anything numpy.asarray accepts.

  • tol – Absolute tolerance on the off-diagonal elements. Optional, defaults to 1e-12.

Return type:

bool

Returns:

True if every off-diagonal element is within tol of zero.

fourierror.utility.construct_output(x_real, x_imag, var_real, var_imag, freq, diag_tol=1e-12)#

Assemble the real and imaginary parts of a transform into a DataGroup.

Each part is returned as a plain scipp.DataArray with variances if its covariance matrix is diagonal (within diag_tol), and as a CovDataArray carrying the full covariance otherwise.

Parameters:
  • x_real – Values of the real part.

  • x_imag – Values of the imaginary part.

  • var_real – Covariance matrix of the real part.

  • var_imag – Covariance matrix of the imaginary part.

  • freq – Frequency coordinate, with dimension omega.

  • diag_tol – Tolerance used to decide if a covariance matrix is diagonal. Optional, defaults to 1e-12.

Return type:

DataGroup

Returns:

A scipp DataGroup with real and imag entries.