From 67a918f682c626f57e58a65ec82898a482e272ff Mon Sep 17 00:00:00 2001 From: jaimerzp Date: Tue, 1 Oct 2024 13:01:11 +0300 Subject: [PATCH 1/6] first commit --- heracles/catalog/filters.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index 7483bce..11aff14 100644 --- a/heracles/catalog/filters.py +++ b/heracles/catalog/filters.py @@ -91,6 +91,8 @@ def __call__(self, page): from healpy import ang2pix lon, lat = self._lonlat + good_entry = np.isfiniten(lon) & np.isfinite(lat) + lon, lat = lon[good_entry], lat[good_entry] ipix = ang2pix(self._nside, page[lon], page[lat], lonlat=True) exclude = np.where(self._footprint[ipix] == 0)[0] page.delete(exclude) From 5669e3e1ba7dc28d9a1bcce3b878acaffa20a4b7 Mon Sep 17 00:00:00 2001 From: jaimerzp Date: Tue, 1 Oct 2024 15:20:11 +0300 Subject: [PATCH 2/6] bug --- heracles/catalog/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index 11aff14..0ba5ce4 100644 --- a/heracles/catalog/filters.py +++ b/heracles/catalog/filters.py @@ -91,7 +91,7 @@ def __call__(self, page): from healpy import ang2pix lon, lat = self._lonlat - good_entry = np.isfiniten(lon) & np.isfinite(lat) + good_entry = np.isfinite(lon) & np.isfinite(lat) lon, lat = lon[good_entry], lat[good_entry] ipix = ang2pix(self._nside, page[lon], page[lat], lonlat=True) exclude = np.where(self._footprint[ipix] == 0)[0] From 9c898cf749ce74d66d307ac816b153bda442c415 Mon Sep 17 00:00:00 2001 From: jaimerzp Date: Tue, 1 Oct 2024 15:43:03 +0300 Subject: [PATCH 3/6] lon/lat --> page[lon]/page[lat] --- heracles/catalog/filters.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index 0ba5ce4..5169541 100644 --- a/heracles/catalog/filters.py +++ b/heracles/catalog/filters.py @@ -91,8 +91,9 @@ def __call__(self, page): from healpy import ang2pix lon, lat = self._lonlat - good_entry = np.isfinite(lon) & np.isfinite(lat) - lon, lat = lon[good_entry], lat[good_entry] - 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) From 49b471343a894ad557bfdc5306ad4b47849adf0c Mon Sep 17 00:00:00 2001 From: jaimerzp Date: Tue, 1 Oct 2024 16:31:30 +0300 Subject: [PATCH 4/6] exlcude --- heracles/catalog/filters.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index 5169541..c1e6dbb 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.""" @@ -94,6 +97,7 @@ def __call__(self, page): _lon, _lat = page[lon], page[lat] good_entry = np.isfinite(_lon) & np.isfinite(_lat) _lon, _lat = _lon[good_entry], _lat[good_entry] + page.delete(np.where(~good_entry)[0]) ipix = ang2pix(self._nside, _lon, _lat, lonlat=True) exclude = np.where(self._footprint[ipix] == 0)[0] page.delete(exclude) From cfe1557209e94324c29979d77a2c1464fedafa6a Mon Sep 17 00:00:00 2001 From: jaimerzp Date: Tue, 1 Oct 2024 16:40:16 +0300 Subject: [PATCH 5/6] format --- heracles/catalog/filters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index c1e6dbb..cddafac 100644 --- a/heracles/catalog/filters.py +++ b/heracles/catalog/filters.py @@ -61,9 +61,9 @@ def __call__(self, page): class FootprintFilter: """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.""" + 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.""" From 301cd0f3af06ebf45be30287bb768c160c2c0b71 Mon Sep 17 00:00:00 2001 From: jaimerzp Date: Wed, 2 Oct 2024 11:53:49 +0300 Subject: [PATCH 6/6] Nicolas comment --- heracles/catalog/filters.py | 1 - 1 file changed, 1 deletion(-) diff --git a/heracles/catalog/filters.py b/heracles/catalog/filters.py index cddafac..00f1966 100644 --- a/heracles/catalog/filters.py +++ b/heracles/catalog/filters.py @@ -97,7 +97,6 @@ def __call__(self, page): _lon, _lat = page[lon], page[lat] good_entry = np.isfinite(_lon) & np.isfinite(_lat) _lon, _lat = _lon[good_entry], _lat[good_entry] - page.delete(np.where(~good_entry)[0]) ipix = ang2pix(self._nside, _lon, _lat, lonlat=True) exclude = np.where(self._footprint[ipix] == 0)[0] page.delete(exclude)