diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index 7483bce..00f1966 100644 --- a/heracles/catalog/filters.py +++ b/heracles/catalog/filters.py @@ -60,7 +60,10 @@ def __call__(self, page): class FootprintFilter: - """Filter a catalogue using a footprint map.""" + """Filter a catalogue using a footprint map. + This rempoves the pixels that are not in the footprint map. + Moreover, it removes the pixels which have NaN values in the + longitude and latitude columns.""" def __init__(self, footprint, lon, lat): """Filter using the given footprint map and position columns.""" @@ -91,6 +94,9 @@ def __call__(self, page): from healpy import ang2pix lon, lat = self._lonlat - ipix = ang2pix(self._nside, page[lon], page[lat], lonlat=True) + _lon, _lat = page[lon], page[lat] + good_entry = np.isfinite(_lon) & np.isfinite(_lat) + _lon, _lat = _lon[good_entry], _lat[good_entry] + ipix = ang2pix(self._nside, _lon, _lat, lonlat=True) exclude = np.where(self._footprint[ipix] == 0)[0] page.delete(exclude)