Doc 2.12, ver. 2.2 | February 2015

ALMA QA2 Data Products for Cycle 2

ALMA, an international astronomy facility, is a partnership of Europe, North America and East Asia
in cooperation with the Republic of Chile.

For further information or to comment on this document, please contact your regional Helpdesk through the ALMA User
Portal at www.almascience.org. Helpdesk tickets will be directed to the appropriate ALMA Regional Center at ESO,NAOJ or NRAO.

Version

Date

Editors

0.1-0.4

January 2014

Dirk Petry

0.5, 1.0

February 2014

Dirk Petry

2.0, 2.1

September 2014

Dirk Petry

2.2

February 2015

Dirk Petry

Paola Andreani (ESO), Cynthia Herrera (NAOJ), John Hibbard (NRAO), Mark Lacy (NRAO), Arielle Moulet (NRAO), Hiroshi Nagai(NAOJ), Dirk Petry (ESO), Thomas Stanke (ESO), Ken Tatematsu (NAOJ), Baltasar Vila Vilaro (JAO), Eric Villard (JAO)

In publications, please refer to this document as:
Petry, D. et al., 2014, ALMA QA2 Data Products for Cycle 2, Version 2.2, ALMATable of contents
1 Introduction.....................................................................................2
2 Group ObsUnitSet (GroupOUS), Member ObsUnitSet (MemberOUS),
and Scheduling Block (SB)...................................................................2
3 Overview.........................................................................................3
4 Data Delivery Products.....................................................................6
4.1 README................................................................................................6
4.2 Data Reduction Scripts (directory “script”)............................................6
4.3 Imaging Products (directory “product”).................................................6
4.4 CASA Tables (directory “calibration”)....................................................7
4.5 QA Documentation (directory “qa”).......................................................8

5 Generating the calibrated visibilities.................................................9
5.1 Running the scriptForPI.py in the case of analyst-calibrated data............9
5.2 Running the scriptForPI.py in the case of pipeline-calibrated data.........11
5.3 Saving disk space during and after the execution of the scriptForPI.py..13
5.4 Running casa_pipescript.py.................................................................13

6 Imaging the calibrated visibilities....................................................13
7 Available CASA documentation and help..........................................14

1

1 Introduction
The goal of ALMA Quality Assurance (QA) is to ensure that a reliable final data product isdelivered to the PI, that is, that the product has reached the desired control parameters
outlined in the science goals, that is calibrated to the desired accuracy and contains no
significant calibration or imaging artifacts. For Cycle 2, as for Cycle 0 and 1, QA will bedone on a “best effort” basis, covering all the major issues affecting data quality.
The second level of Quality Assurance (QA2) deals with QA at the level of data reduction
using the Science Pipeline or performed semi-interactively by the ALMA Data Reducers
Team. This document describes the final science data products that are delivered to PIs(and the archive) at the end of the QA2 process.
The ALMA QA2 data reduction team performs for each ALMA science data set a detailed
analysis to confirm that the observations have achieved the science goals requested by
the PI. In particular, frequency setup, spatial setup, and continuum and/or line detection
sensitivity are verified.
If the requirements are met within the tolerances specified in chaper 11 of the ALMA
Technical Handbook, the data are declared “QA2 pass”, packaged in a standardized way,
and delivered to the PI. The delivery is made in two parts:(a) the science products and supporting material(b) (optionally) the raw data.
Part (b), the raw data, consist of visibility datasets in ALMA's native format, the ASDM,
which are only needed if the PI would like to perform custom data calibration andimaging. Part (a) of the delivery on the other hand, the “QA2 Products”, consists of the
QA2 data reduction scripts, log files, calibration, and flagging tables, and the imaging
products on which the quality assurance decision was based. This document describes
the contents of the Products section of the delivery in detail and is aimed at ALMA users.
Up to September 2014, the QA2 work was entirely performed by analysts using the QA2
script-generator tool. We refer to data processed in this way as “analyst-calibrated”. In
September 2014, the ALMA Science Pipeline became available and is now used tocalibrate most of the data taken in standard observing modes. We refer to dataprocessed by the Pipeline as “pipeline-calibrated” data. The user can tell whether thedata is pipeline-calibrated by the presence of a “PPR*.xml” file in the “script”
subdirectory of the delivery package (see section 4).

