ALMA Queries (astroquery.alma)

Getting started

astroquery.alma provides the astroquery interface to the ALMA archive. It supports object and region based querying and data staging and retrieval.

You can get interactive help to find out what keywords to query for:

>>> from astroquery.alma import Alma
Valid ALMA keywords:

  Source name (Resolver)           : source_name_resolver
  Source name (ALMA)               : source_name_alma
  RA Dec                           : ra_dec

  Frequency                        : frequency
  Bandwidth                        : bandwidth
  Spectral resolution              : spectral_resolution
  Band                             : 3(84-116 GHz) = 3 , 4(125-163 GHz) = 4 , 6(211-275 GHz) = 6 , 7(275-373 GHz) = 7 , 8(385-500 GHz) = 8 , 9(602-720 GHz) = 9 , 10(787-950 GHz) = 10

  Observation date                 : start_date
  Integration time                 : integration_time

  Polarisation type                : Stokes I = 0 , Single = 1 , Dual = 2 , Full = =3|4

  Water vapour                     : water_vapour

  Project code                     : project_code
  Project title                    : project_title
  PI name                          : pi_name

  (I) View:                        : result_view          = raw
  ( ) View:                        : result_view          = project
  [x] public data only             : public_data          = public
  [x] science observations only    : science_observations = =%TARGET%


Users can log in to acquire proprietary data products. Login is performed via the ALMA CAS (central authentication server).

>>> from astroquery.alma import Alma
>>> alma = Alma()
>>> # First example: TEST is not a valid username, it will fail
>>> alma.login("TEST") 
TEST, enter your ALMA password:

Authenticating TEST on
Authentication failed!
>>> # Second example: pretend ICONDOR is a valid username
>>> alma.login("ICONDOR", store_password=True) 
ICONDOR, enter your ALMA password:

Authenticating ICONDOR on
Authentication successful!
>>> # After the first login, your password has been stored
>>> alma.login("ICONDOR") 
Authenticating ICONDOR on
Authentication successful!

Your password will be stored by the keyring module. You can choose not to store your password by passing the argument store_password=False to Alma.login. You can delete your password later with the command keyring.delete_password('', 'username').

Querying Targets and Regions

You can query by object name or by circular region:

>>> from astroquery.alma import Alma
>>> m83_data = Alma.query_object('M83')
>>> print(len(m83_data))
>>> m83_data.colnames
['Project code', 'Source name', 'RA', 'Dec', 'Band',
'Frequency resolution', 'Integration', 'Release date', 'Frequency support',
'Velocity resolution', 'Pol products', 'Observation date', 'PI name',
'PWV', 'Member ous id', 'Asdm uid', 'Project title', 'Project type',
'Scan intent', 'Spatial resolution', 'QA0 Status', 'QA2 Status']

Region queries are just like any other in astroquery:

>>> from astropy import coordinates
>>> from astropy import units as u
>>> galactic_center = coordinates.SkyCoord(0*u.deg, 0*u.deg,
...                                        frame='galactic')
>>> gc_data = Alma.query_region(galactic_center, 1*u.deg)
>>> print(len(gc_data))

Querying by other parameters

As of version 0.3.4, you can also query other fields by keyword. For example, if you want to find all projects with a particular PI, you could do:

>>> rslt = Alma.query_object('W51', pi_name='Ginsburg', public=False)

Downloading Data

You can download ALMA data with astroquery, but be forewarned, cycle 0 and cycle 1 data sets tend to be >100 GB!

>>> import numpy as np
>>> uids = np.unique(m83_data['Member ous id'])
>>> print(uids)
     Member ous id

You can then stage the data and see how big it is (you can ask for one or more UIDs):

>>> link_list = Alma.stage_data(uids)
INFO: Staging files... [astroquery.alma.core]
>>> link_list['size'].sum()

You can then go on to download that data. The download will be cached so that repeat queries of the same file will not re-download the data. The default cache directory is ~/.astropy/cache/astroquery/Alma/, but this can be changed by changing the cache_location variable:

>>> myAlma = Alma()
>>> myAlma.cache_location = '/big/external/drive/'
>>> myAlma.download_files(link_list, cache=True)

You can also do the downloading all in one step:

>>> myAlma.retrieve_data_from_uid(uids[0])

Downloading FITS data

If you want just the QA2-produced FITS files, you can download the tarball, extract the FITS file, then delete the tarball:

>>> from astroquery.alma.core import Alma
>>> from astropy import coordinates
>>> from astropy import units as u
>>> orionkl = coordinates.SkyCoord('5:35:14.461 -5:21:54.41', frame='fk5',
...                                unit=(u.hour, u.deg))
>>> result = Alma.query_region(orionkl, radius=0.034*u.deg)
>>> uid_url_table = Alma.stage_data(result['Member ous id'])
>>> # Extract the data with tarball file size < 1GB
>>> small_uid_url_table = uid_url_table[uid_url_table['size'] < 1]
>>> # get the first 10 files...
>>> filelist = Alma.download_and_extract_files(small_uid_url_table[:10]['URL'])

You might want to look at the READMEs from a bunch of files so you know what kind of S/N to expect:

>>> filelist = Alma.download_and_extract_files(uid_url_table['URL'], regex='.*README$')

Further Examples

There are some nice examples of using the ALMA query tool in conjunction with other astroquery tools in A Gallery of Queries, especially Example 7.


astroquery.alma Package

ALMA Archive service.




Configuration parameters for astroquery.alma.

astroquery.alma.utils Module

Utilities for making finder charts and overlay images for ALMA proposing


add_meta_to_reg(reg, meta)

approximate_primary_beam_sizes(…[, …])

Using parse_frequency_support, determine the mean primary beam size in each observed band


ALMA footprints have the form: ‘Polygon ICRS 266.519781 -28.724666 266.524678 -28.731930 266.536683 -28.737784 266.543860 -28.737586 266.549277 -28.733370 266.558133 -28.729545 266.560136 -28.724666 266.558845 -28.719605 266.560133 -28.694332 266.555234 -28.687069 266.543232 -28.681216 266.536058 -28.681414 266.530644 -28.685630 266.521788 -28.689453 266.519784 -28.694332 266.521332 -28.699778’ Some of them have additional polygons

make_finder_chart(target, radius, save_prefix)

Create a “finder chart” showing where ALMA has pointed in various bands, including different color coding for public/private data and each band.

make_finder_chart_from_image(image, target, …)

Create a “finder chart” showing where ALMA has pointed in various bands, including different color coding for public/private data and each band.


Create a “finder chart” showing where ALMA has pointed in various bands, including different color coding for public/private data and each band.


ALMA “Frequency Support” strings have the form:

pyregion_subset(region, data, mywcs)

Return a subset of an image (data) given a region.