4. Demo imaging

To get ourselves oriented and get a feel for how data is processed with DRAGONS, we will run a full reduction on our sample data. The full tutorial to reduce NIRI data can be found at NIRI Imaging Data Reduction Tutorial.

Here, we go through the steps with quite a bit less discussion than in the full tutorial as the purpose is simply to provide some context and an idea of a typical data reduction flow to those who have not experience it before.

The observations are of an extended source, a nearby galaxy. The instrument used is NIRI. The science sequence is a series of dithers on target with full offset to sky. We will create a master dark, a master flat, a reduced flux standard, and finally create a calibrated, sky-subtracted stack of the science observations.

Let’s run all the steps.

  1. Set up the local calibration manager

  2. Create the file lists

  3. Create the calibration files (dark, flat)

  4. Reduce the flux standard

  5. Reduce the science observations

cd <where_the_data_package_is>/niriimg_tutorial/playground

4.1. Set up the local calibration manager

We will discuss the local calibration manager in a later chapter.

The calibration manager is the first thing to set up when starting on a data reduction project. It provides the automated calibration association.

The file to pay attention to is: ~/.dragons/dragonsrc (DRAGONS v3.1+)

For this example, that file to contain the following:

databases = <where_the_data_package_is>/niriimg_tutorial/playground/cal_manager.db get

In this configuration, with the “get” flag, DRAGONS will retrieve the processed calibration automatically from that database. You could add “store” after the “get” to have DRAGONS add the processed calibrations to the database automatically (effectively running caldb add for you). Here we will add the calibrations it manually.

About the path for databases, we recommend the directory you are using to work on the data. But it can be anywhere.

Once the configuration file is set up, initialize the database. This needs to be done only once per database.

caldb init

This creates a new file, cal_manager.db, in the directory specified by databases.

4.2. Create the file lists

The user has to sort the files. DRAGONS is a “User-in-the-Loop” pipeline. We have some tools to help. We will have a closer look at them later.

We have long darks that match the science, a series of lamp-on and lamp-off flats, a set of on-target dithered observations for a flux standard, and a set of on-target dithered and off-target dithered observations for the science target.

dataselect ../playdata/example1/*.fits --tags DARK --expr='exposure_time==20' -o darks20s.lis

dataselect ../playdata/example1/*.fits --tags FLAT -o flats.lis

dataselect ../playdata/example1/*.fits --expr='object=="FS 17"' -o stdstar.lis

dataselect ../playdata/example1/*.fits --expr='object=="SN2014J"' -o target.lis

4.3. Add static BPM to calibration database

The static BPMs are downloaded from the archive (but included here in our data package).

caldb add ../playdata/example1/bpm_20010317_niri_niri_11_full_1amp.fits

4.4. Create the master dark and the master flat


Create the master dark and add it to the calibration manager.

reduce @darks20s.lis
caldb add N20160102S0423_dark.fits

The @ character before the name of the input file is the “at-file” syntax. We will look into this later.


Create the master flat from the lamp-on and lamp-off flats and add it to the calibration database.

reduce @flats.lis
caldb add N20160102S0373_flat.fits

4.5. Reduce the flux standard

This is short series of on-target dither observations. Darks are not obtained for NIRI flux standard so we turn that step off. The flat will be picked up from the calibration database.

reduce @stdstar.lis -p darkCorrect:do_cal=skip

4.6. Reduce the science observations

The sequence is a set of dither on target with full offsets to sky. DRAGONS will sort them during the sky correction. All calibrations are picked up automatically from the calibration database. Because the target fills the field of view, we need to turn off the scaling of the sky frames.

reduce @target.lis -p skyCorrect:scale_sky=False
../../_images/extended_before.png ../../_images/extended_after.png