Change FFT normalization to exactly satisfy Parseval's Theorem #654
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As briefly mentioned in #653, the NuRadioMC convention for the real DFT (rfft) does not actually satisfy Parseval's theorem exactly. We multiply all frequency components by$\sqrt{2}$ ; however, the 0-frequency and (for even-length traces) the maximum frequency occur only once in the full frequency spectrum (including negative frequencies). For 'reasonable' numbers of samples and traces this effect is pretty small, but we may want to do this correctly.
This PR changes the FFT routines in
NuRadioReco.utilities.fft
to exactly satisfy Parseval's Theorem, i.e.This will probably break the unit tests, and more importantly, we use frequency-domain parameterizations for e.g. our askaryan models, so if we decide to implement this some more work is needed.
MWE in case anyone wants to verify that Parseval's Theorem is not satisfied with the current normalization: