STScI Logo

Space Telescope Imaging Spectrograph
CL Script for creating daily dark files

CL Script for Creating Daily Dark Reference Files

Download the script

The daydark script is a modified version of the daydarkT script. The modification allows it to read the slope and reference temperature from keywords in the reference file header. These values are used to correct the dark rate for daily temperature fluxuations. When a keyword is not available in the header, the program will look at a date the reference file was created and if it falls after the switch to Side-2 electronics (May 2001), then a reference temperature of 18 degrees and a slope of 0.07 will be applied. If the date is before the switch to Side-2 electronics, no temperature correction is necessary.

The daydark script requires two input file templates (plus one other file if appropriate, see below):

  1. One or more daily dark images, i.e. archive images that have TARGNAME=DARK. This can be one cosmic-ray-rejected image (with extension "_crj.fits"), or two or more raw images (with extension "_raw.fits"). The exposure time for the daily darks is 60 seconds. See below for instructions to retrieve these images.
  2. The reference "weekly dark" image which is delivered to the STScI OPUS pipeline on a monthly basis and can be retrieved from the archive using the "best ref." screens as above. This file has extension _drk.fits and was created with data form the week of interest.
  3. If the daily dark file template (mentioned under 1. above) is a list of raw images, the appropriate reference bias file (with extension _bia.fits) also has to be retrieved from the archive (which can be done using the "best ref." screens) and entered in the script as "biasfile". This file is a "weekly bias" that spans over the week of the daily dark.

After bias subtraction and cosmic ray rejection (if necessary) and normalizing the daily dark image to intensity units of electrons per second, the script calculates iterative statistics on both the daily dark and the weekly dark in order to neglect the hot pixels. "New hot pixels" are defined as pixels having a value higher than 5 sigma above the median dark current of the daily dark. The hot pixels in the weekly dark are replaced by those in the daily dark (the "new hot pixels"). Pixels in the weekly dark having a value below the threshold of 5 sigma above the median dark current of the daily dark are not changed. Pixels that have healed themselves during the time between the USEAFTER date of the weekly dark and the exposure date of the daily dark are given the value of a median-filtered version of the weekly dark. The result is a superdark with the signal-to-noise of the weekly dark in which the hot pixels have been updated.

The daily dark images, the reference bias image, and the reference weekly dark images can be retrieved using Starview.

The way daily dark images should be retrieved using Starview is as follows. First of all, go to "HST Instrument Searches", then "STIS Instrument". After that, the selections to be made depend on the observation date:

For data taken before June 29, 1998, select "Start" (which refers to Start Date) to be the observation date (e.g., "03/28/98"), "Target Name: DARK", "Detector: CCD", and "CCD Gain: 4" (Here is an example). After a successful search, retrieve the "Calibrated" data. The forthcoming "_crj.fits" file is the one to use as input to the daydarkT script.

For data taken on or after June 29, 1998, "Start" should be selected as the date of the observations plus the preceding day. For instance, if the observing date is June 30, 1998, then enter "06/29/98..06/30/98". Also select "Exp. Time (s): <200.", "Target Name: DARK", and "Detector: CCD" (Here is an example.) After a successful search, retrieve the "Uncalibrated" data as well as the "Best reference Files". The latter will ensure that one will also retrieve the appropriate "weekly bias" and "weekly dark" reference files.

To use the script, in IRAF do the following:

cl> task daydark = daydark.cl

The parameter file should look like this: (Where "basedark" means the reference weekly dark)



  infiles = ""              Input dark image(s) to be combined/normalized
 basedark = ""              Name of baseline superdark file
(biasfile = "")             Name of reference bias file to be used
 (outfile = "day_dark.fits") Name of output normalized daily superdark
(houstemp = )               Housing temperature(s) for these exposures
 (maxiter = 40)             Maximum number of iterations for imstat
   (lower = INDEF)          Initial lower limit for imstat
   (upper = INDEF)          Initial upper limit for imstat
 (verbose = no)             Show results of imstat iterations?
   (print = no)             Print final results of imstat iterations?
 (imglist = "")             Internal use only, do not edit
 (Version = "26Apr02")      Date of Installation
    (mode = "al")           


For more information on the use of the daydark script, download its help pages. Before recalibrating your raw science data with this new dark you'll need to edit your science header in the following manner in IRAF:

cl> hedit sciencefile_raw.fits[0] DARKFILE daydark.fits

and, if the best bias reference file is different from the one in the header of the raw science data:

cl> hedit sciencefile_raw.fits[0] BIASFILE bestbiasref.fits

where "bestbiasref.fits" is the name of the bias reference file you just retrieved from the archive.

Download the script