fourierror.utility#
Helpers shared by the analytical and numerical transforms.
- fourierror.utility.validate_input(data, coord)#
Check that
dataandcoordare 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
datais not one-dimensional, if it has neither variances nor a covariance (i.e. it is not aCovDataArray), or ifcoordis not a coordinate along the dimension ofdata.- 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.asarrayaccepts.tol – Absolute tolerance on the off-diagonal elements. Optional, defaults to 1e-12.
- Return type:
bool- Returns:
Trueif every off-diagonal element is withintolof 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.DataArraywith variances if its covariance matrix is diagonal (withindiag_tol), and as aCovDataArraycarrying 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:
- Returns:
A scipp DataGroup with
realandimagentries.