CASA 6: Installation and Usage

6 Aug 2020: The below installation instructions for CASA 6.0 may no longer work. With the upcoming release of CASA 6.1, new instructions for pip-wheel installation can be found here.

 

The initial release of CASA 6 is ready for general use. CASA 6 has been reorganized to offer a modular approach, where users have the flexibility to build CASA tools and tasks in their Python environment. 

This first 6.0 release is targeted at developers and power users who build CASA into their own software applications and pipelines. The initial release includes the casatools, casatasks, and casampi modules, allowing for core data processing capabilities in parallel. The CASA 6.0 release is scientifically equivalent to the tools, tasks, and mpi capabilities available in CASA 5.6.1; the modules pass the same verification and unit testing required from CASA 5.6, and no new features are available in this first release of CASA 6.0 relative to CASA 5.6.1. Consequently, they share the same documentation as CASA 5.6 (with the addition of this set of CASA 6 specific installation and usage instructions). 

The initial CASA 6.0 Release is not intended for general users doing manual data reduction. It lacks much of the custom interactive shortcuts present in CASA 5 and many of the graphical user interfaces. Development continues on the data visualization packages, including casaplotms, casaviewer, and CARTA, as these involve external applications executing outside the python environment. An upcoming 6.1 release scheduled for the spring of 2020 will contain a complete replacement for all CASA 5 components, including a single tar file distribution for those wishing to continue to install CASA in that manner. This monolithic package will be built from the same modular pip wheels, but adds a CASA-shell component to replicate the appearance of previous CASA versions.

 

Quick Start Example

 

Workstation Installation Instructions

Pip wheels for casatools and casatasks are available as Python 3 modules from the public PyPI server casa-pip.nrao.edu. This allows simple installation and import in to standard Python 3.6 environments. The casatools wheel is necessarily a binary wheel so there may be some compatibility issues for some time as we work toward making wheels available for important Python configurations. Initially, we are targeting Python 3.6 as provided by RedHat for our wheel production, with RH6 and RH7 as official supported platforms for CASA 6.0. We have had some success on other Linux-based platforms as well. Conda environments are not supported.

Installation instructions are as follows (from a Linux terminal window):

NRAO Systems Only: you must run "source /opt/local/bin/enable-python36" (no quotes) first

  1. python3 -m venv casa6_0
  2. source casa6_0/bin/activate
  3. pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casatools==6.0.0.27
  4. pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casatasks==6.0.0.27

Sanity check:

  1. start python
  2. try the following:
>>> import casatasks as ct

>>> help(ct)

To exit the python venv, type deactivate from the terminal

Note that you need python 3.6 installed and may also need libgfortran3. The use of python3 venv is a simple built-in method of containerizing the pip install such that multiple versions of CASA 6.x can be kept on a single machine in different environments. In addition, CASA is built and tested using standard (python 3.6) libraries which can be replicated with a fresh venv, keeping the libraries needed for CASA isolated from other libraries which may already be installed on your machine.

With the pip installation, CASA may be used in a standard Pythonic manner such as:

>>> from casatasks import listobs
>>> rc = listobs(’mydata.ms’)

NOTE: with only casatasks (with casatools) available, it is possible to turn on echoing log messages to the terminal window by typing:
>>> from casatasks import casalog
>>> casalog.showconsole(True)

 

Parallel Processing Instructions

casampi is a Python package that provides the MPI parallelization infrastructure of CASA. casampi can be used in two scenarios:

  1. As a plugin for casatasks
  2. A module that can be imported in order to use the casampi parallelization functionality directly, if you are an advanced user, such as the ALMA/VLA data reduction pipeline.

In scenario 1, casampi adds parallelization at the CASA tasks level. if casampi is installed together with casatasks, casatasks will see that casampi is available and enable the parallel processing capabilities of CASA. In scenario 2, casampi is the MPI based infrastructure to build parallelization schemes, such as the so-called "Tier0" parallelization of the ALMA/VLA pipelines whereby different plotting and cleaning commands are distributed to different processes directly by the pipeline parallelization code. Other advanced users can also build their own MPI parallelization schemes based on casampi.

Installation is as follows (from Linux terminal after the previous installation of casatools and casatasks):

  1. make sure openmpi is installed on your machine (you need mpicc and mpirun) NRAO systems only: contact the helpdesk to install casa-toolset-3, then run the command following command: export PATH=/opt/casa/03/bin:$PATH
  2. pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casampi==6.0.0.27

Sanity check (from Linux terminal):

  1. echo "from casampi.MPIEnvironment import MPIEnvironment; print('working?', MPIEnvironment.is_mpi_enabled)" > test.py
  2. mpirun -q -n 2 python test.py

observe two instances of "working? True"

 

Jupyter Notebooks and Google Colab

Jupyter notebooks are ideally suited for code tutorials, exploration, and collaborative development. Together with Google Colaboratory, which hosts Jupyter notebooks on free virtual hardware in the cloud, the door is opened to powerful new ways of developing and sharing software. CASA 6 casatools and casatasks modules are compatible with the Google Colab environment.  The CASA team is working towards making additional modules compatible in the future as well as introducing new Jupyter-based CASAguide tutorials.

An example of a Jupyter notebook that explains installation and usage of CASA 6 is available here.

 

Background

CASA has always been distributed as a single, integrated application, including a Python interpreter and all the libraries, packages and modules (see CASA & Python pages). As part of the ongoing development of CASA 6, and the switch from Python 2 to 3, CASA will provide greater flexibility for users to integrate CASA into existing Python workflows by using a modular architecture and standard pip wheel installation.

From CASA 6 onward, CASA should be thought of as the system described in Fig 1. CASA tasks and tools will be available as independent Python 3 modules built over top of the C++ code base. These modules can be installed via pip wheels. Graphical User Interface (GUI) applications, such as PlotMS, the CASA Viewer, and CARTA run as separate executable processes that communicate with CASA Python via gRPC (marked as "Processes" in Fig. 1). Additional Python modules are provided to automatically start and control these external processes.


 

CASA Tool Names

From the CASA 6 command line, the tools can be listed with 'toolhelp( )'  and the tasks can be listed with 'taskhelp( )'. In CASA 5, the tools had a certain name when imported from the casac module, and another name when used from the CASA 5 command line. In addition, one instance of each tool was pre-constructed and available for the user at the command line. The table below lists the tool naming in CASA 5 and CASA 6. In CASA 6, all of the CASA 5 names (e.g. imtool, im, etc.) are available for the user at the CASA 5 command line, but otherwise, the CASA 6/casac names are used by default. It is easy to import the CASA 6 tool with whatever name you like with:

>>> from casatools import imager as imtool

CASA 6/casac CASA 5/Class/Ctor CASA 5 instance
imager imtool im
calibrater cbtool

cb

ms mstool

ms

quanta qatool qa
table tbtool tb
agentflagger aftool af
measures metool me
image iatool ia
imagepol potool po
simulator smtool sm
componentlist cltool cl
coordsys cstool cs
regionmanager rgtool rg
spectralline sltool sl
vpmanager vptool vp
msmetadata msmdtool msmd
functional fntool fn
imagemetadata imdtool imd
atmosphere attool at
calanalysis catool

ca

mstransformer mttool mt
singledishms sdmstool sdms