@@ -121,6 +121,32 @@ def resolve_object(objectname):
121
121
return coordinates
122
122
123
123
124
+ def parse_coordinates (coordinates ):
125
+ """
126
+ Convenience function to parse user input of coordinates.
127
+
128
+ Parameters
129
+ ----------
130
+ coordinates : str or `astropy.coordinates` object, optional
131
+ The target around which to search. It may be specified as a
132
+ string or as the appropriate `astropy.coordinates` object.
133
+
134
+ Returns
135
+ -------
136
+ response : `~astropy.coordinates.SkyCoord`
137
+ The given coordinates as an `~astropy.coordinates.SkyCoord` object in the ICRS frame.
138
+ """
139
+
140
+ # Parse into SkyCoord object
141
+ coordinates = commons .parse_coordinates (coordinates )
142
+
143
+ # Convert to ICRS frame, if needed
144
+ if coordinates .frame != 'icrs' :
145
+ coordinates = coordinates .transform_to ('icrs' )
146
+
147
+ return coordinates
148
+
149
+
124
150
def parse_input_location (coordinates = None , objectname = None ):
125
151
"""
126
152
Convenience function to parse user input of coordinates and objectname.
@@ -139,7 +165,8 @@ def parse_input_location(coordinates=None, objectname=None):
139
165
Returns
140
166
-------
141
167
response : `~astropy.coordinates.SkyCoord`
142
- The given coordinates, or object's location as an `~astropy.coordinates.SkyCoord` object.
168
+ The given coordinates, or object's location as an `~astropy.coordinates.SkyCoord` object
169
+ in the ICRS frame.
143
170
"""
144
171
145
172
# Checking for valid input
@@ -149,11 +176,13 @@ def parse_input_location(coordinates=None, objectname=None):
149
176
if not (objectname or coordinates ):
150
177
raise InvalidQueryError ("One of objectname and coordinates must be specified." )
151
178
179
+ # Resolve object, if given
152
180
if objectname :
153
181
obj_coord = resolve_object (objectname )
154
182
183
+ # Parse coordinates, if given
155
184
if coordinates :
156
- obj_coord = commons . parse_coordinates (coordinates )
185
+ obj_coord = parse_coordinates (coordinates )
157
186
158
187
return obj_coord
159
188
0 commit comments