From 95da02d93d807d28d8ffb64468ffc11be3a5c904 Mon Sep 17 00:00:00 2001 From: Metin San Date: Wed, 18 Aug 2021 15:41:13 +0200 Subject: [PATCH] Small refactoring changes --- zodipy/simulation.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zodipy/simulation.py b/zodipy/simulation.py index fa913c2..00a49d6 100644 --- a/zodipy/simulation.py +++ b/zodipy/simulation.py @@ -112,10 +112,12 @@ def simulate(self, nside: int, freq: float, solar_cut: float) -> np.ndarray: components = self.model.components emissivities = self.model.emissivities - # The total emission is initialized as NANs representing unobserved pixels + # Unobserved pixels are represented as NANs emission = np.zeros((n_observations, len(components), npix)) + np.NAN - for observation_idx, (observer_pos, earth_pos) in enumerate(zip(X_observer, X_earth)): + for observation_idx, (observer_pos, earth_pos) in enumerate( + zip(X_observer, X_earth) + ): if solar_cut is None: observed_pixels = pixels else: @@ -136,7 +138,9 @@ def simulate(self, nside: int, freq: float, solar_cut: float) -> np.ndarray: comp_emissivity = emissivities.get_emissivity(comp_name, freq) integrated_comp_emission *= comp_emissivity - emission[observation_idx, comp_idx, observed_pixels] = integrated_comp_emission + emission[observation_idx, comp_idx, observed_pixels] = ( + integrated_comp_emission + ) with warnings.catch_warnings(): # np.nanmean throws a RuntimeWarning if all pixels along an