2 Group ObsUnitSet (GroupOUS), Member ObsUnitSet(MemberOUS), and Scheduling Block (SB)By design, the smallest scheduling entity which is processed and delivered individually is
the Member ObsUnitSet (MemberOUS or MOUS). QA2 therefore is carried out on
individual MemberOUSs.

In Cycles 1 and 2, the MemberOUS contains in almost all cases only one Scheduling Block(SB), even in the case of Total Power Array observations.
Hence, in Cycles 1 and 2, QA2 is carried out together on all the Execution Blocks (EBs) ofa single SB corresponding to one MemberOUS. The products for each MemberOUS aredelivered separately, and the delivery of the products for each MemberOUS is labeledwith the MemberOUS UID.
The MemberOUSs are organized into Group ObsUnitSets (in short: GroupOUSs). In thetrivial case there is only one GroupOUS for each Science Goal. In Cycles 1 and 2, at most
five MemberOUSs can be in one GroupOUS:a) The 12 m Array MemberOUS(s) (up to two)b) The 7 m Array MemberOUSc) The Total Power observation MemberOUSd) The Total Power calibration MemberOUS (may be omitted)
Once all MemberOUSs of a GroupOUS have passed QA2, another QA2 step has to takeplace which performs the combined imaging of the up to three elements: 12 m Array,
Total Power Array, and 7 m Array. The delivery of the resulting products will be labeledwith the GroupOUS UID.
The delivery packaging results in a tar file which is named in the following way:
<Project ID>_<MemberOUS_UID>_m_of_n.tar
for each member where n is the total number of tar files into which the delivery is split(for faster transfer) and m is the number of the individual tar file (typically both m and n
are 1 since these files are usually small).
GroupOUS deliveries only take place for the case there is more than one MemberOUS in
the GroupOUS and in that case the PI will receive the products for each MemberOUS
separately and then one more delivery for the combination products. The latter will be ina tar file named<Project ID>_<GroupOUS_UID>_m_of_n.tar

3 Overview
An ALMA data delivery consists of the seven items shown in the directory tree below.
Items 1 to 6 are delivered in one package (part (a)) which should be downloaded first.
Item 7 (part (b)) is available for download separately and is only required if the users
would like to work with the visibility data. Once unpacked, all data falls into astandardized directory structure:|-- project_id/| |-- sg_ouss_id/| | |-- group_ouss_id/| | | |-- member_ouss_id/| | | | |-- README(1)| | | | |-- product/(2)| | | | |-- calibration/ (3)| | | | |-- qa/(4)| | | | |-- script/(5)| | | | |-- log/
(6)
| | | | |-- raw/
(7)

(only present when part (b) was unpacked)

The directory contents is summarized in the following. When an item is marked as “besteffort” this means that it is generated by the analysis team when sufficent resources areavailable and it is compatible with the science goal.
1) README— a text file summarizing the QA2 results and explaining structure of tarball and filenaming conventions2) Imaging Products (in FITS format) in subdirectory “product”a) Line:— For each spectral window: One spectral cube of “representative channels” for atleast one target in the MemberOUS, made at the achieved spatial and the requested
spectral resolution considering the bandwidth specified for sensitivity. If the achieved
spatial resolution was higher than requested, tapering may have been applied if
needed to reach the science goal. Coarse continuum subtraction is applied forsources with bright continuum. This applies both to deliveries of single MemberOUSs
and to combined datasets— (best effort) For each source and each spectral window: cubes of all species
specifically listed in the proposal, made at full spatial resolution and the relevant
spectral resolution and including line-free channels on either side. Continuum
subtraction is applied for sources with bright continuum. A note will be added if
additional species are found in the data, but imaging may not be carried out.
— (best effort) For the same source with multiple non-continuum spectral windows:
line cubes should be made with constant velocity channels sampled on the same gridand covering the same velocity range.
— (best effort) Zeroth moment of each line cube
— (best effort) Continuum image of all non-edge, non-line channelsb) Continuum:— One image of all continuum spectral windows, all non-edge channels— (best effort) One image per sideband, all non-line channels

