CASA (pwkit.environments.casa)

The pwkit.environments.casa package provides convenient interfaces to the CASA package for analysis of radio interferometric data. In particular, it makes it much easier to build scripts and modules for automated data analysis.

This module does not require a full CASA installation, but it does depend on the availability of the casac Python module, which provides Python access to the C++ code that drives most of CASA’s low-level functionality. By far the easiest way to obtain this module is to use an installation of Anaconda or Miniconda Python and install the casa-python package provided by Peter Williams, which builds on the infrastructure provided by the conda-forge project.

Alternatively, you can try to install CASA and extract the casac module from its files as described here. Or you can try to install this module inside the Python environment bundled with CASA. Or you can compile and underlying CASA C++ code yourself. But, using the pre-built packages is going to be by far the simplest approach and is strongly recommended.

Outline of functionality

This package provides several kinds of functionality.

  • The pwkit.environments.casa.tasks module provides straightforward programmatic access to a wide selection of commonly-used CASA takes like gaincal and setjy.

  • pwkit installs a command-line program, casatask, which provides command-line access to the tasks implemented in the tasks module, much as MIRIAD tasks can be driven straight from the command line.

  • The pwkit.environments.casa.util module provides the lowest-level access to the “tool” structures defined in the C++ code.

  • Several modules like pwkit.environments.casa.dftphotom provide original analysis features; dftphotom extracts light curves of point sources from calibrated visibility data.

  • If you do have a full CASA installation available on your compuer, the pwkit.environments.casa.scripting module allows you to drive it from Python code in a way that allows you to analyze its output, check for error conditions, and so on. This is useful for certain features that are not currently available in the tasks module.

More detailed documentation

Using CASA in the pwkit.environments framework

The module pwkit.environments implements a system for running sub-programs that depend on large, external software environments such as CASA. It provides a command-line tool, pkenvtool, that you can use to run code in a controlled CASA environment.

Some of the tasks provided by pwkit rely on this framework to implement their functionality — in these cases, the value that pwkit is providing is that it lets you access complex CASA functionality through a simple function call in a standard Python environment, rather than requiring manual invocation in a casapy shell.

In order to use these tasks or the CASA features of the pkenvtool program, you must tell the pwkit.environments system where your CASA installation may be found. To do this, just export an environment variable named $PWKIT_CASA that stores the path to the CASA installation root. In other words, the file $PWKIT_CASA/bin/casa should exist. (Well, the code also checks for $PWKIT_CASA/bin/casapy to try to be compatible with older CASA versions.) The environments system will take care of the rest.

Note: does this work on 32-bit systems? Does this work on Macs?

CASA installation notes

Download tarball as linked from here. The tarball unpacks to some versioned subdirectory. The names and version codes are highly variable and annoying.