Concatinating measurement sets in CASA

Combining data from different spectral windows or different days is quite useful. Quite often I will image these seperately and then combine in the image domain. It is useful, however, to be able to combine these into one measurement set, its just easier to keep track of the files – and time based flagging in the case of many spectral windows is probably the same (e.g. one antenna is down, well it will be for both spectral windows). Anyway, in AIPS this was quite straightforward and it was something I did often. I’ve only just needed a reason todo this in CASA and again its fairly easy. You just need to use the task “concat”. I’ve put together a little script thats in two files from the commandline and runs this, see the code below:
from os import sys #python library to read input from command line
inputfile1 = str(sys.argv[3:][0])
inputfile2 = str(sys.argv[3:][1])
visoutfile = ‘combined.ms’
print inputfile1,inputfile2,visoutfile
concat(vis=[inputfile1,inputfile2], concatvis=visoutfile)
Save this (as concatms.py) and run as:
casapy -c “concatms.py file1.ms file2.ms”
Assuming the two files are different frequency ranges you will end up with a file that has two spectral windows in.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: