diff --git a/heracles/maps.py b/heracles/maps.py index 81f7d7e..b3549b5 100644 --- a/heracles/maps.py +++ b/heracles/maps.py @@ -399,9 +399,10 @@ def mapper(page: "CatalogPage") -> None: _map_real(wht, val, ipix, w, v) - ngal += page.size - wmean += (w - wmean).sum() / ngal - var += ((w * v) ** 2 - var).sum() / ngal + if page.size: + ngal += page.size + wmean += (w - wmean).sum() / ngal + var += ((w * v) ** 2 - var).sum() / ngal # the mapper function is yield-ed to be applied over the catalogue yield mapper @@ -552,9 +553,10 @@ def mapper(page: "CatalogPage") -> None: _map_complex(wht, val, ipix, w, re, im) - ngal += page.size - wmean += (w - wmean).sum() / ngal - var += ((w * re) ** 2 + (w * im) ** 2 - var).sum() / ngal + if page.size: + ngal += page.size + wmean += (w - wmean).sum() / ngal + var += ((w * re) ** 2 + (w * im) ** 2 - var).sum() / ngal # the mapper function is yield-ed to be applied over the catalogue yield mapper