@@ -121,6 +121,32 @@ def resolve_object(objectname):
121121 return coordinates
122122
123123
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+
124150def parse_input_location (coordinates = None , objectname = None ):
125151 """
126152 Convenience function to parse user input of coordinates and objectname.
@@ -139,7 +165,8 @@ def parse_input_location(coordinates=None, objectname=None):
139165 Returns
140166 -------
141167 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.
143170 """
144171
145172 # Checking for valid input
@@ -149,11 +176,13 @@ def parse_input_location(coordinates=None, objectname=None):
149176 if not (objectname or coordinates ):
150177 raise InvalidQueryError ("One of objectname and coordinates must be specified." )
151178
179+ # Resolve object, if given
152180 if objectname :
153181 obj_coord = resolve_object (objectname )
154182
183+ # Parse coordinates, if given
155184 if coordinates :
156- obj_coord = commons . parse_coordinates (coordinates )
185+ obj_coord = parse_coordinates (coordinates )
157186
158187 return obj_coord
159188
0 commit comments