@@ -163,14 +163,22 @@ Querying by other parameters
163163============================
164164
165165As 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:
167167
168168.. code- block:: python
169169
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
171177
172178The ' ' 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):
174182
175183.. code- block:: python
176184
@@ -191,12 +199,18 @@ format.
191199 -------------------------- - -------------- ------------ - ... ------------------------------------------------------------------------------------ ---------------------- ---------------------- -
192200 ADS / JAO .ALMA # 2016.1.00164.S ALMA JAO ... Starbursts, star formation, Galaxy chemistry Active galaxies 2021-09-30T16:34:41.133
193201
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+
194208
195209Use the ' ' help_tap' ' method to learn about the ALMA ' ObsCore' keywords and
196210their types.
197211
198212.. code- block:: python
199- >> > Alma.help_tap() # doctest: +REMOTE_DATA
213+ >> > Alma.help_tap() # doctest: +REMOTE_DATA +IGNORE_OUTPUT
200214 Table to query is " voa.ObsCore" .
201215 For example: " select top 1 * from ivoa.ObsCore"
202216 The scheme of the table is as follows.
@@ -270,24 +284,26 @@ their types.
270284Downloading Data
271285================
272286
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 !
275289
276290
277291.. code- block:: python
278292.. 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):
291307
292308.. code- block:: python
293309.. doctest- remote- data::
@@ -301,10 +317,10 @@ on the individual files:
301317.. doctest- remote- data::
302318 >> > link_list = Alma.get_data_info(uids, expand_tarfiles = True )
303319
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:
308324
309325.. code- block:: python
310326.. doctest- remote- data::
@@ -332,8 +348,8 @@ download but will return useful information about the state of your downloads:
332348Downloading FITS data
333349==================== =
334350
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 :
337353
338354.. code- block:: python
339355.. doctest- remote- data::
@@ -343,23 +359,19 @@ extract the FITS file, then delete the tarball:
343359 >> > s255ir = coordinates.SkyCoord(93.26708333 , 17.97888889 , frame = ' fk5' ,
344360 ... unit = (u.deg, u.deg))
345361 >> > 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:
357369
358370.. code- block:: python
359371.. doctest- remote- data::
360372
361373 >> > 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)
363375
364376
365377Further Examples
0 commit comments