5. Download data

The alminer.download_data function allows the user to download the data from the archive directly to a location on the local disk.

General notes about the download function:

  • The default download location is the ‘data’ subdirectory in the current working directory. The desired location can be changed by setting the location parameter to the desired path.

  • To check the amount of disk space needed, the dryrun parameter can be toggled to True which will only stage the data and write to the terminal how much space is required.

  • By default, tar files (including both raw and FITS data products) associated with uids in the provided DataFrame will be downloaded.

  • To download only the FITS data products, the fitsonly parameter can be toggled to True.

  • It is possible to provide a list of strings (to the filename_must_include parameter) that the user wants to be included in the filenames that are downloaded. This is useful to restrict the download further, for example, to data that have been primary beam corrected (‘.pbcor’) or that have the science target (‘_sci’ or the ALMA target name). The choice is largely dependent on the cycle and type of reduction that was performed, and data products that exist on the archive as a result.

  • A list of URLs (files) to be downloaded from the archive can be printed to the terminal by setting print_urls=True.

Load libraries & create a query

To explore these options, we will first query the archive using one of the methods presented in the previous section and use the results in the remainder of this tutorial.

[1]:
import alminer

observations = alminer.keysearch({'target_name':['G31.41']})
================================
alminer.keysearch results
================================
--------------------------------
Number of projects = 11
Number of observations = 26
Number of unique subbands = 138
Total number of subbands = 164
2 target(s) with ALMA data = ['G31.41+0.31', 'G31.41+0.3']
--------------------------------
[2]:
# This step is not necessary, but currently pyvo.dal.query contains
# an Astropy deprecation warning that we prefer to ignore
import warnings
warnings.filterwarnings("ignore")

Example 5.1: download all data products (raw + products)

[3]:
alminer.download_data(observations, fitsonly=False, dryrun=True,
                      location='./data', print_urls=False)
================================
This is a dryrun. To begin download, set dryrun=False.
================================
Download location = ./data
Total number of Member OUSs to download = 26
Selected Member OUSs: ['uid://A001/X12a/X209', 'uid://A002/Xa5ac37/X2e', 'uid://A001/X2fb/X852', 'uid://A001/X2fb/X850', 'uid://A001/X2fb/X84c', 'uid://A001/X2fb/Xcb5', 'uid://A001/X87a/X69c', 'uid://A001/X87a/X696', 'uid://A001/X87a/X69a', 'uid://A001/X87a/X740', 'uid://A001/X87a/X744', 'uid://A001/X1234/X200', 'uid://A001/X129e/X58f', 'uid://A001/X1284/X6d9', 'uid://A001/X1284/X6cd', 'uid://A001/X1284/X6c9', 'uid://A001/X1284/X6c1', 'uid://A001/X1284/X6d5', 'uid://A001/X1284/X6c5', 'uid://A001/X1284/X6dd', 'uid://A001/X1284/X6d1', 'uid://A001/X1284/X209d', 'uid://A001/X1284/X20a1', 'uid://A001/X133d/X327', 'uid://A001/X133d/X325', 'uid://A001/X133d/X21b4']
Number of files to download = 125
Needed disk space = 3.4 TB
--------------------------------

Example 5.2: download only continuum FITS images for the science target

[4]:
alminer.download_data(observations, fitsonly=True, dryrun=True, location='./data',
                      filename_must_include=['_sci', '.pbcor', 'cont', 'G31.41'],
                      print_urls=True)
================================
This is a dryrun. To begin download, set dryrun=False.
================================
Download location = ./data
Total number of Member OUSs to download = 26
Selected Member OUSs: ['uid://A001/X12a/X209', 'uid://A002/Xa5ac37/X2e', 'uid://A001/X2fb/X852', 'uid://A001/X2fb/X850', 'uid://A001/X2fb/X84c', 'uid://A001/X2fb/Xcb5', 'uid://A001/X87a/X69c', 'uid://A001/X87a/X696', 'uid://A001/X87a/X69a', 'uid://A001/X87a/X740', 'uid://A001/X87a/X744', 'uid://A001/X1234/X200', 'uid://A001/X129e/X58f', 'uid://A001/X1284/X6d9', 'uid://A001/X1284/X6cd', 'uid://A001/X1284/X6c9', 'uid://A001/X1284/X6c1', 'uid://A001/X1284/X6d5', 'uid://A001/X1284/X6c5', 'uid://A001/X1284/X6dd', 'uid://A001/X1284/X6d1', 'uid://A001/X1284/X209d', 'uid://A001/X1284/X20a1', 'uid://A001/X133d/X327', 'uid://A001/X133d/X325', 'uid://A001/X133d/X21b4']
Number of files to download = 22
Needed disk space = 185.8 MB
File URLs to download = https://almascience.eso.org/dataPortal/member.uid___A001_X87a_X696.G31.41p0.31_sci.spw0.mfs.I.manual.cont.image.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X87a_X69a.G31.41p0.31_sci.spw25_27_29_31.cont.I.manual.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X87a_X740._G31.41p0.31__sci.spw16_18_20_22_24_26_28_30_32_34_36_38_40.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1234_X200._G31.41p0.31__sci.spw16_18_20_22.cont.I.tt0.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1234_X200._G31.41p0.31__sci.spw16_18_20_22.cont.I.tt1.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X129e_X58f._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6d9._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6cd._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6c9.G31.41p0.31_sci.spw0_1_2_3.cont.I.manual.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6c9.G31.41p0.31_sci.spw25_27_29_31.cont.I.manual.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6c1._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6d5._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6c5._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6dd._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X6d1._G31.41p0.31__sci.spw25_27_29_31.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X209d.G31.41p0.3_sci.spw25.cont.I.manual.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X209d._G31.41p0.3__sci.spw25_27_29_31_33_35_37_39_41_43.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X1284_X20a1._G31.41p0.3__sci.spw25_27_29_31_33_35_37_39_41_43_45_47_49_51_53_55.cont.I.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X327._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt0.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X327._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt1.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X325._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt0.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X325._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt1.pbcor.fits
--------------------------------