2.1. Introduction

This is the AstroData User’s Manual. AstroData is a DRAGONS package. The current chapter covers basic concepts like what is the astrodata package and how to install it (together with the other DRAGONS’ packages). Chapter 2 explains with more details what is AstroData and how the data is represented using it. Chapter 3 describes input and output operations and how multi-extension (MEF) FITS files are represented. Chapter 4 provides information regarding the TagSet class, its usage and a few advanced topics. In Chapter 5 you will find information about the FITS headers and how to access/modify the metadata. The last two chapters, Chapter 6 and Chapter 7 cover more details about how to read, manipulate and write pixel data and tables, respectively.

If you are looking for a quick reference, please, have a look on the Cheat Sheet.

2.1.2. What is astrodata?

astrodata is a package that wraps together tools to represent internally astronomical datasets stored on disks and to properly parse their metadata using the AstroData and the TagSet classes. astrodata provides uniform interfaces for working on datasets from different instruments. Once a dataset has been opened with astrodata, the object “knowns about itself”. Information like instrument, observation mode, and how to access headers, is readily available through the uniform interface. All the details are coded inside the class associated with the instrument, that class then provides the interface. The appropriate class is selected automatically when the file is opened and inspected by astrodata.

Currently astrodata implements a representation for Multi-Extension FITS (MEF) files. (Other representations can be implemented.)

2.1.3. Installing Astrodata

The astrodata package has a few dependencies, Astropy, Numpy and others. The best way to get everything you need is to install Anaconda, and the gemini stack from the AstroConda channel.

astrodata itself is part of DRAGONS. It is available from the repository, as tar file, or as a conda package. The bare astrodata package does not do much by itself, it needs a companion instrument definitions package. For Gemini, this is gemini_instruments, also included in DRAGONS.

2.1.3.1. Installing Anaconda and stacks from AstroConda

This is required whether you are installing DRAGONS from the repository, the tar file or the conda package.

  1. Install Anaconda.

    Go to https://www.anaconda.com/download/ and install the latest 64-bit Anaconda, Python 2.7 or 3.x, it does not matter for the root installation. Since the Python world is moving away from 2.7, choosing 3.x is probably better. The DRAGONS software has been tested under both 2.7 and 3.x.

  2. Open a bash session.

    Anaconda requires bash. If you are not familiar with bash, note that the shell configuration files are named .bash_profile and .bashrc. During the installation, a PATH setting has been added to your .bash_profile or .bashrc to add the Anaconda bin directory to the PATH.

  3. Activate Anaconda.

    Normal Python 3 installation puts the software in ~/anaconda3/.:

    $ conda init
    
  4. Configure the conda package manager to look in the AstroConda channel

    hosted by STScI, and in the GEMINI Conda Channel. This is a one-time step. It affects current and future Anaconda installations belonging to the same user on the same machine.:

    $ conda config --add channels http://ssb.stsci.edu/astroconda
    $ conda config --add channels http://astroconda.gemini.edu/public
    
  5. Create an environment.

    To keep things clean, Anaconda offers virtual environments. Each project can use its own environment. For example, if you do not want to modify the software packages needed for previous project, just create a new one for the new project.

    Here we set up an environment where the DRAGONS dependencies can be installed without affecting the rest of the system when not using that virtual environement. The new virtual environment here is named geminiconda. Note that one could set python to 3.6 instead of 2.7.

    $ conda create -n geminiconda python=3.6 stsci gemini
    
  6. Activate your new virtual environment.
    $ conda activate geminiconda
    

2.1.3.3. Tarball installation

Tarball are available from the releases on the github repository page, https://github.com/GeminiDRSoftware/DRAGONS/releases.

It can be installed with:

python setup.py install [--prefix=<your_choice>]

2.1.3.4. Using the latest software from the repository (expert)

The repository is available on github, on the Gemini Observatory Data Reduction Software page, https://github.com/GeminiDRSoftware/DRAGONS. Either git clone or download the content of DRAGONS.

Once you have the source code, remember to set your PYTHONPATH to include the package’s location.

2.1.3.5. Smoke test the Astrodata installation

From the configured bash shell:

$ type python
python is hashed (<home_path>/anaconda3/envs/geminiconda/python)

Make sure that python is indeed pointing to the Anaconda environment you
have just set up.
$ python
>>> import astrodata
>>> import gemini_instruments

Expected result: Just a python prompt and no error messages.

2.1.4. Try it yourself

Try it yourself

Download the data package if you wish to follow along and run the examples. It is available at:

Unpack it:

$ cd <somewhere_convenient>
$ tar xvf ad_usermanual_datapkg-v1.tar
$ bunzip2 ad_usermanual/playdata/*.bz2

Then

$ cd ad_usermanual/playground
$ python

2.1.5. Astrodata Support

Astrodata is developed and supported by staff at the Gemini Observatory. Questions about the reduction of Gemini data should be directed to the Gemini Helpdesk system at https://www.gemini.edu/sciops/helpdesk/ The github issue tracker can be used to report software bugs in DRAGONS.