3
3
MAST Queries
4
4
************
5
5
6
- Direct Mast Queries
7
- ===================
8
-
9
6
The Mast class provides more direct access to the MAST interface. It requires
10
7
more knowledge of the inner workings of the MAST API, and should be rarely
11
8
needed. However in the case of new functionality not yet implemented in
12
- astroquery, this class does allow access. See the `MAST api documentation
13
- <https://mast.stsci.edu/api> `_ for more information.
9
+ astroquery, this class does allow access. See the
10
+ `MAST api documentation <https://mast.stsci.edu/api >`__ for more
11
+ information.
12
+
13
+ The basic MAST query function allows users to query through the following
14
+ `MAST Services <https://mast.stsci.edu/api/v0/_services.html >`__ using
15
+ their corresponding parameters and returns query results as an
16
+ `~astropy.table.Table `.
17
+
18
+ Filtered Mast Queries
19
+ =====================
20
+
21
+ MAST's Filtered services use the parameters 'columns' and 'filters'. The 'columns'
22
+ parameter is a required string that specifies the columns to be returned as a
23
+ comma-separated list. The 'filters' parameter is a required list of filters to be
24
+ applied. The `~astroquery.mast.MastClass.mast_query ` method accepts that list of
25
+ filters as keyword arguments paired with a list of values, similar to
26
+ `~astroquery.mast.ObservationsClass.query_criteria `.
27
+
28
+ The following example uses a JWST service with column names and filters specific to
29
+ JWST services. For the full list of valid parameters view the
30
+ `JWST Field Documentation <https://mast.stsci.edu/api/v0/_jwst_inst_keywd.html >`__.
31
+
32
+ .. doctest-remote-data ::
33
+
34
+ >>> from astroquery.mast import Mast
35
+ ...
36
+ >>> observations = Mast.mast_query(' Mast.Jwst.Filtered.Nirspec' ,
37
+ ... columns= ' title, instrume, targname' ,
38
+ ... targoopp= [' T' ])
39
+ >>> print (observations) # doctest: +IGNORE_OUTPUT
40
+ title instrume targname
41
+ ------------------------------- -------- ----------------
42
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
43
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
44
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
45
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
46
+ De-Mystifying SPRITEs with JWST NIRSPEC SPIRITS18nu
47
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
48
+ ... ... ...
49
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
50
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
51
+ ToO Comet NIRSPEC ZTF (C/2022 E3)
52
+ Length = 319 rows
53
+
54
+
55
+ TESS Queries
56
+ ------------
14
57
15
- The basic MAST query function returns query results as an `~astropy.table.Table `.
58
+ TESS queries have 2 types of filtered services. To output a table and specify
59
+ columns for a TESS query, use TIC or CTL services with '.Rows' on the end
60
+ (e.g. `Mast.Catalogs.Filtered.Tic.Rows
61
+ <https://mast.stsci.edu/api/v0/_services.html#MastCatalogsFilteredTicRows> `__).
62
+ Valid parameters for TIC and CTL services are detailed in the
63
+ `TIC Field Documentation <https://mast.stsci.edu/api/v0/_t_i_cfields.html >`__.
16
64
17
65
.. doctest-remote-data ::
18
66
19
67
>>> from astroquery.mast import Mast
20
68
...
21
- >>> service = ' Mast.Caom.Cone'
22
- >>> params = {' ra' :184.3 ,
23
- ... ' dec' :54.5 ,
24
- ... ' radius' :0.2 }
25
- >>> observations = Mast.service_request(service, params)
69
+ >>> observations = Mast.mast_query(' Mast.Catalogs.Filtered.Tic.Rows' ,
70
+ ... columns= ' id' ,
71
+ ... dec= [{' min' : - 90 , ' max' : - 30 }],
72
+ ... Teff= [{' min' : 4250 , ' max' : 4500 }],
73
+ ... logg= [{' min' : 4.5 , ' max' : 5.0 }],
74
+ ... Tmag= [{' min' : 8 , ' max' : 10 }])
75
+ >>> print (observations) # doctest: +IGNORE_OUTPUT
76
+ ID
77
+ ---------
78
+ 320274328
79
+ 408290683
80
+ 186485314
81
+ 395586623
82
+ 82007673
83
+ 299550797
84
+ ...
85
+ 333372236
86
+ 394008846
87
+ 261525246
88
+ 240766734
89
+ 240849919
90
+ 219338557
91
+ 92131304
92
+ Length = 814 rows
93
+
94
+ TESS services without '.Rows' in the title are used for count queries and will
95
+ not mask the output tables using the columns parameter. Additionally, using a
96
+ '.Rows' service for a count query will result in an error.
97
+
98
+ .. doctest-skip ::
99
+
100
+ >>> from astroquery.mast import Mast
101
+ ...
102
+ >>> observations = Mast.mast_query(' Mast.Catalogs.Filtered.Tic.Rows' ,
103
+ ... columns = ' COUNT_BIG(*)' ,
104
+ ... dec= [{' min' : - 90 , ' max' : - 30 }],
105
+ ... Teff= [{' min' : 4250 , ' max' : 4500 }],
106
+ ... logg= [{' min' : 4.5 , ' max' : 5.0 }],
107
+ ... Tmag= [{' min' : 8 , ' max' : 10 }])
108
+ Traceback (most recent call last):
109
+ ...
110
+ astroquery.exceptions.RemoteServiceError: Incorrect syntax near '*'.
111
+
112
+
113
+ Cone Searches
114
+ =============
115
+
116
+ MAST's cone search services use the parameters 'ra', 'dec', and 'radius' and return
117
+ a table of observations with all columns present.
118
+
119
+ .. doctest-remote-data ::
120
+
121
+ >>> from astroquery.mast import Mast
122
+ ...
123
+ >>> observations = Mast.mast_query(' Mast.Caom.Cone' ,
124
+ ... ra= 184.3 ,
125
+ ... dec= 54.5 ,
126
+ ... radius= 0.2 )
26
127
>>> print (observations) # doctest: +IGNORE_OUTPUT
27
128
intentType obs_collection provenance_name ... obsid distance
28
129
---------- -------------- --------------- ... ----------- ------------------
@@ -51,28 +152,46 @@ The basic MAST query function returns query results as an `~astropy.table.Table`
51
152
Length = 77 rows
52
153
53
154
54
- Many mast services, specifically JWST and Catalog services, require the two principal keywords, 'columns' and 'filters',
55
- to list parameters. Positional services will also require right ascension and declination parameters, either in
56
- addition to columns and filters or on their own. For example, the cone search service only requires the 'ra' and
57
- 'dec' parameters. Using the wrong service parameters will result in an error. Read the
58
- `MAST API services documentation <https://mast.stsci.edu/api/v0/_services.html >`__ for more information on valid
59
- service parameters.
155
+ Cone search services only require positional parameters. Using the wrong service
156
+ parameters will result in an error. Read the
157
+ `MAST API services documentation <https://mast.stsci.edu/api/v0/_services.html >`__
158
+ for more information on valid service parameters.
60
159
61
- .. doctest-remote-data ::
160
+ .. doctest-skip ::
62
161
63
162
>>> from astroquery.mast import Mast
64
163
...
65
- >>> service = ' Mast.Caom.Cone'
66
- >>> params = { ' columns' : " * " ,
67
- ... ' filters ' : {}}
68
- >>> observations = Mast.service_request(service, params )
164
+ >>> observations = Mast.mast_query( ' Mast.Caom.Cone' ,
165
+ ... columns= ' ra ' ,
166
+ ... Teff = [{ ' min ' : 4250 , ' max ' : 4500 }],
167
+ ... logg = [{ ' min ' : 4.5 , ' max ' : 5.0 }] )
69
168
Traceback (most recent call last):
70
169
...
71
170
astroquery.exceptions.RemoteServiceError: Request Object is Missing Required Parameter : RA
72
171
172
+ Using the 'columns' parameter in addition to the required cone search parameters will
173
+ result in a warning.
174
+
175
+ .. doctest-remote-data ::
176
+
177
+ >>> from astroquery.mast import Mast
178
+ ...
179
+ >>> observations = Mast.mast_query(' Mast.Catalogs.GaiaDR1.Cone' ,
180
+ ... columns= " ra" ,
181
+ ... ra= 254.287 ,
182
+ ... dec= - 4.09933 ,
183
+ ... radius= 0.02 ) # doctest: +SHOW_WARNINGS
184
+ InputWarning: 'columns' parameter will not mask non-filtered services
185
+
186
+ Advanced Service Request
187
+ ========================
73
188
74
- If the output is not the MAST json result type it cannot be properly parsed into a `~astropy.table.Table `.
75
- In this case, the async method should be used to get the raw http response, which can then be manually parsed.
189
+ Certain MAST Services, such as `Mast.Name.Lookup
190
+ <https://mast.stsci.edu/api/v0/_services.html#MastNameLookup> `__ will not work with
191
+ `astroquery.mast.MastClass.mast_query ` due to it's return type. If the output of a query
192
+ is not the MAST json result type it cannot be properly parsed into a `~astropy.table.Table `.
193
+ In this case, the `~astroquery.mast.MastClass.service_request_async ` method should be used
194
+ to get the raw http response, which can then be manually parsed.
76
195
77
196
.. doctest-remote-data ::
78
197
@@ -82,7 +201,7 @@ In this case, the async method should be used to get the raw http response, whic
82
201
>>> params = {' input' :" M8" ,
83
202
... ' format' :' json' }
84
203
...
85
- >>> response = Mast.service_request_async(service,params)
204
+ >>> response = Mast.service_request_async(service, params)
86
205
>>> result = response[0 ].json()
87
206
>>> print (result) # doctest: +IGNORE_OUTPUT
88
207
{'resolvedCoordinate': [{'cacheDate': 'Apr 12, 2017 9:28:24 PM',
0 commit comments