c) for pipeline-calibrated data, in addition to (a) and (b):— Continuum images of the bandpass and phase calibrators for each of the science
spectral windows
3) CASA Tables (in CASA Table format) in subdirectory “calibration”a) for pipeline-calibrated data
— Calibration tables (Tsys, WVR, Bandpass, Gain, Amplitude)— Flagversions tables— Calibrator fluxes (flux.csv)— Pipeline metadata (*calapply.txt and *flagtemplate.txt)b) for analyst-calibrated data
— Calibration tables (Tsys, WVR, Bandpass, Gain, Amplitude)— Flagversions tables
4) QA documentation in subdirectory “qa”a) for pipeline-calibrated data
— The Pipeline Weblog – a system of webpages containing all the diagnostic plots andother information generated by the pipeline.
b) for analyst-calibrated data
— QA Reports for all the imaged data (png images and pdf files).
5) Data Reduction Scripts (ASCII files) in subdirectory “script”a) for pipeline-calibrated data
— the Python scripts needed to restore the calibrated MS or rerun the entire pipeline— the pipeline processing request file (PPR)— the flux equalisation script (if necessary) and the imaging scriptb) for analyst-calibrated data
— CASA reduction scripts including: calibration scripts, flux equalization script (ifnecessary), imaging script, and script to apply calibrations.
6) calibration and imaging log files in subdirectory “log”— CASA log files from the QA2 processing7) Datasets (in ASDM format) in subdirectory “raw” (if downloaded)— (for optional download) the ExecBlocks that were used in the imaging/QA2
assessment— (for optional download if applicable) Additional datasets that were NOT used in thedata reduction but may still contain valuable scientific information

4 Data Delivery Products
4.1 README
The first item the user should inspect after unpacking the delivery tar file (part (a)), is
the README file. It contains a summary of the QA2 results, in particular the achieved
beam and image noise RMS.

4.2 Data Reduction Scripts (directory “script”)
In the subdirectory “script”, the user finds the CASA data reduction scripts (Python)
which were used to calibrate and image the data. Depending on whether the ALMA
automated Pipeline was used or the data was “manually” calibrated by an analyst, thecontents of this directory varies:
1) uid....ms.scriptForCalibration.py: one calibration script for each Execution Block ofmanually calibrated data
2) scriptForFluxCalibration.py (if necessary): if there was more than one Execution
Block (EB), and they were observed within one day from each other, a combined
flux calibration may be done assuming that the phase calibrator had the same
intensity during all executions. This script performs this procedure. It may also
concatenate all calibrated MSs into one if it is necessary for imaging. The result is
a combined dataset of all executions. Also for single-EB datasets, this script may
be present and contain commands for imaging preparation.
3) scriptForImaging.py: this script regenerates the imaging products (see next
section) as they are stored in the “products” subdirectory of the delivery.
4) scriptForPI.py: run this script in the “script” directory in order to regenerate thecalibrated MeasurementSet of the delivered data. The README file contains
instructions on how to do this. Running the scriptForPI.py requires that you havedownloaded the ASDM datasets and unpacked them such that they reside in the“raw” directory (created during unpacking). See Section 5 for more details.
5) casa_piperestorescript.py: This script is used by scriptForPI.py to restore thecalibrates MS(s) from the raw ASDMs by applying the necessary calibration tables.
This is only provided in the case of pipeline calibration.
6) casa_pipescript.py: Performs the calibration from scratch using Pipeline tasks. See
the Pipeline documentation (see Section 7) for more details.
7) the pipeline processing request (PPR): an XML file which was used to drive thePipeline calibration. Also described in the Pipeline documentation (see Section 7).

