ING Banner
Home > Astronomy > LIRIS >

Imaging data reduction with THELI

On all ING public linux machines, including both WHTDRPC1 and WHTDRPC2 machines in the control room, there is THELI installed, which can be used for a full reduction of your imaging data obtained with LIRIS. It is also available via anonymous ftp from

It is available to whtguest users (whtguest01, whtguest02 and whtguest03). To start THELI , type ’theli’ at the prompt, for example

whtdrpc1:/home/whtguest> theli

In the following, we assume you took a set of dithered exposures in Ks-band of NGC1234 with nruns=6 and ncyc=2, and 10 seconds exposure time. The target is compact, so that no blank sky fields were required. You have taken a set of bright skyflats as well. We give here a rough step-by-step guide for a typical simple imaging session, without going deeper into details or exploiting the full functionality of THELI . The result obtained can be considered being of science grade quality. Intermediate results serve as a quick-look step.

1 Organising the data and initialising THELI

Create a new directory in /reduction/local/whtguest or /scratch/, let’s say myrun, and therein subdirectories called FLAT and SCIENCE. The data taken in your night can be found under /obsdata/whta/20070125, if January 25th, 2007, was the date of your observing run. Copy all the flats into FLAT, and all exposures of your target into SCIENCE.

In THELI , you find seven processing groups (hereafter PG),
  •  Initialise
  • Preparation
  • Calibration
  • Superflatting
  • Weighting
  • Astrom/Photom
  • Coaddition

In the Initialise PG, enter a new LOG file name, e.g. NGC1234_Ks and then clear the processing status. This is needed since THELI automatically loads the last LOG file from the previous reduction run when launched. THELI is fully parallised, but LIRIS has only one detector. Hence, select 1 CPU for the number of CPUs used. Then, from the instrument list on the right, select LIRIS@WHT as the instrument. In the data directories part, enter the full path of your data as the main path, and FLAT and SCIENCE in the corresponding sections. If the path names are identified by THELI to be correct (i.e. existing), the background colour of the fields will change from red to green.

2 Preparation

Activate the Split FITS / correct header task and set the file suffix to .fit. Two commands will appear in the command window at the bottom of THELI . Click the green Start button to execute this step. The task gets a green background colour, indicating that it has been done already. When finished, you will get a Done message printed in the yellow message window. What happens at this step is that a standardised FITS header is written that THELI can
understand. The LIRIS image is also descrambled (see Sect. 4.1.1). In the FLAT and SCIENCE directories you will now find files ending in 1.fits, and a ORIGINALS directory, which contains the unprocessed raw data.

3 Calibration

The bias (pre-read) (Sect. 1.1.1) is automatically subtracted from the image before it is
stored by the observing system software. Hence, mark the Do not apply BIAS /DARK
box at the top.

Several tasks can be done in one go, which we will do here.

  • Mark the the Process flats task. Upon execution, this will create a master flat called FLAT 1.fits in the FLAT directory.
  • Activate the Spread sequence (IR) task. As described in the imaging section, one has to split the series of exposures taken at one dither point into different groups of similar sky background. Our example consists of 6 exposures at each dither point, and the detector equilibrium will be reached with the third exposure. Hence, we enter 3 and 6 in the group and length fields, respectively. This task will create three subdirectories SCIENCE S1-3, at the same level in the directory tree as the SCIENCE directory, and group the corresponding images therein.
  • Activate the Calibrate data task. We also need to calculate a superflat (or sky background model), hence choose the Calculate SUPERFLAT option. Enter 6, 5 and 256 for the fields DT, DMIN and SIZE. These are Sextractor parameters that are used in the detection and masking of objects, before the images are combined for the sky background. For the Window size you enter 0.
Then click Start and all tasks will be executed.

After finishing, you will find a file SCIENCE Si 1.fits in the SCIENCE Si directory. This is the corresponding sky background model for these exposures. It has not yet been applied. The exposures themselves have a string OFC in their file name, meaning that they have been flat fielded.

This procedure assumes that the sky background has not changed significantly within the time of the entire exposure series, i.e. within 5 − 20 minutes. If your exposure series is longer, either split it into different SCIENCE directories, or choose a dynamic superflat (e.g. Window size=4). See the THELI documentation for more details.

4 Superflatting

