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 AstroData Cheat Sheet.
1.1. Reference Documents¶
astrodata is a package that wraps together tools to represent internally
astronomical datasets stored on disks and to properly parse their metadata
AstroData and the
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 implements a representation for Multi-Extension FITS (MEF)
files. (Other representations can be implemented.)
1.3. Installing Astrodata¶
astrodata itself is part of
DRAGONS. It is available from the
repository, as tar file, or as a conda package. The bare
does not do much by itself, it needs a companion instrument definitions
package. For Gemini, this is
gemini_instruments, also included in
1.3.1. Installing Anaconda and the DRAGONS stack¶
This is required whether you are installing
DRAGONS from the
repository, the tar file or the conda package.
- Install Anaconda.
Go to https://www.anaconda.com/download/ and install the latest 64-bit Anaconda.
- Open a bash session.
Anaconda requires bash. If you are not familiar with bash, note that the shell configuration files are named
.bashrc. During the installation, a PATH setting has been added to your
.bashrcto add the Anaconda bin directory to the
- Activate Anaconda.
Normal Python 3 installation puts the software in
$ conda init
- Set up conda channels.
condapackage 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
- 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 environment for the new project.
Here we set up an environment where the
DRAGONSdependencies can be installed without affecting the rest of the system when not using that virtual environement. The new virtual environment here is named
dragons. The software has been tested with Python 3.7 hence we recommend that you use this specific version of Python with DRAGONS.
$ conda create -n dragons python=3.7 dragons stsci
- Activate your new virtual environment.
$ conda activate dragons
- Configure DRAGONS.
These configurations are not stricktly required when using only
astrodata. It however likely that if you are using
astrodatayou will be using DRAGONS too at some point. So let’s configure it to have it ready to go.
DRAGONS requires a configuration file located in
rsys.cfgfile contains basic configuration for DRAGONS local calibration manager used by
$ cd ~ $ mkdir .geminidr $ cd .geminidr $ touch rsys.cfg
rsys.cfgwith your favorite editor and add these lines:
[calibs] standalone = True database_dir = ~/.geminidr/
Next time you start a DRAGONS project, set the
database_dirto a path of your liking, this is where the local calibration database will be written.
Then configure buffers for
$ cd ~/ $ cp $CONDA_PREFIX/lib/python3.7/site-packages/gempy/numdisplay/imtoolrc ~/.imtoolrc $ vi .bash_profile (or use your favority editor) Add this line to the .bash_profile: export IMTOOLRC=~/.imtoolrc
1.3.2. Update an existing DRAGONS installation¶
To check for newer version:
$ conda search dragons The * will show which version is installed if multiple packages are available.
To update to the newest version:
$ conda update dragons
1.3.3. Smoke test the Astrodata installation¶
From the configured bash shell:
$ type python python is hashed (<home_path>/anaconda3/envs/dragons/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.
1.4. Try it yourself¶
Try it yourself
Download the data package if you wish to follow along and run the examples presented in this manual. It is available at:
$ cd <somewhere_convenient> $ tar xvf ad_usermanual_datapkg-v1.tar $ bunzip2 ad_usermanual/playdata/*.bz2
$ cd ad_usermanual/playground $ python
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
The github issue tracker can be used to report software bugs in DRAGONS.