4.3 Imaging Products (directory “product”)
The “product” subdirectory of the delivery contains the imaging products that weregenerated with the script “scriptForImaging.py” from the “script” subdirectory based onthe calibrated dataset which is obtained when the “scriptForPI.py” is run. For pipelinecalibrated data it also contains calibrator images generated by the Pipeline.
For ALMA Early Science (Cycles 0-2), ALMA products are offered at a "best efforts" basis.
The goal is that the calibration is reliable and "science ready", but the imaging products
may not be. Enough imaging has been done to ensure that the data meet the science
goals set by the PI (resolution and sensitivity), within some tolerance, but the imaging
may be incomplete and not "science ready". Investigators should expect to need to reimage their data, using the provided scripts as a guideline. In particular, care should betaken to optimize continuum subtraction (if relevant) and fine-tune the image
deconvolution parameters (e.g. clean masks and thresholds).
Care has been taken that the images conform with the latest FITS standard (3.0).
Where necessary (i.e. where they are not supplied analytically within thescriptForImaging.py text), the imaging masks are provided as CASA images. These
represent the final mask used in the last cleaning iteration. The masks used in previous
iterations may have been different (tighter).
The science images included in the typical delivery are corrected for the primary beam
(PB), i.e. the dependence of the instruments sensitivity on direction within the FOV.
For each image, two files are being delivered:a) the PB-corrected image (file name ending in ".pbcor.fits")b) the image of the PB which was used in the correction (ending in ".flux.fits")
The image noise was measured in the uncorrected image. The corrected image (a) was
then obtained by dividing the uncorrected image by the PB image (b). The uncorrected
image can be recovered using the CASA task “impbcor” in mode "m":impbcor(imagename='image.pbcor.fits',pbimage='image.flux.fits',
mode='m', outfile='image.recovered')

4.4 CASA Tables (directory “calibration”)
In order to document further the process of data calibration, all calibration tables
generated by the calibration process are stored in the “calibration” subdirectory of thedelivery.
In the case of analyst-calibrated data, information on how each table was created can belooked up in the scriptForCalibration.py and the scriptForFluxCalibration.py scripts. CASA
provides functionality to view these tables. Please refer to the CASA documentation (seeSection 7) on how to do that. Many of the plots of interest in this context are, however,also already available in the QA documentation (see next section).
In the case of Pipline-calibrated data, the files in this directory are needed to restore thecalibrated MS with “casa_piperestorescript.py” which in turn is called by “scriptForPI.py”.
For details on how they were generated, please refer to the Pipeline documentation (seeSection 7). All diagnostic plots are also in this case already available in the Pipeline
Weblog which can be found in directory “qa” (see next section).

4.5 QA Documentation (directory “qa”)
In the subdirectory “qa” of the delivery, the user finds diagnistic plots obtained during
the calibration.
In the case of analyst-calibrated data, there are, for each execution block and labeledwith the execution block UID, several png images and a textfile which together form theso-called “QA2 report” for the execution block.
The png files can be viewed with standard system tools such as “display” (under Linux).
They show a set of diagnostic plots describing the following aspects of the data:
1) Observing Schedule (observation intent vs. time)2) Mosaic Pointing Configuration
3) Antenna Array Configuration
4) Effectiveness of the WVR correction for each antenna5) Temporal gain calibration solutions for each antenna
6) Temporal phase calibration solutions for each antenna7) Average bandpass solution for each spectral window
8) System Temperature vs. frequency for each antenna and each spectral window
9) Phase calibrator amplitude and phase vs. frequency for each spectral window andpolarisation
10)Flux calibration model and data (visibility amplitude vs. UV distance)11)Target visibility amplitude vs. UV distance for each spectral window andpolarisation
12)Phase calibrator amplitude and phase vs. frequency for each spectral window andpolarisation
13)Target field UV coverage14)Test image of the target
15)Target imaging synthesized beam (PSF)
The contents of the uid*textfile.txt file is mostly selfexplanatory. Of particular interest is
the “Check of a target image and sensitivity” which mentions approximately theachieved spatial resolution and sensitivity. Note that the finally achieved resolution andsensitivity could be different (since it might have used additional procedures in imaging).
It is mentioned in the README file.
Based on the calibration tables in the “calibration” directory, the user can produce
additional diagnostic plots in CASA using the tasks plotms, plotcal, and plotbandpass(CASA 4.2 and later). See the CASA documentation for more details.
If additional diagnostic plots on the visibility data itself are required, the calibrated
MeasurementSet (MS) first has to be generated from the raw data (see the next section).
Once this is done, the CASA task plotms should be used to generate the plots.

