From 504426774146b209ea7fb2f67133022a04748dbb Mon Sep 17 00:00:00 2001 From: Lena OUDJMAN Date: Wed, 12 Jun 2024 16:15:07 +0200 Subject: [PATCH] add case method == true --- src/mrinufft/operators/base.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mrinufft/operators/base.py b/src/mrinufft/operators/base.py index 35508e92..08b5eefb 100644 --- a/src/mrinufft/operators/base.py +++ b/src/mrinufft/operators/base.py @@ -332,20 +332,24 @@ def compute_density(self, method=None): Parameters ---------- - method: str or callable or array or dict + method: str or callable or array or dict or bool The method to use to compute the density compensation. If a string, the method should be registered in the density registry. If a callable, it should take the samples and the shape as input. If a dict, it should have a key 'name', to determine which method to use. other items will be used as kwargs. If an array, it should be of shape (Nsamples,) and will be used as is. + If a bool, it will enable or disable the density compensation. """ - if isinstance(method, np.ndarray): - self.density = method - return None if not method: self.density = None return None + if method is True and hasattr(self, "pipe"): + method = "pipe" + + if isinstance(method, np.ndarray): + self.density = method + return None kwargs = {} if isinstance(method, dict):