Examples

The following examples show the use of the task importevla:

importevla(asdm='CLowTest_000',ocorr_mode='ca')

Produces a MeasurementSet (MS) named 'CLowTest_000.ms' that consists of all auto-correlations. No flags are applied, but the online, zero and show flagging are placed in the FLAG_CMD table to be applied at a later stage.

 

importevla(asdm='CLowTest_000')

Produces an MS named 'CLowTest_000.ms', but including only the cross-correlations and no auto-correlations. 

 

importevla(asdm='CLowTest_000',online=True,tbuff=2.0,applyflags=True)

Will apply online flags and uses a more conservative 2sec buffer before the start and after the end timeranges.

 

importevla(asdm='CLowTest_000',online=True,flagzero=False,shadow=False)

This will create the FLAG_CMD sub-table using online flags only, but will not apply them to the MS.

 

importevla(asdm='CLowTest_000',online=True,flagzero=True,shadow=True,applyflags=True)

This will write the online flags, the clip zero values, and flag of shadowed antennas to the FLAG_CMD table. The flagging will also be applied to the data, and the APPLIED column of the FLAG_CMD will be updated to True.

 

importevla(asdm='CLowTest_000',scans='1~3,5,7,9',online=True,flagzero=True,shadow=True,applyflags=False, savecmds=True)

Import only scans 1, 2, 3, 5, 7, 9, save the online, shadow and clip flagging commands to an ASCII file and do not apply the flags. The flags will be saved to 'CLowTest_000_cmd.txt'.

 

You can use either flagdata or flagcmd to apply the flags later with the following commands:

  • Apply all the flags in the file using flagdata

flagdata('CLowTest_000.ms', mode='list', inpfile='CLowTest_000_cmd.txt')

If desired, select by reason only those flagging commands that you want to apply, such as antennas that are not poiting accurately, or correlator data that is invalid:

flagdata('CLowTest_000.ms',mode='list', inpfile='CLowTest_000_cmd.txt', reason=['ANTENNA_NOT_POINTING','CORRELATOR_DATA_INVALID'])

  • Apply all the flags in the file using flagcmd

flagcmd('CLowTest_000.ms',inpmode='list',inpfile='CLTest_000_cmd.txt',action='apply')

 

When flagging shadowed antennas, the parameter addantenna can be use to add additional antennas. addantenna can be either a file name or Python dictionary with additional antenna names, positions and diameters. You can use the flaghelper functions to create the dictionary from a file inside casapy: 

import flaghelper as fh

antdic = fh.readAntennaList(antfile)

Where antfile is a text file in disk that contains information such as:

name=VLA01
diameter=25.0
position=[-1601144.96146691, -5041998.01971858, 3554864.76811967]
name=VLA02
diameter=25.0
position=[-1601105.7664601889, -5042022.3917835914, 3554847.245159178]