Skip to content

Commit

Permalink
Merge pull request #1668 from leftaroundabout/regression/pyfftw-0.13-…
Browse files Browse the repository at this point in the history
…normalisation-convention

Fix Fourier normalisation that was changed by PyFFTW-0.13
  • Loading branch information
leftaroundabout authored Dec 7, 2024
2 parents 9b93c01 + 53499de commit aa9e55c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion odl/trafos/backends/pyfftw_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ def pyfftw_call(array_in, array_out, direction='forward', axes=None,
else:
fftw_plan = fftw_plan_in

fftw_plan(array_in, array_out, normalise_idft=normalise_idft)
if not normalise_idft and direction=='forward':
fftw_plan(array_in, array_out, normalise_idft=True)
else:
fftw_plan(array_in, array_out, normalise_idft=normalise_idft)

if wexport:
try:
Expand Down
3 changes: 2 additions & 1 deletion odl/trafos/fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,8 @@ def _call_pyfftw(self, x, out, **kwargs):
halfcomplex=self.halfcomplex, planning_effort=effort,
fftw_plan=self._fftw_plan, normalise_idft=True)

# Need to normalize for 'forward', no way to force pyfftw
# Need to normalize for 'forward', pyfftw before version 0.13
# does not offer a way to do this.
if self.sign == '-':
out /= np.prod(np.take(self.domain.shape, self.axes))

Expand Down

0 comments on commit aa9e55c

Please sign in to comment.