You are here

DRAGONS Data Reduction Software

Content owned by klabrie


DRAGONS is a platform for the reduction and processing of astronomical data. It is a Python meta-package that includes infrastructure for automation and algorithms for processing astronomical data. Currently, it focuses on the reduction of Gemini data, but hooks are available for expansion to data from other observatories.

With a little bit of guidance from you, DRAGONS will reduce your Gemini data in a standard way, rapidly, with little fuss. With a bit more guidance from you, DRAGONS will let you optimize the reduction for your specific sources and science objectives.

The primary reference to be cited by users of DRAGONS is:

        K. Labrie et al. ADASS XXVII, ASP Conf. Ser. 522, eds. P. Ballester, J. Ibsen, M. Solar & K. Shortridge, p. 321

View the recording of the demo of DRAGONS 3.1 for the science quality reduction of GMOS longslit data to see what's coming next...

System Requirements

  • Python 3.7
  • Linux, equivalent to CentOS 7 and above
  • Or Mac OS X 10.13 and above
  • Intel Anaconda


Anaconda is required before installing DRAGONS.  If you do not already have anaconda installed, see the Anaconda installation instructions and be sure to add the conda-forge and gemini astroconda channels with these commands once the installation is complete:

    $ conda config --add channels conda-forge
    $ conda config --add channels

On Mac OS machines with M1/M2 chips, make sure that you have installed the Intel anaconda to ensure that you pick up Intel binaries.  DRAGONS is currently available only for Intel, which Rosetta will run without issue.

Installing Gemini IRAF and DRAGONS together

To install both DRAGONS and Gemini IRAF simultaneously, first create a virtual environment and install the full data reduction suite: DRAGONS and Gemini IRAF.  Conda will take care of installing the dependencies.  The name of the environment can be anything you like. Here we use “geminiconda” as the name.  DRAGONS v3.0 requires Python 3.7.

    $ conda create -n geminiconda python=3.7 dragons gemini iraf-all pyraf-all ds9

To use this environment, activate it:

    $ conda activate geminiconda

You will need to activate the environment whenever you start a new shell. If you are planning to use it all the time, you might want to add the command to your .bash_profile, after the “conda init” block.

Installing DRAGONS alone

DRAGONS requires Python 3.7. To install DRAGONS:

   $ conda create -n dragons python=3.7 dragons ds9

Updating Dragons

DRAGONS v3.0 requires Python 3.7.  If your conda environment uses a different version of Python, you will need to create a new conda environment.  Set the instruction below for a new installation with conda create.  

We recommend that you create a new environment, but if you already have a Python 3.7 environment set up and want to add DRAGONS, you can use conda install. In the example below, replace environment_name with geminiconda, or dragons, or whatever name you used when you first created the environment.

    $ conda activate environment_name
    $ conda install package_name=version

For example (if you are already using Python 3.7):

    $ conda activate dragons
    $ conda install dragons=3.0.4

Configuration and Testing

Configuring DRAGONS

DRAGONS requires a configuration file located in ~/.geminidr/:

    $ cd ~
    $ mkdir .geminidr
    $ cd .geminidr
    $ touch rsys.cfg

Open rsys.cfg with you favorite editor and add these lines:

    standalone = True
    database_dir = ~/.geminidr/

Configure buffers for ds9:

    $ cd ~
    $ cp $CONDA_PREFIX/lib/python3.7/site-packages/gempy/numdisplay/imtoolrc ~/.imtoolrc
    $ vi .bash_profile (or use you favorite editor)
    Add this line to the .bash_profile: 
       export IMTOOLRC=~/.imtoolrc

Testing the Installation

    $ conda activate dragons
    $ python
    >>> import astrodata
    >>> import gemini_instruments

If the imports are successful, i.e. no errors show up, exit Python (Ctrl-D).

Now test that reduce runs. There may be some delay initially as packages and modules are compiled and loaded.

    $ reduce --help

This will print the reduce help to the screen.

If you have Gemini FITS files available, you can test that the Recipe System is functioning as expected as follow (replace the file name with the name of your file):

    $ reduce N20180106S0700.fits -r prepare

If all is well, you will see something like:

                        --- reduce, v3.0.3 ---
    All submitted files appear valid
    Found 'prepare' as a primitive.
    RECIPE: prepare
    PRIMITIVE: prepare
      PRIMITIVE: validateData
      PRIMITIVE: standardizeStructure
      PRIMITIVE: standardizeHeaders
         PRIMITIVE: standardizeObservatoryHeaders
         Updating keywords that are common to all Gemini data
         PRIMITIVE: standardizeInstrumentHeaders
         Updating keywords that are specific to NIRI
    Wrote N20180106S0700_prepared.fits in output directory

    reduce completed successfully.

Documentation and Tutorials

The full DRAGONS documentation is available here, including several data reduction tutorials.  Additional tutorials are available from the US National Gemini Office.