In the case of pipeline-calibrated data, all diagnostic information is assembled in asystem of html pages which is called the Weblog. To access the Weblog, run
tar xvzf *weblog.tar.gz
in the “qa” directory and then use your favourite web browser to open the resulting filepipeline*/html/index.html
For more information on the contents of the Weblog, please refer to the Pipeline
documentation (see Section 7).

5 Generating the calibrated visibilities
In ALMA Cycle 0 and early Cycle 1, the visibility data were delivered with all otherproducts in ready-to-use MeasurementSet (MS) format. Since the middle of Cycle 1, theproducts are separated from the raw visibility data (as described in the introduction), anddownloads of the latter are now optional. To minimize download time, the raw visibilities
are delivered in the native ALMA format, the ASDM (ALMA Science Data Model).
If the user would like to only modify or extend the imaging of the dataset but accept theobservatory calibration of the data, he/she needs to download the raw data and apply
the calibration via the scripts provided with the delivery as described in the following.
Otherwise, the user can only download the raw data and use the calibration scripts as a
guidance and develop a custom calibration.
The download of the raw data depends on the details of where the data were staged fordelivery. The user should refer to the information in the delivery email as to how exactly
the raw data should be obtained. Unless there is a technical problem, this will work via
the ALMA Archive Request Handler. See http://almascience.eso.org/alma-data .

5.1 Running the scriptForPI.py in the case of analystcalibrated data
Once the data products tar file is downloaded and unpacked, the user finds a directory
structure on disk which is described in section 3 and also at the end of the README fileincluded in the delivery. The following directory tree shows an example of analystcalibrated (rather then pipeline-calibrated) data. However, also for pipeline-calibrated
data, the procedure for running “scriptForPI.py” is the same and has essentially the same
final product.

|-- 2012.1.12345.S/| |-- sg_ouss_id/| | |-- group_ouss_id/

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|-- member_ouss_id/| |-- README| |-- script/| | |-- scriptForPI.py| | |-- scriptForImaging.py| | |-- scriptForFluxCalibration.py| | |-- uid___A002_X12345_Xa2d.ms.scriptForCalibration.py| | |-- uid___A002_X12345_Xbcd.ms.scriptForCalibration.py| |-- calibration/| | |-- uid___A002_X12345_Xa2d.calibration.tgz| | |-- uid___A002_X12345_Xa2d.calibration.plots/| | |-- uid___A002_X12345_Xbcd.calibration.tgz| | |-- uid___A002_X12345_Xbcd.calibration.plots/| |-- qa/
| | |-- uid___A002_X12345_Xa2d__textfile.txt| | |-- uid___A002_X12345_Xa2d__qa2_part3.png| | |-- uid___A002_X12345_Xa2d__qa2_part2.png| | |-- uid___A002_X12345_Xa2d__qa2_part1.png| | |-- uid___A002_X12345_Xbcd__textfile.txt| | |-- uid___A002_X12345_Xbcd__qa2_part3.png| | |-- uid___A002_X12345_Xbcd__qa2_part2.png| | |-- uid___A002_X12345_Xbcd__qa2_part1.png| |-- product/| | |-- NGC1234.cont.dirty.fits| | |-- NGC1234.CO_21.dirty.fits| |-- log/
| | |-- combined.log| | |-- uid___A002_X12345_Xa2d .calibration.log| | |-- uid___A002_X12345_Xbcd.calibration.log

