@@ -163,14 +163,22 @@ Querying by other parameters
163
163
============================
164
164
165
165
As of version 0.3 .4, you can also query other fields by keyword. For example,
166
- if you want to find all projects with a particular PI , you could do:
166
+ if you want to find all projects in a region with a particular PI , you could do:
167
167
168
168
.. code- block:: python
169
169
170
- >> > rslt = Alma.query_object(' W51' , pi_name = ' *Ginsburg*' , public = False ) # doctest: +REMOTE_DATA
170
+ >> > rslt = Alma.query_region(' W51' , radius = 25 * u.arcmin, pi_name = ' *Ginsburg*' ) # doctest: +REMOTE_DATA
171
+
172
+ or if you wanted all projects by a given PI :
173
+
174
+ .. code- block:: python
175
+
176
+ >> > rslt = Alma.query(payload = dict (pi_name = ' Ginsburg, Adam' )) # doctest: +REMOTE_DATA
171
177
172
178
The ' ' query_sia' ' method offers another way to query ALMA using the IVOA SIA
173
- subset of keywords returning results in ' ObsCore' format .
179
+ subset of keywords returning results in ' ObsCore' format . For example,
180
+ to query for all images that have `XX ` polarization (note that this query is too large
181
+ to run, it is just shown as an example):
174
182
175
183
.. code- block:: python
176
184
@@ -191,12 +199,18 @@ format.
191
199
-------------------------- - -------------- ------------ - ... ------------------------------------------------------------------------------------ ---------------------- ---------------------- -
192
200
ADS / JAO .ALMA # 2016.1.00164.S ALMA JAO ... Starbursts, star formation, Galaxy chemistry Active galaxies 2021-09-30T16:34:41.133
193
201
202
+ One can also query by keyword, spatial resolution, etc:
203
+
204
+ .. code- block:: python
205
+ .. doctest- remote- data::
206
+ >> > Alma.query_tap(f " select * from ivoa.obscore WHERE spatial_resolution<=0.1 AND science_keyword in ('Disks around high-mass stars', 'Asymptotic Giant Branch (AGB) stars') AND science_observation='T' " ) # doctest: +IGNORE_OUTPUT
207
+
194
208
195
209
Use the ' ' help_tap' ' method to learn about the ALMA ' ObsCore' keywords and
196
210
their types.
197
211
198
212
.. code- block:: python
199
- >> > Alma.help_tap() # doctest: +REMOTE_DATA
213
+ >> > Alma.help_tap() # doctest: +REMOTE_DATA +IGNORE_OUTPUT
200
214
Table to query is " voa.ObsCore" .
201
215
For example: " select top 1 * from ivoa.ObsCore"
202
216
The scheme of the table is as follows.
@@ -270,24 +284,26 @@ their types.
270
284
Downloading Data
271
285
================
272
286
273
- You can download ALMA data with astroquery, but be forewarned, cycle 0 and
274
- cycle 1 data sets tend to be > 100 GB !
287
+ You can download ALMA data with astroquery, but be forewarned, many data sets
288
+ are > 100 GB !
275
289
276
290
277
291
.. code- block:: python
278
292
.. doctest- remote- data::
279
- >> > import numpy as np
280
- >> > uids = np.unique(m83_data[' member_ous_uid' ])
281
- >> > print (uids) # doctest: +IGNORE_OUTPUT
282
- member_ous_uid
283
- ---------------------- -
284
- uid:// A001/ X11f/ X30
285
- uid:// A001/ X122/ Xf3
286
-
287
- New to most recent versions of the library is that data does not need to be
288
- staged any longer. The ```stage_data``` method has been deprecated, but the
289
- new ```get_data_info``` method can be used instead to get information about
290
- the data such as the files, their urls, sizes etc:
293
+ >> > import numpy as np
294
+ >> > from astroquery.alma import Alma
295
+ >> > m83_data = Alma.query_object(' M83' )
296
+ >> > uids = np.unique(m83_data[' member_ous_uid' ])
297
+ >> > print (uids) # doctest: +IGNORE_OUTPUT
298
+ member_ous_uid
299
+ ---------------------- -
300
+ uid:// A001/ X11f/ X30
301
+ uid:// A001/ X122/ Xf3
302
+
303
+ The new ```get_data_info``` method can be used to get information about the
304
+ data such as the file names, their urls, sizes etc (this method replaces
305
+ ```stage_data``` , which served the same role in older versions of astroquery
306
+ but is now deprecated):
291
307
292
308
.. code- block:: python
293
309
.. doctest- remote- data::
@@ -301,10 +317,10 @@ on the individual files:
301
317
.. doctest- remote- data::
302
318
>> > link_list = Alma.get_data_info(uids, expand_tarfiles = True )
303
319
304
- You can then go on to download that data . The download will be cached so that repeat
305
- queries of the same file will not re- download the data. The default cache
306
- directory is `` ~ / .astropy/ cache/ astroquery/ Alma/ `` , but this can be changed by
307
- changing the `` cache_location`` variable:
320
+ You can then go on to download those files . The download will be cached so
321
+ that repeat queries of the same file will not re- download the data. The
322
+ default cache directory is `` ~ / .astropy/ cache/ astroquery/ Alma/ `` , but this can
323
+ be changed by changing the `` cache_location`` variable:
308
324
309
325
.. code- block:: python
310
326
.. doctest- remote- data::
@@ -332,8 +348,8 @@ download but will return useful information about the state of your downloads:
332
348
Downloading FITS data
333
349
==================== =
334
350
335
- If you want just the QA2 - produced FITS files, you can download the tarball,
336
- extract the FITS file , then delete the tarball :
351
+ If you want just the QA2 - produced FITS files, you can directly access the FITS
352
+ files :
337
353
338
354
.. code- block:: python
339
355
.. doctest- remote- data::
@@ -343,23 +359,19 @@ extract the FITS file, then delete the tarball:
343
359
>> > s255ir = coordinates.SkyCoord(93.26708333 , 17.97888889 , frame = ' fk5' ,
344
360
... unit = (u.deg, u.deg))
345
361
>> > result = Alma.query_region(s255ir, radius = 0.034 * u.deg)
346
- >> > uid_url_table = Alma.get_data_info(result[' obs_id' ][0 ])
347
- >> > # Extract the data with tarball file size < 1GB
348
- >> > small_uid_url_table = uid_url_table[uid_url_table[' content_length' ] < 10 ** 9 ]
349
- >> > # get the first 3 files...
350
- >> > tarball_files = uid_url_table[uid_url_table[' content_type' ] == ' application/x-tar' ]
351
- >> > # sort so we only have to download smaller files for this example
352
- >> > tarball_files.sort(' content_length' )
353
- >> > # this will download a big file or few
354
- >> > # filelist = Alma.download_files(tarball_files['access_url'])
355
-
356
- You might want to look at the READMEs from a bunch of files so you know what kind of S/ N to expect:
362
+ >> > uid_url_table = Alma.get_data_info(result[' obs_id' ][0 ], expand_tarfiles = True )
363
+ >> > # downselect to just the FITSf files
364
+ >> > fits_urls = [url for url in uid_url_table[' access_url' ] if ' .fits' in url]
365
+ >> > filelist = Alma.download_files(fits_urls[:5 ])
366
+
367
+ You might want to look at the READMEs from a bunch of files so you know what
368
+ kind of S/ N to expect:
357
369
358
370
.. code- block:: python
359
371
.. doctest- remote- data::
360
372
361
373
>> > readmes = [url for url in uid_url_table[' access_url' ] if ' README' in url]
362
- >> > filelist = Alma.download_files(readmes[: 2 ] )
374
+ >> > filelist = Alma.download_files(readmes)
363
375
364
376
365
377
Further Examples
0 commit comments