SMA Quick Links
DR home
Convert format
Using CASA
Tutorials
FAQs

pyuvdata with the SMA


Visit the pyuvdata SMA issues page to see current known issues and report any new SMA related ones.

Pyuvdata is a python interface to interferometric datasets. This package has wide functionality and allows the conversion of datasets from one format to another with multiple data formats supported. On this page we demonstrate the conversion of raw MIR format SMA data into a CASA measurement set and UVFITS format.


On the RTDC

Pyuvdata is installed on the RTDC within conda environments. You can find a list of available environements by doing

$ conda env list

There are two pyuvdata versions available - pyuvdata_stable and pyuvdata_devel. The first is the stable released version available through conda-forge, the second has more development features which may not be comprehensively tested. You can activate your preffered option with

$ conda activate pyuvdata_stable


External download

For users outside the RTDC the package can be installed with conda.

$ conda install -c conda-forge pyuvdata


Run pyuvdata

Follow the template below to create an executable script. The read_mir command allows you to extract a subset of the original data - you can find examples below.

#! /opt/anaconda3/envs/pyuvdata_stable/bin/python

import os
from pyuvdata import UVData

# Get path to current working directory
cwd = os.getcwd()

UV = UVData()

####### SELECT WHICH DATA YOU WANT TO EXRTRACT #######

# Read in all receivers, sidebands and chunks. The Tsys is being applied by default.
UV.read_mir("/sma/data/flux/mir_data/210808_13:37:36")

# Read in only the chunk 3 & 4 230GHz receiver data. The Tsys is being applied by default.
UV.read_mir("/sma/data/flux/mir_data/210808_13:37:36", receivers='230', corrchunk=[3,4])

# Read in LSB chunk 0 data for both receivers. Chunk 0 is the continuum channel. Tsys is not applied.
UV.read_mir("/sma/data/flux/mir_data/210808_13:37:36", sideband='l', corrchunk=[0], apply_tsys=False)

####### SELECT THE OUTPUT FORMAT #######

# Write out to measurement set
UV.write_ms(cwd+"/210808_133736.ms")

# Write out to uvfits
UV.write_uvfits(cwd+"/210808_133736.uvfits", spoof_nonessential=True)

The construction of the script above means the output file/directory will be written to your current working directory. Omit the cwd elements if you want to define an explcit path for the output.

The links below will direct you to the pyuvdata docmentation describing all available arguments.

read_mir
write_ms
write_uvfits


Read the output into CASA

UVFITS

CASA: importuvfits(fitsfile='210808_133736.uvfits', vis='210808_133736.vis')
CASA: ms.open(vis)

Measurement set

CASA: vis='210808_133736.ms'
CASA: ms.open(vis)