This dataset has two Execution Blocks (EBs) with UIDs “uid___A002_X12345_Xa2d” and“uid___A002_X12345_Xbcd”. In the directory “script” is has therefore two scripts forcalibration:| | | | | |-- uid___A002_X12345_Xa2d.ms.scriptForCalibration.py| | | | | |-- uid___A002_X12345_Xbcd.ms.scriptForCalibration.py
and, since apparently a common flux calibration was necessary, a script to combine thedata from the two EBs is present:| | | | | |-- scriptForFluxCalibration.py
Furthermore, like in every delivery, the directory “script” contains the scripts“scriptForImaging.py” and “scriptForPI.py”.
The user is encouraged to inspect all these scripts as they also may contain helpfulcomments on special properties of the data.

Unpacking the raw data after download should be done at the top level (in the directory
containing the directory 2012.1.12345.S in this example). It should result in an additional
directory “raw” at the level of the directory “script”:
|
|
|

|
|
|

|
|
|

|
|
|

|-- raw/| |-- uid___A002_X12345_Xa2d.asdm.sdm| |-- uid___A002_X12345_Xbcd.asdm.sdm

In order to just reproduce the observatory calibration, the user can then run the“scriptForPI.py” by typing at the shell prompt of the operating system:> cd script> casapy ­c "execfile('scriptForPI.py')"
This will first perform various tests on the directory structure and the presence of thenecessary files and then run the corresponding scriptForCalibration on each of the
ASDMs. If there is more than one ASDM and an alignment of the flux calibrations wasdeemed necessary by the QA2 process, the scriptForFluxCalibration will be present andwill be run as well.
The results will be placed in a new directory “calibrated” at the same level as the
directories “raw” and “script”:
|
|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|

|-- calibrated| |-- calibrated.ms| |-- uid___A002_X12345_Xa2d.calibration| |-- uid___A002_X12345_Xa2d.ms.split.cal| |-- uid___A002_X12345_Xbcd.calibration| |-- uid___A002_X12345_Xbcd.ms.split.cal

The final calibrated visibility data combined for all EBs can in this case be found in theMS “calibrated.ms”. The intermediate output of CASA to achieve the calibration of each
EB is stored in the calibration working directories:| | | | | |-- uid___A002_X12345_Xa2d.calibration| | | | | |-- uid___A002_X12345_Xbcd.calibration
while the calibrated visibilities for each EB individually are stored in the MSs with names
ending in “.ms.split.cal” (if there is only one EB, this MS will take the role ofcalibrated.ms).

5.2 Running the scriptForPI.py in the case of pipelinecalibrated data
The following shows the contents of the directory tree for the data set discussed in theprevious section, however, for the case that the data was pipeline-calibrated. This caneasily be seen from the fact that there is a file “PPR*.xml” present in the “script”

directory. As for analyst-calibrated data, you find the “scriptForPI.py” in the “script”
directory as well.
|-- 2012.1.12345.S/| |-- sg_ouss_id/| | |-- group_ouss_id/| | | |-- member_ouss_id/| | | | |-- README| | | | |-- script/| | | | | |-- scriptForPI.py| | | | | |-- scriptForImaging.py| | | | | |-- scriptForFluxCalibration.py| | | | | |-- PPR_uid___A002_X6789_Xabc.xml| | | | | |-- casa_piperestorescript.py| | | | | |-- casa_pipescript.py| | | | |-- calibration/| | | | | |-- flux.csv| | | | | |-- uid___A002_X6789_Xabc.session_1.caltables.tar.gz| | | | | |-- uid___A002_X12345_Xa2d.ms.calapply.txt| | | | | |-- uid___A002_X12345_Xa2d.ms.flagversions.tar.gz| | | | | |-- uid___A002_X12345_Xa2d_flagtemplate.txt| | | | | |-- uid___A002_X12345_Xbcd.ms.calapply.txt| | | | | |-- uid___A002_X12345_Xbcd.ms.flagversions.tar.gz| | | | | |-- uid___A002_X12345_Xbcd_flagtemplate.txt| | | | |-- qa/| | | | | |-- uid___A002_X6789_Xabc.weblog.tar.gz| | | | |-- product/| | | | | |-- NGC1234.cont.dirty.fits| | | | | |-- NGC1234.CO_21.dirty.fits| | | | | |-- uid___A002_X6789_Xabc.J0538_4405_bp.spw17.fits| | | | | |-- uid___A002_X6789_Xabc.J0538_4405_bp.spw19.fits| | | | | |-- uid___A002_X6789_Xabc.J0538_4405_bp.spw21.fits| | | | | |-- uid___A002_X6789_Xabc.J0538_4405_bp.spw23.fits| | | | | |-- uid___A002_X6789_Xabc.J0550_5732_ph.spw17.fits| | | | | |-- uid___A002_X6789_Xabc.J0550_5732_ph.spw19.fits| | | | | |-- uid___A002_X6789_Xabc.J0550_5732_ph.spw21.fits| | | | | |-- uid___A002_X6789_Xabc.J0550_5732_ph.spw23.fits| | | | |-- log/
| | | | | |-- imaging.log| | | | | |-- uid___A002_X6789_Xabc.casa_commands.log
In order to run “scriptForPI.py” on pipeline-calibrated data, you will need to make surethat you have the CASA version with pipeline installed and that you start up CASA in theworking directory “script” using
casapy ­­pipeline
At the CASA prompt then type

