diff --git a/src/sleplet/meshes/_mesh_slepian_decomposition.py b/src/sleplet/meshes/_mesh_slepian_decomposition.py index 0bace0232..80ae12644 100644 --- a/src/sleplet/meshes/_mesh_slepian_decomposition.py +++ b/src/sleplet/meshes/_mesh_slepian_decomposition.py @@ -92,15 +92,16 @@ def _harmonic_sum(self, rank: int) -> float: def _detect_method(self) -> None: """Detects what method is used to perform the decomposition.""" - if isinstance(self.u_i, np.ndarray): + if self.u_i is not None: _logger.info("harmonic sum method selected") self.method = "harmonic_sum" - elif isinstance(self.u, np.ndarray) and not self.mask: - _logger.info("integrating the whole mesh method selected") - self.method = "integrate_mesh" - elif isinstance(self.u, np.ndarray): - _logger.info("integrating a region on the mesh method selected") - self.method = "integrate_region" + elif self.u is not None: + if self.mask: + _logger.info("integrating a region on the mesh method selected") + self.method = "integrate_region" + else: + _logger.info("integrating the whole mesh method selected") + self.method = "integrate_mesh" else: raise RuntimeError( "need to pass one off harmonic coefficients, real pixels " diff --git a/src/sleplet/slepian/_slepian_decomposition.py b/src/sleplet/slepian/_slepian_decomposition.py index 518382f11..223a8e72c 100644 --- a/src/sleplet/slepian/_slepian_decomposition.py +++ b/src/sleplet/slepian/_slepian_decomposition.py @@ -98,15 +98,16 @@ def _harmonic_sum(self, rank: int) -> complex: def _detect_method(self) -> None: """Detects what method is used to perform the decomposition.""" - if isinstance(self.flm, np.ndarray): + if self.flm is not None: _logger.info("harmonic sum method selected") self.method = "harmonic_sum" - elif isinstance(self.f, np.ndarray) and not isinstance(self.mask, np.ndarray): - _logger.info("integrating the whole sphere method selected") - self.method = "integrate_sphere" - elif isinstance(self.f, np.ndarray): - _logger.info("integrating a region on the sphere method selected") - self.method = "integrate_region" + elif self.f is not None: + if self.mask is None: + _logger.info("integrating the whole sphere method selected") + self.method = "integrate_sphere" + else: + _logger.info("integrating a region on the sphere method selected") + self.method = "integrate_region" else: raise RuntimeError( "need to pass one off harmonic coefficients, real pixels "