Skip to main content

How can I modify the PYTHONPATH in CASA? - Knowledgebase / Offline Data Reduction and/or CASA - ALMA Science

How can I modify the PYTHONPATH in CASA?

Authors list

Please see the instructions in the CASA Documentation,

The '' file found in $HOME/.casa (i.e. ~/.casa/ is evaluated by the CASA shell just before the CASA prompt is presented to the user. This allows users to customize their CASA shell environment beyond the standard settings in '', by importing packages, setting variables or modifying the python system path.

One case where this is useful is for configuring CASA for ALMA data reduction. A package called 'analysisUtils' is often used as part of ALMA analysis. It is typically imported and instantiated in

$ cat ~/.casa/

import sys, os
import analysisUtils as aUes = aU.stuffForScienceDataReduction()

In this example, the standard python modules os and sys are made available in the CASA shell. The path where the analysisUtils module can be found is added to the Python system path, and finally the package is imported and an object is created. These modules and objects will then be available for the user within the CASA shell environment.