Metadata-Version: 2.5
Name: fourierror
Version: 0.0.2
Summary: Propagation of uncertainty through a Fourier transform
Project-URL: homepage, https://github.com/scams-research/fourierror
Author-email: "Andrew R. McCluskey" <andrew.mccluskey@bristol.ac.uk>, Tuguldur Zolzaya <tuguldur.zolzaya@balliol.ox.ac.uk>
Maintainer-email: "Andrew R. McCluskey" <andrew.mccluskey@bristol.ac.uk>
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: numpy>=2.0.0
Requires-Dist: scipp>=24.8.0
Requires-Dist: scipy>=1.9.3
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Provides-Extra: docs
Requires-Dist: ipykernel; extra == 'docs'
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: nbsphinx; extra == 'docs'
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
Description-Content-Type: text/markdown

# fourierror: Uncertainty Propagation Through Fourier Transforms

[![PyPI version](https://badge.fury.io/py/fourierror.svg)](https://badge.fury.io/py/fourierror)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/scams-research/fourierror)

*Real measurements come with uncertainties. Fourier transforms of real measurements should too.*

`fourierror` propagates uncertainty through the discrete Fourier transform, giving you variances on the real and imaginary components of the result rather than a bare complex spectrum. 
Two routes are available: an **analytical** propagation and a **numerical** sampling approach.

The package is built on [`scipp`](https://scipp.github.io), so units and coordinates are carried through the transform — the correct "frequency" axis is derived for you from the coordinate you transform over, rather than left as bare array indices.

```python
import fourierror

result = fourierror.analytical.dft(data, coord="time")
result["real"], result["imaginary"]   # values and variances
```

`data` is a `scipp.DataArray` with variances; the result is a `scipp.Dataset` on a frequency axis. 
If you're new to scipp, the [getting started guide](https://scipp.github.io/getting-started/index.html) is a good first stop.

A publication describing the propagation scheme — and guidance on when to prefer the numerical or analytical method — is in preparation.