@@ -149,6 +149,34 @@ def _validate_criteria(self, **criteria):
149149 )
150150 raise InvalidQueryError (error_msg )
151151
152+ def _build_params_from_criteria (self , params , ** criteria ):
153+ """
154+ Build the parameters for the API request based on the provided criteria.
155+
156+ Parameters
157+ ----------
158+ params : dict
159+ Dictionary to store the parameters for the API request.
160+ **criteria
161+ Keyword arguments representing criteria filters to apply.
162+ """
163+ # Add each criterion to the params dictionary
164+ params ['conditions' ] = []
165+ for prop , value in criteria .items ():
166+ if prop not in self ._search_option_fields :
167+ if isinstance (value , list ):
168+ # Convert to comma-separated string if passed as a list
169+ value = ',' .join (str (item ) for item in value )
170+ params ['conditions' ].append ({prop : value })
171+ else :
172+ if prop == 'sort_by' and isinstance (value , str ):
173+ # Convert to list if passed as a string
174+ value = [value ]
175+ if prop == 'sort_desc' and isinstance (value , bool ):
176+ # Convert to list if passed as a boolean
177+ value = [value ]
178+ params [prop ] = value
179+
152180 @class_or_instance
153181 def query_region_async (self , coordinates , * , radius = 3 * u .arcmin , limit = 5000 , offset = 0 ,
154182 select_cols = None , ** criteria ):
@@ -172,12 +200,15 @@ def query_region_async(self, coordinates, *, radius=3*u.arcmin, limit=5000, offs
172200 Optional and default is 0
173201 the number of records you wish to skip before selecting records.
174202 select_cols: list, None
175- Default None. Names of columns that will be included in the astropy table
203+ Default None. Names of columns that will be included in the result table.
204+ If None, a default set of columns will be returned.
176205 **criteria
177206 Other mission-specific criteria arguments.
178207 All valid filters can be found using `~astroquery.mast.missions.MastMissionsClass.get_column_list`
179208 function.
180209 For example, one can specify the output columns(select_cols) or use other filters(conditions).
210+ To filter by multiple values for a single column, pass in a list of values or
211+ a comma-separated string of values.
181212
182213 Returns
183214 -------
@@ -210,13 +241,7 @@ def query_region_async(self, coordinates, *, radius=3*u.arcmin, limit=5000, offs
210241 'offset' : offset ,
211242 'select_cols' : select_cols }
212243
213- params ['conditions' ] = []
214- # adding additional user specified parameters
215- for prop , value in criteria .items ():
216- if prop not in self ._search_option_fields :
217- params ['conditions' ].append ({prop : value })
218- else :
219- params [prop ] = value
244+ self ._build_params_from_criteria (params , ** criteria )
220245
221246 return self ._service_api_connection .missions_request_async (self .service , params )
222247
@@ -245,7 +270,8 @@ def query_criteria_async(self, *, coordinates=None, objectname=None, radius=3*u.
245270 Optional and default is 0.
246271 the number of records you wish to skip before selecting records.
247272 select_cols: list, None
248- Default None. Names of columns that will be included in the astropy table
273+ Default None. Names of columns that will be included in the result table.
274+ If None, a default set of columns will be returned.
249275 resolver : str, optional
250276 The resolver to use when resolving a named target into coordinates. Valid options are "SIMBAD" and "NED".
251277 If not specified, the default resolver order will be used. Please see the
@@ -259,6 +285,8 @@ def query_criteria_async(self, *, coordinates=None, objectname=None, radius=3*u.
259285 and all fields listed in the column documentation for the mission being queried.
260286 List of all valid fields that can be used to match results on criteria can be retrieved by calling
261287 `~astroquery.mast.missions.MastMissionsClass.get_column_list` function.
288+ To filter by multiple values for a single column, pass in a list of values or
289+ a comma-separated string of values.
262290
263291 Returns
264292 -------
@@ -296,12 +324,7 @@ def query_criteria_async(self, *, coordinates=None, objectname=None, radius=3*u.
296324 if not self ._service_api_connection .check_catalogs_criteria_params (criteria ):
297325 raise InvalidQueryError ("At least one non-positional criterion must be supplied." )
298326
299- params ['conditions' ] = []
300- for prop , value in criteria .items ():
301- if prop not in self ._search_option_fields :
302- params ['conditions' ].append ({prop : value })
303- else :
304- params [prop ] = value
327+ self ._build_params_from_criteria (params , ** criteria )
305328
306329 return self ._service_api_connection .missions_request_async (self .service , params )
307330
@@ -327,7 +350,8 @@ def query_object_async(self, objectname, *, radius=3*u.arcmin, limit=5000, offse
327350 Optional and default is 0.
328351 the number of records you wish to skip before selecting records.
329352 select_cols: list, None
330- Default None. Names of columns that will be included in the astropy table
353+ Default None. Names of columns that will be included in the result table.
354+ If None, a default set of columns will be returned.
331355 resolver : str, optional
332356 The resolver to use when resolving a named target into coordinates. Valid options are "SIMBAD" and "NED".
333357 If not specified, the default resolver order will be used. Please see the
@@ -338,6 +362,8 @@ def query_object_async(self, objectname, *, radius=3*u.arcmin, limit=5000, offse
338362 All valid filters can be found using `~astroquery.mast.missions.MastMissionsClass.get_column_list`
339363 function.
340364 For example, one can specify the output columns(select_cols) or use other filters(conditions).
365+ To filter by multiple values for a single column, pass in a list of values or
366+ a comma-separated string of values.
341367
342368 Returns
343369 -------
0 commit comments