Numerical accuracy
The filter computes in complex64 and reports one peak per bin. A float64 numpy correlation of the same inputs is the answer it has to agree with. This sweeps injected SNR from pure noise to 1000 and measures the disagreement -- run while this page was built, not cached.
2.8e-07
worst relative error, any point
4.8
float32 ULPs at worst
100%
lowest index agreement
statistic
The distribution is a single pile a few float32 epsilons wide with no tail. That is the claim the percentiles above cannot make on their own: a median of 5e-8 is consistent with a tight pile or with a narrow core plus occasional large errors, and those are different statements about the arithmetic.
What is being compared
| Reference | The whole correlation in float64: |IFFT(data * conj(template))| * n, computed by numpy on the identical inputs. |
|---|---|
| Error | The reported magnitude against that reference evaluated at the lag the filter reported. That isolates arithmetic from tie-breaking: comparing peak magnitudes instead would blame the filter whenever two nearby lags swapped places. |
| Index agreement | Separately, how often the reported lag is the float64 argmax. Where two lags sit within rounding of each other either is a correct answer, so this is reported rather than asserted -- but over random noise exact ties are vanishingly unlikely, and it is 100%% here. |
| Input | Complex Gaussian noise with one copy of the template injected at a random lag, as a phase ramp on the spectrum -- exactly a circular shift, so the signal lands where intended with no resampling error of its own. 192 trials per point. |
The curves are flat in SNR, and that is the result. A relative error that tracked the signal would mean something was computed absolutely and then divided -- invisible on noise, and growing on exactly the loud events a search most needs to get right. Injected SNR spans 0 to 1000 here, so a proportional term would show as three orders of magnitude of growth. tests/test_precision.py asserts both this and the absolute bound.
All numbers (40 rows)
| n | injected snr | trials | median | p90 | worst | ULPs at worst | index agreement |
|---|---|---|---|---|---|---|---|
| 1024 | 0 | 192 | 5.67e-08 | 1.20e-07 | 1.84e-07 | 3.1 | 100% |
| 1024 | 4 | 192 | 5.59e-08 | 1.33e-07 | 1.92e-07 | 3.2 | 100% |
| 1024 | 5 | 192 | 5.22e-08 | 1.22e-07 | 2.33e-07 | 3.9 | 100% |
| 1024 | 6 | 192 | 5.02e-08 | 1.20e-07 | 1.84e-07 | 3.1 | 100% |
| 1024 | 8 | 192 | 6.18e-08 | 1.18e-07 | 2.14e-07 | 3.6 | 100% |
| 1024 | 12 | 192 | 5.87e-08 | 1.37e-07 | 1.90e-07 | 3.2 | 100% |
| 1024 | 20 | 192 | 5.58e-08 | 1.41e-07 | 2.48e-07 | 4.2 | 100% |
| 1024 | 50 | 192 | 5.50e-08 | 1.23e-07 | 1.90e-07 | 3.2 | 100% |
| 1024 | 200 | 192 | 6.96e-08 | 1.44e-07 | 2.23e-07 | 3.7 | 100% |
| 1024 | 1000 | 192 | 7.17e-08 | 1.33e-07 | 2.11e-07 | 3.5 | 100% |
| 4096 | 0 | 192 | 5.35e-08 | 1.32e-07 | 2.16e-07 | 3.6 | 100% |
| 4096 | 4 | 192 | 4.81e-08 | 1.25e-07 | 2.36e-07 | 4.0 | 100% |
| 4096 | 5 | 192 | 6.03e-08 | 1.19e-07 | 1.59e-07 | 2.7 | 100% |
| 4096 | 6 | 192 | 5.32e-08 | 1.23e-07 | 2.33e-07 | 3.9 | 100% |
| 4096 | 8 | 192 | 5.97e-08 | 1.38e-07 | 2.08e-07 | 3.5 | 100% |
| 4096 | 12 | 192 | 5.15e-08 | 1.22e-07 | 1.62e-07 | 2.7 | 100% |
| 4096 | 20 | 192 | 6.03e-08 | 1.36e-07 | 2.83e-07 | 4.8 | 100% |
| 4096 | 50 | 192 | 6.98e-08 | 1.44e-07 | 2.39e-07 | 4.0 | 100% |
| 4096 | 200 | 192 | 6.40e-08 | 1.47e-07 | 2.11e-07 | 3.5 | 100% |
| 4096 | 1000 | 192 | 6.67e-08 | 1.22e-07 | 1.80e-07 | 3.0 | 100% |
| 16384 | 0 | 192 | 5.29e-08 | 1.27e-07 | 2.08e-07 | 3.5 | 100% |
| 16384 | 4 | 192 | 6.05e-08 | 1.47e-07 | 2.76e-07 | 4.6 | 100% |
| 16384 | 5 | 192 | 5.94e-08 | 1.27e-07 | 2.52e-07 | 4.2 | 100% |
| 16384 | 6 | 192 | 5.68e-08 | 1.39e-07 | 2.29e-07 | 3.8 | 100% |
| 16384 | 8 | 192 | 5.20e-08 | 1.33e-07 | 2.06e-07 | 3.5 | 100% |
| 16384 | 12 | 192 | 5.69e-08 | 1.25e-07 | 1.95e-07 | 3.3 | 100% |
| 16384 | 20 | 192 | 6.02e-08 | 1.50e-07 | 2.17e-07 | 3.6 | 100% |
| 16384 | 50 | 192 | 6.46e-08 | 1.35e-07 | 2.21e-07 | 3.7 | 100% |
| 16384 | 200 | 192 | 8.57e-08 | 1.59e-07 | 2.10e-07 | 3.5 | 100% |
| 16384 | 1000 | 192 | 7.26e-08 | 1.39e-07 | 1.91e-07 | 3.2 | 100% |
| 65536 | 0 | 192 | 6.10e-08 | 1.47e-07 | 2.18e-07 | 3.7 | 100% |
| 65536 | 4 | 192 | 7.42e-08 | 1.56e-07 | 2.25e-07 | 3.8 | 100% |
| 65536 | 5 | 192 | 7.47e-08 | 1.55e-07 | 2.58e-07 | 4.3 | 100% |
| 65536 | 6 | 192 | 7.05e-08 | 1.67e-07 | 2.48e-07 | 4.2 | 100% |
| 65536 | 8 | 192 | 6.61e-08 | 1.53e-07 | 2.24e-07 | 3.8 | 100% |
| 65536 | 12 | 192 | 7.38e-08 | 1.51e-07 | 2.26e-07 | 3.8 | 100% |
| 65536 | 20 | 192 | 8.63e-08 | 1.79e-07 | 2.35e-07 | 3.9 | 100% |
| 65536 | 50 | 192 | 9.13e-08 | 1.65e-07 | 2.44e-07 | 4.1 | 100% |
| 65536 | 200 | 192 | 9.55e-08 | 1.76e-07 | 2.82e-07 | 4.7 | 100% |
| 65536 | 1000 | 192 | 9.87e-08 | 1.61e-07 | 2.32e-07 | 3.9 | 100% |