From ce4b83da432b03b7e7d95663653d3b701daaf81d Mon Sep 17 00:00:00 2001 From: mrava87 Date: Fri, 4 Oct 2024 21:04:41 +0300 Subject: [PATCH 1/2] bug: fix chirpradon3d pyfftw import Remove any direct access to pyfftw and instead use pyfftw_message to check if the library is installed and correctly imported. --- pylops/signalprocessing/chirpradon3d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pylops/signalprocessing/chirpradon3d.py b/pylops/signalprocessing/chirpradon3d.py index 1f544926..f1153ce5 100755 --- a/pylops/signalprocessing/chirpradon3d.py +++ b/pylops/signalprocessing/chirpradon3d.py @@ -101,7 +101,7 @@ def __init__( @reshaped def _matvec(self, x: NDArray) -> NDArray: - if self.engine == "fftw" and pyfftw is not None: + if self.engine == "fftw" and pyfftw_message is None: return _chirp_radon_3d_fftw( x, self.dt, self.dy, self.dx, self.pmax, mode="f", **self.kwargs_fftw ) @@ -109,7 +109,7 @@ def _matvec(self, x: NDArray) -> NDArray: @reshaped def _rmatvec(self, x: NDArray) -> NDArray: - if self.engine == "fftw" and pyfftw is not None: + if self.engine == "fftw" and pyfftw_message is None: return _chirp_radon_3d_fftw( x, self.dt, self.dy, self.dx, self.pmax, mode="a", **self.kwargs_fftw ) @@ -117,7 +117,7 @@ def _rmatvec(self, x: NDArray) -> NDArray: def inverse(self, x: NDArray) -> NDArray: x = x.reshape(self.dimsd) - if self.engine == "fftw" and pyfftw is not None: + if self.engine == "fftw" and pyfftw_message is None: y = _chirp_radon_3d_fftw( x, self.dt, self.dy, self.dx, self.pmax, mode="i", **self.kwargs_fftw ) From eb204dfa39d827eecbcb0b1af49ecea4f189fb4d Mon Sep 17 00:00:00 2001 From: mrava87 Date: Fri, 4 Oct 2024 21:10:07 +0300 Subject: [PATCH 2/2] minor: remove unused import of pyfftw --- pylops/signalprocessing/chirpradon3d.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pylops/signalprocessing/chirpradon3d.py b/pylops/signalprocessing/chirpradon3d.py index f1153ce5..193d41be 100755 --- a/pylops/signalprocessing/chirpradon3d.py +++ b/pylops/signalprocessing/chirpradon3d.py @@ -14,8 +14,6 @@ pyfftw_message = deps.pyfftw_import("the chirpradon3d module") if pyfftw_message is None: - import pyfftw - from ._chirpradon3d import _chirp_radon_3d_fftw logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.WARNING)