Skip to content

Commit

Permalink
Small refactoring changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MetinSa committed Aug 18, 2021
1 parent 44b7ab0 commit 95da02d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions zodipy/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 95da02d

Please sign in to comment.