77
88from astropy .io import votable , fits
99from astropy .table import Table
10+ from astropy .utils .exceptions import AstropyDeprecationWarning
1011
1112from astroquery .query import BaseQuery
1213from astroquery .utils import class_or_instance
@@ -56,8 +57,8 @@ def _validate_nafid_input_type(self, params):
5657 If the input does not have the minimum required parameters set to
5758 an at least truthy value.
5859 """
59- if not params .get ("obj_nafid " , False ):
60- raise ValueError ("When input type is 'nafid_input ' key 'obj_nafid ' is required." )
60+ if not params .get ("obj_naifid " , False ):
61+ raise ValueError ("When input type is 'naifid_input ' key 'obj_naifid ' is required." )
6162
6263 def _validate_mpc_input_type (self , params ):
6364 """
@@ -148,15 +149,15 @@ def _validate_input(self, params):
148149
149150 if input_type == "name_input" :
150151 self ._validate_name_input_type (params )
151- elif input_type == "nafid_input " :
152+ elif input_type == "naifid_input " :
152153 self ._validate_nafid_input_type (params )
153154 elif input_type == "mpc_input" :
154155 self ._validate_mpc_input_type (params )
155156 elif input_type == "manual_input" :
156157 self ._validate_manual_input_type (params )
157158 else :
158159 raise ValueError (
159- "Unrecognized 'input_type'. Expected `name_input`, `nafid_input ` "
160+ "Unrecognized 'input_type'. Expected `name_input`, `naifid_input ` "
160161 f"`mpc_input` or `manual_input`, got { input_type } instead."
161162 )
162163
@@ -230,7 +231,7 @@ def list_catalogs(self):
230231 return catalogs
231232
232233 def get_images (self , catalog = "wise_merge" , input_mode = "name_input" , ephem_step = 0.25 ,
233- obs_begin = None , obs_end = None , obj_name = None , obj_nafid = None , obj_type = None ,
234+ obs_begin = None , obs_end = None , obj_name = None , obj_nafid = None , obj_naifid = None , obj_type = None ,
234235 mpc_data = None , body_designation = None , epoch = None , eccentricity = None ,
235236 inclination = None , arg_perihelion = None , ascend_node = None , semimajor_axis = None ,
236237 mean_anomaly = None , perih_dist = None , perih_time = None , get_query_payload = False ,
@@ -328,6 +329,22 @@ def get_images(self, catalog="wise_merge", input_mode="name_input", ephem_step=0
328329 images : list
329330 A list of `~astropy.io.fits.HDUList` objects.
330331 """
332+ # Handle deprecated parameters
333+ if obj_nafid is not None and obj_naifid is None :
334+ warnings .warn (
335+ "'obj_nafid' is deprecated; use 'obj_naifid' instead (the API parameter is 'obj_naifid')." ,
336+ AstropyDeprecationWarning ,
337+ stacklevel = 2 ,
338+ )
339+ obj_naifid = obj_nafid
340+ if input_mode == "nafid_input" :
341+ warnings .warn (
342+ "'nafid_input' is deprecated; use 'naifid_input' instead (the API value is 'naifid_input')." ,
343+ AstropyDeprecationWarning ,
344+ stacklevel = 2 ,
345+ )
346+ input_mode = "naifid_input"
347+
331348 # We insist on output_mode being regular so that it executes quicker,
332349 # and we insist on tarballs so the download is quicker. We ignore
333350 # whatever else user provides, but leave the parameters as arguments to
@@ -339,7 +356,7 @@ def get_images(self, catalog="wise_merge", input_mode="name_input", ephem_step=0
339356 obs_end = obs_end ,
340357 ephem_step = ephem_step ,
341358 obj_name = obj_name ,
342- obj_nafid = obj_nafid ,
359+ obj_naifid = obj_naifid ,
343360 obj_type = obj_type ,
344361 mpc_data = mpc_data ,
345362 body_designation = body_designation ,
@@ -378,7 +395,7 @@ def get_images(self, catalog="wise_merge", input_mode="name_input", ephem_step=0
378395 @class_or_instance
379396 def query_object (self , catalog = "wise_merge" , input_mode = "name_input" , output_mode = "Regular" ,
380397 ephem_step = 0.25 , with_tarballs = False , obs_begin = None , obs_end = None ,
381- obj_name = None , obj_nafid = None , obj_type = None , mpc_data = None ,
398+ obj_name = None , obj_nafid = None , obj_naifid = None , obj_type = None , mpc_data = None ,
382399 body_designation = None , epoch = None , eccentricity = None , inclination = None ,
383400 arg_perihelion = None , ascend_node = None , semimajor_axis = None , mean_anomaly = None ,
384401 perih_dist = None , perih_time = None , get_query_payload = False ):
@@ -498,6 +515,22 @@ def query_object(self, catalog="wise_merge", input_mode="name_input", output_mod
498515 in ``"VOTable"`` an `~astropy.io.votable.tree.VOTableFile`. See
499516 module help for more details on the content of these tables.
500517 """
518+ # Handle deprecated parameters
519+ if obj_nafid is not None and obj_naifid is None :
520+ warnings .warn (
521+ "'obj_nafid' is deprecated; use 'obj_naifid' instead (the API parameter is 'obj_naifid')." ,
522+ AstropyDeprecationWarning ,
523+ stacklevel = 2 ,
524+ )
525+ obj_naifid = obj_nafid
526+ if input_mode == "nafid_input" :
527+ warnings .warn (
528+ "'nafid_input' is deprecated; use 'naifid_input' instead (the API value is 'naifid_input')." ,
529+ AstropyDeprecationWarning ,
530+ stacklevel = 2 ,
531+ )
532+ input_mode = "naifid_input"
533+
501534 # This is a map between the keyword names used by the MOST cgi-bin
502535 # service and their more user-friendly names. For example,
503536 # input_type -> input_mode or fits_region_files --> with tarballs
@@ -510,7 +543,7 @@ def query_object(self, catalog="wise_merge", input_mode="name_input", output_mod
510543 "ephem_step" : ephem_step ,
511544 "fits_region_files" : "on" if with_tarballs else "" ,
512545 "obj_name" : obj_name ,
513- "obj_nafid " : obj_nafid ,
546+ "obj_naifid " : obj_naifid ,
514547 "obj_type" : obj_type ,
515548 "mpc_data" : mpc_data ,
516549 "body_designation" : body_designation ,
0 commit comments