@@ -101,6 +101,30 @@ def __init__(self):
101
101
self ._service_api_connection .set_service_params (services , "tesscut" )
102
102
103
103
def _validate_target_input (self , coordinates , objectname , moving_target ):
104
+ """
105
+ Validate the input parameters for target selection.
106
+
107
+ Parameters
108
+ ----------
109
+ coordinates : str or `astropy.coordinates` object, optional
110
+ The target around which to search. It may be specified as a
111
+ string or as the appropriate `astropy.coordinates` object.
112
+ objectname : str, optional
113
+ The target around which to search, by name (objectname="M104")
114
+ or TIC ID (objectname="TIC 141914082"). If moving_target is True, input must be the name or ID
115
+ (as understood by the `JPL ephemerides service <https://ssd.jpl.nasa.gov/horizons/app.html>`__)
116
+ of a moving target such as an asteroid or comet.
117
+ moving_target : bool, optional
118
+ Indicate whether the object is a moving target or not. Default is set to False, in other words,
119
+ not a moving target.
120
+
121
+ Raises
122
+ -------
123
+ InvalidQueryError
124
+ If ``moving_target`` is True and ``coordinates`` is provided.
125
+ If ``moving_target`` is True and ``objectname`` is not provided.
126
+ If both ``coordinates`` and ``objectname`` are provided.
127
+ """
104
128
if moving_target :
105
129
if coordinates :
106
130
raise InvalidQueryError ("Only one of moving_target and coordinates may be specified. "
@@ -115,17 +139,24 @@ def _validate_target_input(self, coordinates, objectname, moving_target):
115
139
raise InvalidQueryError ("Only one of objectname and coordinates may be specified. "
116
140
"Please remove objectname if using coordinates." )
117
141
118
- def _get_coordinates (self , coordinates , objectname , resolver ):
119
- """
120
- Get SkyCoord object for coordinates/objectname.
121
- """
122
- return parse_input_location (coordinates = coordinates ,
123
- objectname = objectname ,
124
- resolver = resolver )
125
-
126
142
def _validate_product (self , product ):
127
143
"""
128
- Check if the product is valid.
144
+ Validate the product type. "SPOC" is the only valid option.
145
+
146
+ Parameters
147
+ ----------
148
+ product : str
149
+ The product type to validate. Must be "SPOC".
150
+
151
+ Raises
152
+ -------
153
+ InvalidQueryError
154
+ If the product is not "SPOC".
155
+
156
+ Returns
157
+ -------
158
+ str
159
+ The validated product type, converted to uppercase.
129
160
"""
130
161
product = product .upper ()
131
162
if product != "SPOC" :
@@ -198,7 +229,9 @@ def get_sectors(self, *, coordinates=None, radius=0*u.deg, product='SPOC', objec
198
229
service = "mt_sector"
199
230
else :
200
231
# Get Skycoord object for coordinates/object
201
- coordinates = self ._get_coordinates (coordinates , objectname , resolver )
232
+ coordinates = parse_input_location (coordinates = coordinates ,
233
+ objectname = objectname ,
234
+ resolver = resolver )
202
235
# If radius is just a number we assume degrees
203
236
radius = Angle (radius , u .deg )
204
237
params = {"ra" : coordinates .ra .deg ,
@@ -301,7 +334,9 @@ def download_cutouts(self, *, coordinates=None, size=5, sector=None, product='SP
301
334
params ["obj_type" ] = mt_type
302
335
request_path = "moving_target/astrocut"
303
336
else :
304
- coordinates = self ._get_coordinates (coordinates , objectname , resolver )
337
+ coordinates = parse_input_location (coordinates = coordinates ,
338
+ objectname = objectname ,
339
+ resolver = resolver )
305
340
params .update ({"ra" : coordinates .ra .deg , "dec" : coordinates .dec .deg })
306
341
request_path = "astrocut"
307
342
@@ -414,7 +449,9 @@ def get_cutouts(self, *, coordinates=None, size=5, product='SPOC', sector=None,
414
449
service = "mt_astrocut"
415
450
else :
416
451
# Get Skycoord object for coordinates/object
417
- coordinates = self ._get_coordinates (coordinates , objectname , resolver )
452
+ coordinates = parse_input_location (coordinates = coordinates ,
453
+ objectname = objectname ,
454
+ resolver = resolver )
418
455
params .update ({"ra" : coordinates .ra .deg , "dec" : coordinates .dec .deg })
419
456
service = "astrocut"
420
457
0 commit comments