+
CASA
Tutorial
in UM2017	 
mostly on interferometricpipeline products	 
Fumi Egusa (NAOJ)	 

1	 
Dec. 27, 2017	 

2017 ALMA/45m/ASTE Users Meeting	 +2	 Outline	 
https://alma-intweb.mtk.nao.ac.jp/~fegusa/UM2017/casa.html	 
1.

What’s inside the delivery package? + SnooPI

2.

Brief summary of pipeline and weblog

3.

Not happy with the pipeline products?

n Please do not hesitate to ask questions!
n You can stop us whenever you want.
n 質問は日本語でもOKですn Stupid questions do not mean that you are stupid! We regard that

there is a room for improvement for us to provide a better guidance!	 
2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

Brief Summary of+ (interferometric) Pipeline
and Weblog	 
contents partially overlap with tutorial in UM2016
We offer f2f support for PIs.	 

Dec. 27, 2017	 

2017 ALMA/45m/ASTE Users Meeting	 

3	 

+

4	 

Where to Check in Weblog 	 n overall: Warnings (and Errors)n calibration: hif_applycal,	 hifa_gfluxscalen imaging: hif_findcont	 2017 ALMA/45m/ASTE Users Meeting	 

Example:SV Band5 Arp220 datawith the latest Pipeline	 

Dec. 27, 2017	 

+5	 

Where to Check in Weblog	 Warnings (and Errors)	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

6	 

Where to Check in Weblog	 
Warnings (and Errors)	 
n Flag summary is also useful	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

7	 

Where to Check in Weblog	 
17. hif_applycal	 n check the overall results of calibration	 

y-axis	 x-axis	 amplitude	  frequency	 phase	 

uvdistance	 
time	 

In most cases, plots should beflat after calibration!	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

8	 

Where to Check in Weblog	 
17. hif_applycal	 2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

9	 

Want to Reproduce the Plots?	 

Click figure -> “Plotcommand”
You need uid*.ms!
If you want to see plots
in plotms window, set
plotfile=‘’showgui=True
Want to identify baddata? Use “locate” inplotms!	 
2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

10	 

Where to Check in Weblog	 
17. hif_applycal	 BP, AMP, PHASE, CHECK, target	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

11	 

Where to Check in Weblog	 
17. hif_applycal	 2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

12	 Where to Check in Weblog	 
15. hifa_gfluxscale	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

13	 

Where to Check in Weblog	 
15. hifa_gfluxscale	 n The ratio is sometimes far from 1.0... Does this mean thecalibration is wrong?	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

14	 

Check the Source Catalog	 
https://almascience.nao.ac.jp/sc	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

15	 

BANDPASS calibrators are generally
observed frequently enough for flux
calibration.	 

2016-07-16	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

16	 However, PHASE calibrators (andCHECK sources) are NOT!	 

2016-07-16	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+17	 

Where to Check in Weblog	 
15. hifa_gfluxscale	 n If BANDPASS != AMPLITUDEn

usually OK to believe flux ratios for BANDPASSn If BANDPASS = AMPLITUDEn

you may want to better estimate PHASE flux valuesn

use aU.getALMAFlux and interpolate using two nearby measurementsnaU.getALMAFlux(‘J1924-2914’,180.030,date=‘20160429’)naU.getALMAFlux(‘J1924-2914’,180.030,date=‘20170126’,highband=6)n

ref: https://casaguides.nrao.edu/index.php/Analysis_Utilities, https://safe.nrao.edu/wiki/bin/view/Main/CasaExtensionsn If PHASE or CHECK is weak (e.g. with low S/N)n

fluxscale may give a wrong flux valuen

measure flux in image!	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

18	 

Where to Check in Weblog	 
26. hif_findcont	 
n Pipeline automatically identifies frequency ranges forcontinuum, but the results may not be optimal.	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 +

19	 

If you care positional accuracy ...	 
20. hif_makeimages	 n Check CHECK source imagesn CHECK source is observedn only for high-frequency or high-resolution observationsn several times during an executionn The PHASE solutions are applied toBP, AMP, PHASE,CHECK, target	 

both CHECK and target sourcesHome -> uid*.ms -> Sky Setup	 2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

20	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

21	 

What’s New in CASA 5.1.1 Pipeline	 
c.f. PL User’s Guide, Sec. 3	 n low S/N heuristicn Cycle 4: combining SPWs onlyn Cycle 5: transferring temporal phase solutions from a high S/NSPW to a low S/N SPWn imaging with requested frequency widthn only if the request is larger than 4x native channel widthn tclean automaskn not pipeline, but CASAn automatically identifies area with significant emission in residualmap

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