In the Superflatting PG, select Subtract SUPERFLAT and Merge sequence (IR). These tasks will scale and subtract the sky background model from the data in directories SCIENCE Si, and then recollect the corrected images in the SCIENCE directory. They have now the extension OFCU in their file name, indicating that the sky background has been subtracted. The old OFC images are found in the OFC IMAGES subdirectory.

A certain fraction of images will still suffer from the reset anomaly. To correct for this effect, you can calculate and subtract an average column from the data. This process is called Collapse correction. Enter 2.0 and 5 for DT and DMIN, and specify x to indicate that the feature you want to correct for runs horizontally.

Once run, the file names change into OFCUC. It is now the time to look at quite some of them to make sure that they are satisfying. They should largely be flat and in the ideal case not show any features anymore in the sky background, apart from possible slow large-scale variations. If one or two images still look very uneven (most likely the very first image of the entire sequence), then feel free to just delete them. Check the THELI documentation for more details, and when to modify the numeric parameters.

5 Weighting

Here THELI calculates indiviual weight maps for each exposure. You want to do the Create global weights and the Create WEIGHTs tasks. Upon execution, you will find a WEIGHTS directory on the same directory level as SCIENCE.

6 Astrom/Photom

In this PG THELI downloads an astrometric reference catalogue from the web, and extracts an object catalogue for each image taken. The object catalogues are then compared to the reference catalogue to correct for inaccurate CRPIX1/2 header keywords (i.e. a zero-order astrometric solution). Thereafter, a full distortion correction is performed and relative photometric zeropoints obtained. Remaining sky background residuals can be modelled and subtracted at the end.

For the reference catalogue, choose Web (CDS) and USNO-B1 as a source, enter a search radius of 3′ and a magnitude limit. Leave the RA and DEC fields empty. If you observed an empty field and don’t see many stars (say, less than 20), then enter 21 for the magnitude limit. If you see numerous stars, try 17 or 18. If your field is extremely crowded, lower the magnitude limit to 12. Then click Get catalogue and wait until you get a response in the yellow message window, telling how many stars there are found. This can take a while, and THELI will appear unresponsive during that wait. You should adjust the magnitude limit such that you obtain between 10 − 200 reference sources.

Then select Create source cat. For a very empty field, enter 3 and 5 for DT and DMIN, respectively. If you see a few dozen stars, you may go with (5|5) or (5|10). If the field starts to show hundred sources, go with (10|10), and if it is very crowded try (50|10). The reason for this is to keep a reasonable number of objects that will be matched with the reference catalogue. In general, the tolerance for these parameters is very large, so don’t think too much about it and just try. We recommend you create the catalogues now before proceeding to the next step.

Then, activate Astro+photometry, and choose Astrometrix (1st choice, but slower) or Scamp (2nd choice, but faster). Both calculate full astrometric solutions including distortion correction. Both will usually run on most data sets. If one fails, try the other. If both fail, try changing the detection parameters and possibly the magnitude limit. If they still fail, just go with the Shift only option. The latter does not care about distortions or sky coordinates and matching with the reference catalogue, it just determines the offsets of all exposures with respect to the first image. This can be useful in very sparse fields where hardly any sources are visible. For a more detailed discussion, see the THELI manual. The astrometric solution will be stored in SCIENCE/headers, the object catalogues in SCIENCE/cat. For the latter a skycat version exists for each image, which can be used for overplotting.

To subtract the remaining sky residuals, enter 1, 5 and 256 for DT, DMIN and SIZE. Choose Model sky for the method, or any of the other options. The manual will describe which ones are useful for which case. After sky subtraction, images OFCUC.sub.fits exist in the SCIENCE directory.

7 Coaddition

Lastly, the coadded image is created. You do not need to provide any parameters. Just execute the task. This will create a SCIENCE/coadd DEFA folder, the coadded image therein will be called coadd.fits. If the astrometric solution has failed (i.e. you see double sources or big warps), switch to a different solution method than the one used, and/or obtain a denser/less dense object/reference catalogue. Run the astrometric solver again, and then the coaddition. You do not need to re-run the sky subtraction. If you do not want to overwrite the old coaddition, enter an arbitrary 4 character long string in the ID field. If you enter e.g. BBBB, the new coaddition directory will be called coadd BBBB.

Unless you have chosen Shift only for the astrometry, the coadded image has a full astrometric calibration. No absolute photometric calibration is done.

Top | Back

Contact:  (LIRIS Instrument Specialist)
Last modified: 31 December 2013