From 9ffcee7fc9136aa8f34d1cd0676dc03fcbf2d1c6 Mon Sep 17 00:00:00 2001 From: Mees Fix Date: Sat, 13 Jul 2024 15:27:20 -0700 Subject: [PATCH 1/5] Adding deprecation warning for code block and parameter to solve_from_image method --- astroquery/astrometry_net/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/astroquery/astrometry_net/core.py b/astroquery/astrometry_net/core.py index 32fc2d931b..a0fd5a002d 100644 --- a/astroquery/astrometry_net/core.py +++ b/astroquery/astrometry_net/core.py @@ -6,6 +6,7 @@ from astropy.io import fits from astropy.stats import sigma_clipped_stats from astropy.coordinates import SkyCoord +from astropy.utils.decorators import deprecated_renamed_argument try: from astropy.nddata import CCDData @@ -331,6 +332,7 @@ def solve_from_source_list(self, x, y, image_width, image_height, *, verbose=verbose, return_submission_id=return_submission_id) + @deprecated_renamed_argument("force_image_upload", None, since="0.4.8") def solve_from_image(self, image_file_path, *, force_image_upload=False, ra_key=None, dec_key=None, ra_dec_units=None, @@ -412,6 +414,10 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False, cache=False, files={'file': f}) else: + warning_msg = "Removing photutils functionality to obtain position list." \ + "Users can generate a coordinate list and upload to Astrometry.net" \ + "or a fits file that Astrometry.net will extract positions." + DeprecationWarning(warning_msg) # Detect sources and delegate to solve_from_source_list if _HAVE_CCDDATA: # CCDData requires a unit, so provide one. It has absolutely From 1f445f675dd6bdfb05243aa0ef8f38bc7b648c9d Mon Sep 17 00:00:00 2001 From: Mees Fix Date: Sat, 13 Jul 2024 18:26:55 -0700 Subject: [PATCH 2/5] Updating deprecation message, uses warnings package and adding unused kwarg to decorator --- astroquery/astrometry_net/core.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/astroquery/astrometry_net/core.py b/astroquery/astrometry_net/core.py index a0fd5a002d..d9b7947c17 100644 --- a/astroquery/astrometry_net/core.py +++ b/astroquery/astrometry_net/core.py @@ -2,11 +2,12 @@ import json +import warnings from astropy.io import fits from astropy.stats import sigma_clipped_stats from astropy.coordinates import SkyCoord -from astropy.utils.decorators import deprecated_renamed_argument +from astropy.utils.decorators import AstropyDeprecationWarning, deprecated_renamed_argument try: from astropy.nddata import CCDData @@ -332,7 +333,7 @@ def solve_from_source_list(self, x, y, image_width, image_height, *, verbose=verbose, return_submission_id=return_submission_id) - @deprecated_renamed_argument("force_image_upload", None, since="0.4.8") + @deprecated_renamed_argument(("force_image_upload", "ra_dec_units"), (None, None), since="0.4.8") def solve_from_image(self, image_file_path, *, force_image_upload=False, ra_key=None, dec_key=None, ra_dec_units=None, @@ -414,10 +415,11 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False, cache=False, files={'file': f}) else: - warning_msg = "Removing photutils functionality to obtain position list." \ - "Users can generate a coordinate list and upload to Astrometry.net" \ - "or a fits file that Astrometry.net will extract positions." - DeprecationWarning(warning_msg) + warning_msg = "Removing photutils functionality to obtain extracted positions list from " \ + "AstoromertyNetClass.solve_from_source_list. Users will need to " \ + "submit pre-extracted catalog positions or a fits file for https://nova.astrometry.net/ " \ + "to extract with their algorithm." + warnings.warn(warning_msg, category=AstropyDeprecationWarning) # Detect sources and delegate to solve_from_source_list if _HAVE_CCDDATA: # CCDData requires a unit, so provide one. It has absolutely From 4e2335417ecc2d04c319e071422742b47846c28b Mon Sep 17 00:00:00 2001 From: Mees Fix Date: Sun, 14 Jul 2024 09:44:01 -0700 Subject: [PATCH 3/5] Made addition to changelog and fixed typo in warning message --- CHANGES.rst | 5 +++++ astroquery/astrometry_net/core.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 24f059866d..123265e81b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,11 @@ New Tools and Services Service fixes and enhancements ------------------------------ +astrometry_net +^^^^^^^^^^^^^^ + +- Remove photutils from Astroquery astrometry.net [#3067] + alma ^^^^ diff --git a/astroquery/astrometry_net/core.py b/astroquery/astrometry_net/core.py index d9b7947c17..b6da118fa3 100644 --- a/astroquery/astrometry_net/core.py +++ b/astroquery/astrometry_net/core.py @@ -416,7 +416,7 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False, files={'file': f}) else: warning_msg = "Removing photutils functionality to obtain extracted positions list from " \ - "AstoromertyNetClass.solve_from_source_list. Users will need to " \ + "AstrometryNetClass.solve_from_source_list. Users will need to " \ "submit pre-extracted catalog positions or a fits file for https://nova.astrometry.net/ " \ "to extract with their algorithm." warnings.warn(warning_msg, category=AstropyDeprecationWarning) From c675b0af96a40127b2f8c39c6f81d186b64d5bde Mon Sep 17 00:00:00 2001 From: Mees Fix Date: Sun, 14 Jul 2024 10:14:34 -0700 Subject: [PATCH 4/5] Wrap warning message with parentheses and remove slashes --- astroquery/astrometry_net/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/astroquery/astrometry_net/core.py b/astroquery/astrometry_net/core.py index b6da118fa3..3efa94c9c2 100644 --- a/astroquery/astrometry_net/core.py +++ b/astroquery/astrometry_net/core.py @@ -415,10 +415,10 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False, cache=False, files={'file': f}) else: - warning_msg = "Removing photutils functionality to obtain extracted positions list from " \ - "AstrometryNetClass.solve_from_source_list. Users will need to " \ - "submit pre-extracted catalog positions or a fits file for https://nova.astrometry.net/ " \ - "to extract with their algorithm." + warning_msg = ("Removing photutils functionality to obtain extracted positions list from " + "AstrometryNetClass.solve_from_source_list. Users will need to " + "submit pre-extracted catalog positions or a fits file for https://nova.astrometry.net/ " + "to extract with their algorithm.") warnings.warn(warning_msg, category=AstropyDeprecationWarning) # Detect sources and delegate to solve_from_source_list if _HAVE_CCDDATA: From 5bfc66ba83259974b699ec0d7bcbf8512ee1eab7 Mon Sep 17 00:00:00 2001 From: Mees Fix Date: Sun, 14 Jul 2024 10:22:04 -0700 Subject: [PATCH 5/5] Formatting warning message to fit coding standards --- astroquery/astrometry_net/core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/astroquery/astrometry_net/core.py b/astroquery/astrometry_net/core.py index 3efa94c9c2..9b07c15dd7 100644 --- a/astroquery/astrometry_net/core.py +++ b/astroquery/astrometry_net/core.py @@ -415,10 +415,13 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False, cache=False, files={'file': f}) else: - warning_msg = ("Removing photutils functionality to obtain extracted positions list from " - "AstrometryNetClass.solve_from_source_list. Users will need to " - "submit pre-extracted catalog positions or a fits file for https://nova.astrometry.net/ " - "to extract with their algorithm.") + warning_msg = ( + "Removing photutils functionality to obtain extracted positions list from " + "AstrometryNetClass.solve_from_source_list. Users will need to " + "submit pre-extracted catalog positions or a fits file for https://nova.astrometry.net/ " + "to extract with their algorithm." + ) + warnings.warn(warning_msg, category=AstropyDeprecationWarning) # Detect sources and delegate to solve_from_source_list if _HAVE_CCDDATA: