Starting CASA

Important information about starting CASA

This section assumes that CASA has been installed on your LINUX or OSX system. See the page on CASA installation for guidance.

 

Before Starting CASA

First, you will most likely be starting CASA running from a working directory that has your data in it, or at least where you want your output to go. It is easiest to start from there rather than changing directories inside CASA.

If you have done a default installation under Linux using rpms, or on the Mac with the CASA application, then there should be a shell script called casa in the /usr/bin/ area which is in your path. This shell will set up its environment and run the version of CASA that it points to. If this is how you set up the system, then you need to nothing further and can run CASA.

For internal NRAO users, we keep different version of CASA (including test versions, pre-releases, pipeline versions etc.). Please see CASA at NRAO for details.

Environment Variables

Before starting up CASA, you should set or reset any environment variables needed, as CASA will adopt these on startup. For example, the PAGER environment variable determines how help is displayed in the CASA terminal window. The choices are less, more and cat. In bash, pick one of

PAGER=less

PAGER=more

PAGER=cat

followed by

export PAGER

In csh or tcsh, pick one of

setenv PAGER less

setenv PAGER more

setenv PAGER cat

The actions of these are as if you were using the equivalent Unix shell command to view the help material.  We recommend using the cat option for most users, as this works smoothly both interactively and in scripts.

Some CASA processes will work on a large number of temporary files. The OS, however, may have a built-in limit on the number of such files. We recommend to increase the limit to >1024. A command like

ulimit -n 2048

should give CASA enough accessible files to run successfully.

Where is CASA?

Note that the path to the CASA installation, which contains the scripts and data repository, will also depend upon the installation. With a default installation under Linux this will probably be in

/usr/lib64/casa/

If the unpacked tarball is placed somewhere else, one may add the PATH variable to include, e.g.

export PATH=$PATH:/<path>/casa-<version>/bin

for bash and

set path = ($path /<path>/casa-<version>/bin)

in csh shell. In a Mac OSX default install, it will likely be an application in the Applications folder. You can find the location after initializing by looking at the CASAPATH environment variable. You can find it within CASA by

pathname=os.environ.get('CASAPATH').split()[0] print pathname

 

Starting CASA

On a Mac, CASA should be started the first time by clicking on the CASA App. To start it from the terminal, symbolic links (symlinks) can be created like

!create-symlinks

inside CASA. Follow the instructions and from now on CASA can be started in any terminal.

Info: Keeping older CASA versions on a Mac is easy. Just rename CASA.app in the application folder, e.g. like CASA-versionname.app.

For Linux and when Mac symlinks are set, CASA is started by typing

casa

on the UNIX command line. After startup information, you should get an IPython command prompt in the terminal window where you started CASA:

=========================================
The start-up time of CASA may vary
depending on whether the shared libraries
are cached or not.
=========================================

IPython 5.1.0 -- An enhanced Interactive Python.

CASA 5.0.0-207 -- Common Astronomy Software Applications

*** Loading ATNF ASAP Package...
*** ... ASAP (rev#1) import complete ***
--> CrashReporter initialized.
Using matplotlib backend: TkAgg

CASA <1>:

CASA will take approximately 10 seconds to initialize at startup in a new working directory; subsequent startups are faster. 

You will also see a logger GUI appear on your Desktop.

 

Type Figure
ID startingcasa-fig-logger
Caption The CASA logger

CASA can be launched with various options, including many options for the logging. To see them all, start CASA with the --help option:

casa --help

This will show the startup options (explanation given in the box):

optional arguments:

 

  -h, --help            show this help message and exit

  --rcdir RCDIR         location for startup files

  --logfile LOGFILE     path to log file

  --maclogger           logger to use on Apple systems

  --log2term            direct output to terminal

  --nologger            do not start CASA logger

  --nologfile           do not create a log file

  --nogui               avoid starting GUI tools

  --colors {NoColor,Linux,LightBG}

                        prompt color

  --trace               list imported modules

  --pipeline            start CASA pipeline run

  --agg                 startup without tkagg

  --iplog               create ipython log

  -c ...                python eval string or python script to execute

For example,  you can execute a CASA script script.py directly with the command

casa -c script.py

You can also launch the plotms, viewer, casafeather, and browsetable GUIs separately in a terminal without starting CASA itself. To do so, type:

casaplotms

casaviewer

casafeather

casabrowser

 respectively.

 

Ending CASA

You can exit CASA by typing quit

CASA <4>: quit

 This will bring up the query

Do you really want to exit ([y]/n)?

to give you a chance in case you did not mean to exit. You can also quit using %exit or CTRL-D. If you don’t want to see the question "Do you really want to exit [y]/n?", then just type Exit or exit and CASA will stop right then and there.

 

What happens if something goes wrong?

ALERT: Please check the CASA Home Page for Release Notes and FAQ information including a list of known problems. If you think you have encountered an unknown problem, please consult the CASA HelpDesk help.nrao.edu for general CASA questions or help.almascience.org for ALMA related questions.

First, always check that your inputs are correct; use

help <taskname>

to review the inputs/output. Check the error message carefully to see if there are hints on what went wrong. Typical mistakes are missing quotes around strings, wrong format of the inputs (e.g. a list where a string is expected), letter "O" instead of a zero, wrong file names, or python indentation.

Aborting CASA execution

If something has gone wrong and you want to stop what is executing, then typing CTRL-C (Control and C keys simultaneously) will usually cleanly abort the application. If this does not work on your system then try CTRL-Z to put the task or shell in the background, and then follow up with a kill -9 <PID> where you have found the relevant casa process ID (PID) using ps.

Alert: CTRL-C while a tasks runs can corrupt your input data file, e.g. when a scratch column is filled while aborting (e.g. in clean). If in doubt, wait until the task has finished, delete the new files produced, and start again.

 

What happens if CASA crashes?

Usually, restarting CASA is sufficient to get you going again after a crash takes you out of the Python interface. Note that there may be spawned subprocesses still running, such as the casaviewer or the logger. These can be dismissed manually in the usual manner. After a crash, there may also be hidden processes. You can find these by listing processes, e.g. in linux:

ps -elf | grep casa

or on MacOSX (or other BSD Unix):

ps -aux | grep casa

You can then kill these, for example using the Unix kill or killall commands. This may be necessary if you are running remotely using ssh, as you cannot logout until all your background processes are terminated. For example,

killall ipcontroller

or

killall python

will terminate the most common post-crash zombies.