diff --git a/src/mrinufft/operators/base.py b/src/mrinufft/operators/base.py index f66c2012..6fbbb73c 100644 --- a/src/mrinufft/operators/base.py +++ b/src/mrinufft/operators/base.py @@ -329,7 +329,7 @@ def compute_density(self, method=None): shape, **kwargs, ) - self._density = method(self.samples, self.shape, **kwargs) + self.density = method(self.samples, self.shape, **kwargs) def get_lipschitz_cst(self, max_iter=10, **kwargs): """Return the Lipschitz constant of the operator. diff --git a/src/mrinufft/operators/interfaces/gpunufft.py b/src/mrinufft/operators/interfaces/gpunufft.py index 57371299..fcaae3e9 100644 --- a/src/mrinufft/operators/interfaces/gpunufft.py +++ b/src/mrinufft/operators/interfaces/gpunufft.py @@ -561,10 +561,11 @@ def density(self, density): The density for the Fourier Operator. """ self._density = density - self.raw_op.set_pts( - self._samples, - density=density, - ) + if hasattr(self, "raw_op"): # edge case for init + self.raw_op.set_pts( + self._samples, + density=density, + ) @classmethod def pipe( @@ -593,7 +594,7 @@ def pipe( """ if GPUNUFFT_AVAILABLE is False: raise ValueError( - "gpuNUFFT is not available, cannot " "estimate the density compensation" + "gpuNUFFT is not available, cannot estimate the density compensation" ) original_shape = volume_shape volume_shape = (np.array(volume_shape) * osf).astype(int)