Skip to content

Commit 1dd70be

Browse files
authored
Merge pull request #772 from imbasimba/master
Corrected query_object_catalogs parameter order
2 parents dad44d5 + d70d3e9 commit 1dd70be

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

astroquery/esasky/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Conf(_config.ConfigNamespace):
1515
'Time limit for connecting to template_module server.')
1616

1717
row_limit = _config.ConfigItem(
18-
2000,
18+
10000,
1919
'Maximum number of rows returned (set to -1 for unlimited).')
2020

2121
conf = Conf()

astroquery/esasky/core.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@ def query_object_maps(self, position, missions=__ALL_STRING,
111111
query_object_maps("265.05, 69.0", "Herschel")
112112
query_object_maps("265.05, 69.0", ["Herschel", "HST"])
113113
"""
114-
return self.query_region_maps(position, self.__ZERO_ARCMIN_STRING, missions,
115-
get_query_payload, cache)
114+
return self.query_region_maps(position=position,
115+
radius=self.__ZERO_ARCMIN_STRING,
116+
missions=missions,
117+
get_query_payload=get_query_payload,
118+
cache=cache)
116119

117120
def query_object_catalogs(self, position, catalogs=__ALL_STRING,
118121
row_limit=DEFAULT_ROW_LIMIT,
@@ -136,7 +139,7 @@ def query_object_catalogs(self, position, catalogs=__ALL_STRING,
136139
row_limit : int, optional
137140
Determines how many rows that will be fetched from the database
138141
for each mission. Can be -1 to select maximum (currently 100 000).
139-
Defaults to 2000.
142+
Defaults to 10000.
140143
get_query_payload : bool, optional
141144
When set to True the method returns the HTTP request parameters.
142145
Defaults to False.
@@ -160,9 +163,12 @@ def query_object_catalogs(self, position, catalogs=__ALL_STRING,
160163
query_object_catalogs("265.05, 69.0", "Gaia DR1 TGA")
161164
query_object_catalogs("265.05, 69.0", ["Gaia DR1 TGA", "HSC"])
162165
"""
163-
return self.query_region_catalogs(position, self.__ZERO_ARCMIN_STRING,
164-
row_limit, catalogs,
165-
get_query_payload, cache)
166+
return self.query_region_catalogs(position=position,
167+
radius=self.__ZERO_ARCMIN_STRING,
168+
catalogs=catalogs,
169+
row_limit=row_limit,
170+
get_query_payload=get_query_payload,
171+
cache=cache)
166172

167173
def query_region_maps(self, position, radius, missions=__ALL_STRING,
168174
get_query_payload=False, cache=True):
@@ -246,7 +252,7 @@ def query_region_catalogs(self, position, radius, catalogs=__ALL_STRING,
246252
row_limit : int, optional
247253
Determines how many rows that will be fetched from the database
248254
for each mission. Can be -1 to select maximum (currently 100 000).
249-
Defaults to 2000.
255+
Defaults to 10000.
250256
get_query_payload : bool, optional
251257
When set to True the method returns the HTTP request parameters.
252258
Defaults to False.
@@ -325,7 +331,7 @@ def get_maps(self, query_table_list, missions=__ALL_STRING,
325331
filter is the key and the HDUList is the value.
326332
It is structured in a dictionary like this:
327333
dict: {
328-
'HERSCHEL': [{'70': [HDUList], ' 160': [HDUList]}, {'70': [HDUList], ' 160': [HDUList]}, ...],
334+
'HERSCHEL': [{'70': [HDUList], '160': [HDUList]}, {'70': [HDUList], '160': [HDUList]}, ...],
329335
'HST':[[HDUList], HDUList], HDUList], HDUList], HDUList], ...],
330336
'XMM-EPIC' : [HDUList], HDUList], HDUList], HDUList], ...]
331337
...
@@ -398,7 +404,7 @@ def get_images(self, position, radius=__ZERO_ARCMIN_STRING, missions=__ALL_STRIN
398404
filter is the key and the HDUList is the value.
399405
It is structured in a dictionary like this:
400406
dict: {
401-
'HERSCHEL': [{'70': [HDUList], ' 160': [HDUList]}, {'70': [HDUList], ' 160': [HDUList]}, ...],
407+
'HERSCHEL': [{'70': [HDUList], '160': [HDUList]}, {'70': [HDUList], '160': [HDUList]}, ...],
402408
'HST':[[HDUList], HDUList], HDUList], HDUList], HDUList], ...],
403409
'XMM-EPIC' : [HDUList], HDUList], HDUList], HDUList], ...]
404410
...
@@ -504,7 +510,7 @@ def _get_maps_for_mission(self, maps_table, mission, download_dir, cache):
504510
directory_path = mission_directory + "/"
505511
if (mission.lower() == self.__HERSCHEL_STRING):
506512
herschel_filter = (maps_table[self.__FILTER_STRING][index]
507-
.decode('utf-8').split(","))
513+
.decode('utf-8').split(", "))
508514
maps.append(self._get_herschel_observation(product_url,
509515
directory_path,
510516
herschel_filter,
@@ -641,8 +647,8 @@ def _build_observation_query(self, coordinates, radius, json):
641647
area_or_point_string = "pos"
642648
else:
643649
area_or_point_string = "fov"
644-
where_query = (" WHERE 1=CONTAINS(%s, CIRCLE('ICRS', %f, %f, %f));"
645-
%(area_or_point_string, ra, dec, radiusDeg))
650+
where_query = (" WHERE 1=INTERSECTS(CIRCLE('ICRS', %f, %f, %f), %s);"
651+
%(ra, dec, radiusDeg, area_or_point_string))
646652
else:
647653
area_or_point_string = "fov"
648654
where_query = (" WHERE 1=CONTAINS(POINT('ICRS', %f, %f), %s);"

docs/esasky/esasky.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ There are two query objects methods in this module
5252
almost the same way except that one has catalogs as input and output and the
5353
other one has mission names and observations as input and output.
5454

55-
For catalogs, the query returns a maximum of 2000 sources per mission by
55+
For catalogs, the query returns a maximum of 10000 sources per mission by
5656
default. However, this can be modified by the row_limit parameter.
5757
You can set the parameter to -1, which will result in the maximum number of
5858
sources (currently 100 000).
@@ -86,11 +86,10 @@ To see the result:
8686
.. code-block:: python
8787
8888
>>> print(result)
89-
TableList with 4 tables:
90-
'0:XMM-EPIC' with 4 column(s) and 3 row(s)
91-
'1:HSC' with 8 column(s) and 2000 row(s)
92-
'2:XMM-OM' with 12 column(s) and 220 row(s)
93-
'3:PLANCK-PCCS2-HFI' with 8 column(s) and 1 row(s)
89+
TableList with 3 tables:
90+
'0:HSC' with 8 column(s) and 135 row(s)
91+
'1:XMM-EPIC' with 4 column(s) and 2 row(s)
92+
'2:XMM-OM' with 12 column(s) and 3 row(s)
9493
9594
All the results are returned as a `astroquery.utils.TableList` object. This is a
9695
container for `~astropy.table.Table` objects. It is basically an extension to
@@ -134,7 +133,7 @@ choose a radius as well. There are two query region methods in this module
134133
:meth:`astroquery.esasky.ESASkyClass.query_region_catalogs` and
135134
:meth:`astroquery.esasky.ESASkyClass.query_region_maps`.
136135
The row_limit parameter can be set to choose the maximum number of row to be
137-
selected. If this parameter is not set, the method will return the first 2000
136+
selected. If this parameter is not set, the method will return the first 10000
138137
sources. You can set the parameter to -1, which will result in the maximum
139138
number of sources (currently 100 000).
140139

@@ -177,7 +176,7 @@ To see the result:
177176
>>> print(result)
178177
TableList with 4 tables:
179178
'0:XMM-EPIC' with 4 column(s) and 3 row(s)
180-
'1:HSC' with 8 column(s) and 2000 row(s)
179+
'1:HSC' with 8 column(s) and 10000 row(s)
181180
'2:XMM-OM' with 12 column(s) and 220 row(s)
182181
'3:PLANCK-PCCS2-HFI' with 8 column(s) and 1 row(s)
183182
@@ -218,7 +217,7 @@ dictionary where the used filter is the key and the HDUList is the value.
218217
219218
>>> print(images)
220219
{
221-
'HERSCHEL': [{'70': [HDUList], ' 160': [HDUList]}, {'70': [HDUList], ' 160': [HDUList]}, ...],
220+
'HERSCHEL': [{'70': [HDUList], '160': [HDUList]}, {'70': [HDUList], '160': [HDUList]}, ...],
222221
'XMM-EPIC' : [HDUList], HDUList], HDUList], HDUList], ...]
223222
...
224223
}

0 commit comments

Comments
 (0)