execfile('scriptForPI.py')
The final calibrated MSs will be placed in the directory “calibrated” with names ending in“.ms.split.cal”.

5.3 Saving disk space during and after the execution of thescriptForPI.py
The ALMA data sets are increasingly large. If the user would like to save disk space andonly work with the calibrated data once it was regenerated with “scriptForPI.py”, he/shecan either delete all calibration directories (cd calibrated; rm ­rf *.calibration) or, incase of analyst-calibrated data, only delete some or all of the intermediate MSs
contained in the calibration directories using, e.g.,
cd calibrated; rm ­rf *.calibration/*.ms; rm ­rf *.calibration/*.ms.split

Since the middle of Cycle 1, the scriptForPI.py also offers the “SPACESAVING” option tolimit the disk space usage during and after the run of the scriptForPI.py. In order to makeuse of this, the Python global variable SPACESAVING needs to be set before starting thescript, e.g. using> cd script> casapy ­c "SPACESAVING=N; execfile('scriptForPI.py')"where N is an integer from 0 to 3 with the following meaning:
SPACESAVING

=0
=1
=2
=3

same as not set (all intermediate MSs are kept)
do not keep intermediate MSs named *.ms.split
do not keep intermediate MSs named *.ms and *.ms.split
do not keep intermediate MSs named *.ms, *.ms.split,
and *.ms.split.cal (if possible)

With SPACESAVING=0, the required additional diskspace is up to 14 times as large as thedelivered data (products and rawdata) while with SPACESAVING=3 (maximum savings),
it is up to 6 times as large. The script will estimate the required disk space and will not
execute if there is not sufficient free space available.

5.4 Running casa_pipescript.py
In the case of pipeline-calibrated data, there is an alternative way to generate thecalibrated visibilities. It uses the script “casa_pipescript.py” which in principle can be
modified by the user to adjust the calibration. The details of this path are described in
the Pipeline documentation (see Section 7 below).

6 Imaging the calibrated visibilities
Once the calibrated visibilities were generated either as described in the previous
sections or through a customized calibration procedure, the user can proceed to imagethem.

If lines have been detected over a significant continuum, it should be considered toperform a continuum subtraction using the CASA task uvcontsub beforehand. In any
case, the imaging script “scriptForImaging.py” from the directory “script” of the delivery
can be taken as an example to build on.
The main tool for imaging in CASA is the task clean. A detailed description of the usageof this task and its many parameters goes beyond the scope of this document. We referagain to the CASA documentation.

7 Available CASA documentation and help
For more information on the usage of CASA, please refer to the CASA home page
http://casa.nrao.edu/
in particular the user reference and cookbook
http://casa.nrao.edu/Doc/Cookbook/casa_cookbook.pdf
Detailed examples are given in the ALMA guides
http://casaguides.nrao.edu/index.php?title=ALMAguides
and the “ALMA Science Pipeline Quickstart Guide” is available fromhttp://almascience.eso.org/documents-and-tools
If you have any problems with your ALMA data, please contact the ALMA helpdesk athttps://help.almascience.org/