22	 

automask	 

PB mask	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+ Not Happy with Pipeline
Products?	 
How to reprocess your data according to your science.
If you find a serious problem in the products, please report it via
Helpdesk!
We also welcome feature requests!	 

Dec. 27, 2017	 

2017 ALMA/45m/ASTE Users Meeting	 

23	 +24	 

1. Get Calibrated MS	 n run scriptForPI.pyn access to an FTP siten EA-ARC service only for PIs in Japanese institutesn data available for 31 days after the deliveryn Guideline for reprocessingn PL User’s Guide Sec. 6n https://casaguides.nrao.edu/index.php/

ALMA_Cycle_5_Imaging_Pipeline_Reprocessing

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 +25	 

2. Re-imaging with Pipeline	 
a. add flags	 
n need to add flags for calibrators and to run the calibration

Pipeline again?
n add flags in uid*flagtemplate.txt
n to run calPL only: execute “casa_pipescript.py” which contains

calibration commands onlyn ref: PL User’s Guide, Sec. 5.4n need to add flags for target sources only?
n add flags in uid*flagtargetstemplate.txt
n to run imgPL only: execute “casa_pipescript.py” which contains

imaging commands only

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

casa_pipescript.py	 

26	 

uid*flagtemplate.txt

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

27	 

2. Re-imaging with Pipeline	 b. change continuum ranges	 n Pipeline automatically identifies frequency ranges forcontinuum, but you may have a better idea than Pipeline!
n edit “cont.dat”
n then execute “casa_pipescript.py”	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

28	 

2. Re-imaging with Pipeline	 c. change robustness parameter	 n The default robustness parameter for QA2 is 0.5.
n e.g. hif_makeimages(robust=2.)n hif_makeimlistn e.g. hif_makeimlist(specmode=‘cube’,spw=‘25’,nbins=2)n image size and cell size can also be changedn The “help” and “inp” commands work for these pipelinetasks.	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 +29	 

3. Re-imaging Manually	 n want to change mask,

threshold, etc?

n could be done with

hif_makeimages,	 but I have nottested yet.
n just running tclean could befaster and morestraightforwardn CASA commands used for
Pipeline are recorded in“casa_commands.log”
n find a corresponding tcleancommand and modifyparameters

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+

30	 

3. Re-imaging Manually	 n multi-scale clean?
n https://casa.nrao.edu/casadocs/casa-5.1.1/global-task-list/task_tclean/examplesn want to selfcal?
n c.f. manual calibration and imaging scripts for SV Band5 Arp220	 2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 

+
Appendix	 Dec. 27, 2017	 

2017 ALMA/45m/ASTE Users Meeting	 

31	 

+

32	 

Links	 n SV Band5 Arp220n https://alma-dl.mtk.nao.ac.jp/ftp/alma/sciver/Arp220/n Pipeline User’s Guiden https://almascience.nao.ac.jp/documents-and-tools/alma-science-

pipeline-users-guide-casa-5-1.1n CASA guide for image reprocessingn https://casaguides.nrao.edu/index.php/

ALMA_Cycle_5_Imaging_Pipeline_Reprocessingn CASAの使い方（日本語）n http://alma-intweb.mtk.nao.ac.jp/~saigo/EAARC_CASA/index.htmln Tutorial in UM2016n http://alma-intweb.mtk.nao.ac.jp/~nagai/tutorial/tutorial.htmln https://youtu.be/cwyrtf15OJs	 

2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017	 +33	 

Interested in Running Pipeline byYourself?	 
n Download the ASDMn Run cal+img PLn h_init()

This is for the SV Arp220 data with
CASA 5.1.1 Pipeline.
Some steps/parameters need to bechanged depending on data and
CASA versions.	 

n hifa_importdata(vis=[‘uid___A002_Xb56f17_X164’],pipelinemode=‘automatic’)n h_save()n es.correctMyAntennaPositions([‘uid___A002_Xb56f17_X164.ms’])n import pipeline.recipereducer as recipereducern recipereducer.reduce(vis=[‘uid___A002_Xb56f17_X164’],procedu

re=‘procedure_hifa_calimage.xml’)2017 ALMA/45m/ASTE Users Meeting	 

Dec. 27, 2017