# Getting started with ChiantiPy¶

## Prerequisites¶

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

PyQt4 or wxPython (not compatible with Python3)

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

• (not really a prerequisite but extremely useful) IPython version 4 or 5 and Jupyter

## 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  or pip3 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 setup.py install  If you do not have root privileges, simply put the ChiantiPy directory in your PYTHONPATH python setup.py install --prefix=somewhere_in_my_PYTHONPATH  or on a Mac, with the Anaconda package python setup.py 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 various GUI backends¶ First, Matplotlib requires a GUI backend and can be specified by the user in the matplotlibrc file. Matplotlib expects to find this file in$HOME/.config/matplotlib, although it might require that you copy it to that directory.

ChiantiPy also uses a set of GUI dialog widgets using PyQt4 or wxPython (for Python 2). Selections can also be made via the command line. The user choice is specified in the \$HOME/.chianti/chiantirc file if one has been copied there. Otherwise, the default GUI is to use the command line. A default chiantirc file is included with the distribution.

In order for the ChiantiPy dialog widget to be used, a backend for them must be initiated. If you choose the same backend for matplotlib as for the ChiantiPy widgets, then running %matplotlib in an IPython or Jupyter session will do the trick. In an interactive Python session, invoking a matplotlib command first should also do the trick.

If you choose to use a GUI backend other than that used for matplotlib, the in an IPython or a Jupyter command the following magic commands are available to start the backend:

%gui qt
%gui wx


ChiantiPy has mostly been tested with the Qt4 backend for Matplotlib and using the ChiantiPy Qt4 widgets.