Getting started with ChiantiPy


  • CHIANTI, the atomic database for astrophysical spectroscopy (Version 8)
  • Python (developed with versions 2.7 and 3.3)
  • Numpy (developed with 1.10)
  • Scipy (developed with 0.16)
  • Matplotlib requires a GUI library

    PyQt4 or wxPython or PyGTK

    Once one of these is installed, it must be set as the backend in your matplotlibrc file, e.g., backend: Qt4Agg

Install the CHIANTI database

The gzipped data tar ball can be downloaded from the CHIANTI website

  • put the file in a convenient directory, cd to the directory and untar the file
  • ChiantiPy uses the environment variable XUVTOP to find the database. Set XUVTOP to the name of the directory where the CHIANTI data tarball was placed. For example
setenv XUVTOP /data1/xuv/directory.where.the.tarball.was.placed

or on Windows: To set the environment variable, go to Control Panel -> System -> Advanced System Properties -> Environment Variables.

Some sites have the CHIANTI database maintained as part of a SolarSoft distribution. In that case, simply set XUVTOP to the directory were it resides, usually something like $SSW/packages/chianti/dbase

Install the Prerequisites

On Linux systems this can usually be done with your package manager.

On Windows, Linux and Mac systems, it is possible to use

  • the Anaconda distribution from from Continuum, or,
  • the Canopy distribution from Enthought.

On Windows, it is also possible to use:

All of these packages are free, at least for noncommercial use (I believe) and have a considerable amount of documentation. You shoud check the version of IPython that is provided.

Install the ChiantiPy package

In order to be compatible with the latest version (8.0) of the CHIANTI atomic database, it is necessary to install the latest version (0.6.0) of ChiantiPy

pip install ChiantiPy

I have not tried this with ChiantiPy, myself.

The ChiantiPy package can be downloaded from the ChiantiPy project page at Sourceforge, untar it, cd to the directory where it was unpacked, and then, as root

python install

If you do not have root privileges, simply put the ChiantiPy directory in your PYTHONPATH

python install --prefix=somewhere_in_my_PYTHONPATH

or on a Mac, with the Anaconda package

python install --prefix=/Users/your_user_name/anaconda/

Thanks to Peter Young (GMU) for providing the instructions for installation on Mac and Windows

Note - ChiantiPy interactions with Matplotlib

Some of the ChiantiPy methods ask the user to make a selection. With ChiantiPy, this can be done within the command line shell or with gui dialog widgets using PyQt4 or wxPython. Matplotlib needs to have a backend specified. The default is ‘GTK’ and ChiantiPy will use the command line shell for user input. If the Matplotlib backend is specified to be ‘Qt4Agg’, then the PyQt4 widget set will be used by ChiantiPy. If the Matplotlib backend is specified to be ‘WXAgg’ then the wxPython widget set will be used by ChiantiPy. If the Matplotlib backend is set to something other than the 3 values previously discussed, the command line shell will be used.