You are here

DRAGONS Data Reduction Software

Content owned by aadamson


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 to Python 3.10
  • Linux, equivalent to CentOS 7 and above
  • Or Mac OS X 10.13 and above
  • Intel Anaconda (works on Mac M1 architecture)
  • conda >-4.12 for Python 3.10.


The special instructions for installing DRAGONS and Gemini IRAF while was down in mid-late 2023 are no longer needed; please follow the normal instructions below instead.

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

IMPORTANT:   To install Python 3.10 packages, the version of conda must be 4.12 or greater.  Previous version of conda are incompatible with Python 3.10.

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. 

    $ conda create -n geminiconda python=3.10 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 now works with Python 3.7 to 3.10. To install DRAGONS:

   $ conda create -n dragons python=3.10 dragons ds9 bokeh=2.4.3

Since the April 2023 release of DRAGONS 3.1, the astropy and the bokeh projects have released significant updates to their software that break DRAGONS.  We are working on fixing the compatibility issues (update: done for astropy).  In the meantime, please specify bokeh=2.4.3 when you install a new environment.  If you already have an environment with bokeh 3+, you will need to downgrade it to the version specified above. If you already have astropy 5.3.0, you will need to update it to a newer (or older) version.

Updating Dragons

DRAGONS v3.1 requires Python 3.7 to 3.10.  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 compatible Python 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 already have a previous installation:

    $ conda activate dragons
    $ conda install dragons=3.1.0

Configuration and Testing

Configuring DRAGONS

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

    $ cd ~
    $ mkdir .dragons
    $ cd .dragons
    $ touch dragonsrc

Open dragonsrc with you favorite editor and add these lines:

    browser = safari

    databases = ~/.dragons/dragons.db get store

The browser can be set to any of “safari”, “chrome”, or “firefox”, depending on your preferences. The path and name of the calibration database can be anything, as long at the path exists. The “get” means that DRAGONS will get calibrations from that database. The “store” option can be added after the “get” to have DRAGONS automatically add new processed calibrations to the database. See any of the tutorials to see the calibration manager in action.

Configure buffers for ds9:

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

While not specific at all to DRAGONS, it is recommended to increase the Operating System limit on the number of opened files. We have seen an increase in reports of the error "Too many open files."

In your .bash_profile, add the following line to overcome that OS limitation:

    ulimit -n 1024

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.1.0 ---
    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. (Note that the US NGO tutorial might not have been updated to DRAGOSN 3.1 yet.)

DRAGONS Data Reduction Software | Gemini Observatory


The website encountered an unexpected error. Please try again later.