STScI Logo
STScI Logo
HST
Banner
FAQ
STScI

Part I: Introduction to Reducing the HST Data

TOC PREV NEXT INDEX PDF

3.4 Analyzing HST Images


This section describes methods for using STSDAS and IRAF to work with two-dimensional image data from HST. Subjects include:

  • Relating your image to sky coordinates.
  • Examining and manipulating your image.
  • Working with NICMOS, STIS, and ACS imsets.
  • Converting counts to fluxes.
Figure 3.2: Displaying Sections and Groups of an Image
 

3.4.1 Basic Astrometry

This section describes how to determine the orientation of an HST image and the RA and Dec of any pixel or source within it, including:

  • Tasks that supply positional information about HST images.
  • Methods for improving your absolute astrometric accuracy.

Positional Information

The header of every calibrated HST two-dimensional image contains a linear astrometric plate solution, written in terms of the standard FITS astrometry header keywords: reference pixel values (CRPIX1, CRPIX2, CRVAL1, CRVAL2), and the CD matrix (CD1_1, CD1_2, CD2_1, and CD2_2). IRAF/STSDAS tasks can use this information to convert between pixel coordinates and RA and Dec. Two simple tasks that draw on these keywords to relate your image to sky coordinates are:

  • disconlab: Displays your image with a superimposed RA and Dec grid. Simply open an SAOimage window and type, for example:

    sd> disconlab n3tc01a5r_cal.fits[1]


     
  • xy2rd: Translates x and y pixel coordinates to RA and Dec. (The task rd2xy inverts this operation.) SAOimage displays the current x,y pixel location of the cursor in the upper-left corner of the window. To find the RA and Dec of the current pixel, you supply these coordinates to xy2rd by typing

    sd> xy2rd n3tc01a5r_cal.fits[1] hms+ x y


     

Note, the hms option formats the results in hours, min, and seconds.

Observers should be aware that these tasks do not correct for geometric distortion. Only FOC, STIS, and ACS images currently undergo geometric correction during standard pipeline processing. (For WFPC2, a pixel area map correction image (f1k1552bu.r9h) may be obtained from the archive.) If precise relative astrometry is needed, an instrument-specific task that accounts for image distortion, such as the metric task for WF/PC-1 and WFPC2 images, should be used.

Do not use tasks like rimcursor or xy2rd directly on WF/PC-1 or WFPC2 images if you require accurate relative positions. WF/PC-1 and WFPC2 pipelines do not correct for geometric distortions which will affect the accuracy of relative positions. Both wmosaic and metric, found in the stsdas.hst_calib.wfpc package, correct for this distortion.

Table 3.2 lists some additional tasks that draw on the standard astrometry keywords.

Table 3.2: Additional IRAF and STSDAS Astrometry Tasks
Task Purpose
compass Plot north and east arrows on an image.
north Display the orientation of an image based on keywords.
rimcursor Determine RA and Dec of a pixel in an image.
wcscoords Use WCS1 to convert between IRAF coordinate systems.
wcslab Produce sky projection grids for images.
1World Coordinate System (WCS). Type help specwcs at the IRAF prompt for details.

 

Improving Astrometric Accuracy

Differential astrometry (measuring a position of one object relative to another in an image) is easy and relatively accurate for HST images. Absolute astrometry, on the other hand, is more difficult, owing to uncertainties in the locations of the instrument apertures relative to the Optical Telescope Assembly (OTA or V1) axis and the inherent uncertainty in Guide Star positions. However, if you can determine an accurate position for any single star in your HST image, then your absolute astrometric accuracy will be limited only by the accuracy with which you know that star's location and the image orientation.

If there is a star on your image suitable for astrometry, you may wish to extract an image of the sky around this star from the Digitized Sky Survey and measure the position of that star using, for example, the GASP software (described in the STSDAS User's Guide). These tools provide an absolute positional accuracy of approximately 0.7 arcsec. Contact the Help Desk for assistance (send E-mail to help@stsci.edu).

3.4.2 Examining and Manipulating Image Data

This section describes implot and imexamine, two basic IRAF tools for studying the characteristics of an image, and Table 3.4 lists some useful IRAF/STSDAS tasks for manipulating images.

implot

The IRAF implot task (in the plot package) allows you to examine an image interactively by plotting data along a given line (x-axis) or column (y-axis). When you run the task, a large number of commands are available in addition to the usual cursor mode commands common to most IRAF plotting tasks. A complete listing of commands is found in the on-line help, but the most commonly used are listed in Table 3.3. Figure 3.3 shows an example of how to use the implot task.

Table 3.3: Basic implot Commands
Keystroke Command
Display on-line help.
Plot a line.
Plot a column.
Move down.
Move up.
Display coordinates and pixel values.
Quit implot.

 
Figure 3.3: Plotting Image Data with implot
 

imexamine

The IRAF imexamine task (in the images.tv package) is a powerful task that integrates image display with various types of plotting capabilities. Commands can be passed to the task using the image display cursor and the graphics cursor. A complete description of the task and its usage are provided in the online help, available from within the IRAF environment by typing help imexamine.

3.4.3 Working with STIS, ACS, and NICMOS Imsets

NICMOS, STIS, and ACS data files contain groups of images, called imsets, associated with each individual exposure. A STIS or ACS imset comprises SCI, ERR, and DQ images, which hold science, error, and data quality information. A NICMOS imset, in addition to SCI, ERR, and DQ images, also contains TIME and SAMP images recording the integration time and number of samples corresponding to each pixel of the SCI image. See the NICMOS, STIS, and ACS Data Structures chapters for more details on imsets.

Table 3.4: Image Manipulation Tasks
Task Package Purpose
boxcar images.imfilter Boxcar smooth a list of images
blkavg images.imgeom Block average or sum an image
gcombine stsdas.toolbox.imgtools Combine GEIS images using various algorithms and rejection schemes1
gcopy stsdas.toolbox.imgtools Copy multigroup GEIS images1
geomap images.immatch Compute a coordinate transformation
geotran images.immatch Resample an image based on geomap output
grlist stsdas.graphics.stplot List of file names of all groups of a GEIS image (to make @lists)1
gstatistics stsdas.toolbox.imgtools Compute image statistics1
imcalc stsdas.toolbox.imgtools Perform general arithmetic on images
imedit images.tv Fill in regions of an image by background estimation or copy and paste
imexamine images.tv Examine images using display, plots, and text (see 15)
implot plot Plot lines and columns of images (see 14)
magnify images.imgeom Magnify an image
msarith stsdas.toolbox.mstools Performs basic arithmetic on NICMOS and STIS imsets2
mscombine stsdas.toolbox.mstools Extension of gcombine for NICMOS, STIS, and ACS imsets1
msstatistics stsdas.toolbox.mstools Extension of gstatistics for NICMOS and STIS imsets1, 2
newcont stsdas.graphics.stplot Draw contours of two-dimensional data
pixcoord stsdas.hst_calib.wfpc Compute pixel coordinates of stars in a GEIS image1
plcreate xray.ximages Create a pixel list from a region file (e.g., from SAOimage regions)
rotate images.imgeom Rotate an image
saodump stsdas.graphics.sdisplay Make image and colormap files from SAOimage display
siaper stsdas.graphics.stplot Plot science instrument apertures of HST
1Will process all groups of a multigroup GEIS file. An OIF (imh/pix) file is like a GEIS file with one group.
2Task is not yet functional with ACS data.

 

Here we describe several STSDAS tasks, located in the stsdas.toolbox.imgtools.mstools package, that have been designed to work with imsets as units and to deconstruct and rebuild them.

msarith

This tool is an extension of the IRAF task imarith to include error and data quality propagation. The msarith task supports the four basic arithmetic operations (+, -, *, /) and can operate on individual or multiple imsets. The input operands can be either files or numerical constants; the latter can have associated errors, which will propagate into the error array(s) of the output file.

mscombine

This task runs the STSDAS task gcombine on NICMOS, STIS, and ACS data files. It divides each imset into its basic components (SCI, ERR, and DQ, plus SAMP and TIME for NICMOS). The SCI extensions then become the inputs for the underlying gcombine task, and the ERR extensions become the error maps. The DQ extensions are first combined with a user-specified Boolean mask allowing selective pixel masking and are then combined into the data quality maps. If scaling by exposure time is requested, the exposure times of each imset are read from the header keyword PIXVALUE in the TIME extensions.

Once gcombine has finished, mscombine then reassembles the individual output images into imsets and outputs them as one NICMOS, STIS, or ACS data file. The output images and error maps from gcombine form the SCI and ERR extensions of the output imset. The DQ extension will be a combination of the masking operations and the rejection algorithms executed in gcombine. For NICMOS, the TIME extension will be the sum of the TIME values from the input files minus the rejected values, divided on a pixel-by-pixel basis by the number of valid pixels in the output image. The final TIME array will be consistent with the output SCI image (average or median of the science data). The SAMP extension for NICMOS is built from all the input SAMP values, minus the values discarded by masking or rejection.

msstatistics

This tool is an extension of gstatistics in the STSDAS package, which is in turn an extension of imstatistics. The main novelty is the inclusion of the error and data quality information included with NICMOS and STIS images in computing statistical quantities. This task is not yet functional with ACS data.

In addition to the standard statistical quantities (min, max, sum, mean, standard deviation, median, mode, skewness, kurtosis), two additional quantities have been added to take advantage of the error information: the weighted mean and the weighted variance of the pixel distribution. If xi is the value at the i-th pixel, with associated error i, the weighted mean and variance used in the task are:

and:

The data quality information carried by the NICMOS or STIS file is used to reject pixels in the statistical computation. Users can supply additional masks to reject objects or regions from the science arrays.

mssplit and msjoin

The mssplit task extracts user-specified imsets from a NICMOS, STIS, or ACS data file and copies them into separate files. Each output file contains a single imset along with the primary header of the original file. You might find this task useful for reducing the size of a NICMOS, STIS, or ACS file containing many imsets or for performing analysis on a specific imset. The msjoin task does the opposite of mssplit: it assembles separate imsets into a single data file.

There are additional tasks in this package for deleting and sorting imsets, as well as tasks for addressing a specific image class within an imset.

3.4.4 Photometry

Included in this section are:

  • A list of IRAF/STSDAS tasks useful for determining source counts.
  • Instructions on how to use header keyword information to convert HST counts to fluxes or magnitudes.
  • A brief description of synphot, the STSDAS synthetic photometry package.

IRAF and STSDAS Photometry Tasks

The following are some useful IRAF/STSDAS packages and tasks for performing photometry on HST images:

  • apphot: aperture photometry package.
  • daophot: stellar photometry package useful for crowded fields.
  • isophote: package for fitting elliptical isophotes.
  • imexamine: performs simple photometry measurements.
  • imstat: computes image pixel statistics.
  • imcnts: sums counts over a specified region, subtracting background.
  • plcreate: creates pixel masks.

Consult the online help for more details on these tasks and packages. The document "Photometry using IRAF" by Lisa A. Wells, provides a general guide to performing photometry with IRAF; it is available through the IRAF web page:


http://iraf.noao.edu/docs/photom.html

The apphot package allows you to measure fluxes within a series of concentric apertures. This technique can be used to determine the flux in the wings of the PSF, which is useful if you wish to estimate the flux of a saturated star by scaling the flux in the wings of the PSF to an unsaturated PSF.

Converting Counts to Flux or Magnitude

Calibrated HST images record signal in various units: WFPC2 and STIS imaging data are in DN (Data Numbers or counts); NICMOS data are in DN per second; ACS calibrated data are in electrons; and ACS drizzled data are in electrons per second. The pipeline calibration tasks do not alter these units in the images when performing the photometric correction step. Instead they calculate and write the sensitivity conversion factor (PHOTFLAM) and the ST magnitude scale zero point (PHOTZPT) into header keywords in the calibrated data. WF/PC-1 and WFPC2 observers should note that the four chips are calibrated individually, so these photometry keywords belong to the group parameters for each chip. For ACS observers, the PHOTFLAM values for the two WFC chips are defined to be the same.

PHOTFLAM is defined as the mean flux density F in units of erg cm-2 s-1 Å-1 that produces 1 count per second in the HST observing mode (PHOTMODE) used for the observation. Note that the word 'count' may refer to DNs or electrons, depending on the instrument used. For example, calibrated ACS images are already corrected for the instrumental gain, and the PHOTFLAM values are computed accordingly. The PHOTFLAM values for WFPC2, on the other hand, are dependent on the gain.

Calibrated images in units of counts may be converted to flux in units of erg cm-2 s-1 Å-1 by multiplying the image by the value of the PHOTFLAM header keyword and dividing by the value of the EXPTIME keyword (exposure time). Calibrated images in units of counts per second (i.e. NICMOS data in DN s-1 and drizzled ACS data in electrons s-1), may simply be multiplied by the PHOTFLAM value to obtain the flux in units of erg cm-2 s-1 Å-1. NICMOS headers also contain the keyword PHOTFNU in units of Jy s. Multiplying NICMOS image by the PHOTFNU value will therefore yield fluxes in Janskys.

The STSDAS task imcalc may be used to convert an image from counts to flux units. For example, to create a flux-calibrated output image outimg.fits from an input WFPC2 image inimg.fits[1] with header keywords PHOTFLAM = 2.5E-18 and EXPTIME = 1000.0, type:

st> imcalc inimg.fits[1] outimg.fits "im1*2.5E-18/1000.0"


 

If the F spectrum of your source is significantly sloped across the bandpass or contains prominent features, such as strong emission lines, you may wish to recalculate the inverse sensitivity PHOTFLAM using synphot, described below. WF/PC-1 and WFPC2 observers should note that the PHOTFLAM values calculated during pipeline processing do not include a correction for temporal variations in throughput owing to contamination buildup, or Charge Transfer Efficiency (CTE) effects. Likewise, FOC observers should note that PHOTFLAM values determined by the pipeline before May 18, 1994 do not account for sensitivity differences in formats other than 512 x 512. Consult the appropriate instrument section of the Data Handbook for more information.

If your HST image contains a source whose flux you know from ground based measurements, you may choose to calibrate the final photometry of your HST image from the counts observed for this source.

To convert a measured flux F, in units of erg cm-2 s-1 Å-1, to an ST magnitude, the following equation may be used:

m = -2.5 x log10 (F) + PHOTZPT

where the value of the PHOTZPT keyword is the zero point of the ST magnitude or STMAG scale. The STMAG system is designed so that the specrtum of Vega has constant flux per unit wavelength. The zero point of the STMAG system is equal to -21.10, a value chosen so that Vega has an ST magnitude of zero for the Johnson V passband (see Koornneef et al., 1986; Horne, 1988; and the Synphot Users Guide). Further zeropoint corrections are necessary for converting from STMAG to other systems like Johnson/Cousins, and depend on the color of your sources. See specific photometry examples in the instrument part of the Data Handbook (Part II).

Synphot

The STSDAS synthetic photometry package, called synphot, can simulate HST observations of astronomical targets with known spectra. It contains throughput curves of all HST optical components, such as mirrors, filters, gratings, apertures, and detectors, and can generate passband shapes for any combination of these elements. It can also generate synthetic spectra of many different types, including stellar, blackbody, power-law and H II region spectra, and can convolve these spectra with the throughputs of HST's instruments. You can therefore use it to compare results in many different bands, to cross-calibrate one instrument with another, or to relate your observations to theoretical models.

One useful application of synphot is to recalculate the value of PHOTFLAM for a given observation using the latest HST sensitivity tables. The bandpar task may be used to compute the photometric parameters of a passband using the combined throughputs of the individual HST components. For example, to recalculate PHOTFLAM for an ACS observation, type:

sy> bandpar acs,wfc1,f555w


 

where the observation mode string is a comma separated list consisting of the instrument and its configuration, in this case the ACS detector with the WFC chip 1 and the F555W filter. (See the obsmode task in synphot and the Synphot User's Guide for help with these observation-mode keywords.) To see a list of observation mode keywords for the ACS, type:

sy> obsmode acs


 

Using the default parameters, the bandpar command shown above will print to the screen a table of photometric parameters. The URESP parameter contains the flux (in F) of a source that produces a response of one count per second in this passband and is therefore identical to PHOTFLAM.

Please see the Synphot User's Guide for more details on this package, and see Appendix A for information on getting the synphot dataset, which is not included with STSDAS.

3.4.5 Combining Dithered HST Datasets with MultiDrizzle

Many HST observations make use of the technique of dithering, or offsetting the telescope to different locations in order to move the target around the detector. This can be for several reasons, including sub-pixel offsets to improve PSF sampling, offsets to move bad pixels around to different locations on the sky, or large shifts comparable to the detector size, to create large mosaics of the target field.

The recommended software to combine dithered HST datasets is MultiDrizzle (Koekemoer et al. 2002, 2004), which is a Pyraf script designed to provide fully automated image registration, cosmic ray cleaning and final image combination using the drizzle software (Fruchter & Hook 2002) and PyDrizzle. MultiDrizzle is currently available within STSDAS 3.2 as a prototype release and has been tested on a representative set of commonly-used ACS, WFPC2 and STIS observing modes.

The basic required input for MultiDrizzle is simply a set of calibrated, flat-fielded files, with additional optional inputs including a user-defined bad pixel mask, or a user-defined shift file if the header shifts in the images are not sufficiently accurate. The script carries out the following steps:

  • Calculate and subtract a background sky value for each exposure
  • Search for additional bad pixels that are strongly negative, that may not have been flagged in the data quality arrays.
  • Determine shifts from the coordinates in the image headers, which are then applied in drizzling all the input images onto a series of separate output images that are all registered with respect to one another.
  • Use the drizzled exposures to create a median (optionally choosing the minimum instead of the median if there is a large enough difference)
  • Transform the median back to the frame of the original input exposures and calculate the derivative of this clean median image
  • Compare the median and its derivative against the original input exposure to create a cosmic ray mask for each exposure.
  • Use the cosmic ray masks in a final step that drizzles all the original input exposures together onto a single output image.

The various steps can each be turned on or off by the user, since there may be cases where not all the steps need to be run or some of them may have been run already in an earlier iteration of the script. In addition, parameters controlling the behavior of each step can be adjusted by the user. The default parameter values are set such that the script should produce a scientifically useful combined, drizzled image in a single one-touch operation. However, this may not be the optimal scientific image for a given set of exposures, therefore access is provided to parameters for drizzle and other steps for fine-tuning the results.

Please see the HST Dither Handbook (Koekemoer et al. 2004), as well as the on-line help documentation for MultiDrizzle within Pyraf, for further information about the various parameters to the script, as well as examples showing how to use the script to combine various types of HST datasets. Please note that since the software is still actively being improved, there may be some datasets for which problems might occur, in which case users are encouraged to send email to help@stsci.edu to obtain assistance. In general, however, the code has been well tested on a wide variety of the more commonly used observing modes and should produce useful results even with default parameters.

Finally, work is currently on-going to incorporate a more robust, fully redesigned version of MultiDrizzle into the operational HST Pipeline. The initial implementation of this version will be focussed on ACS associations, thus it will produce fully CR-cleaned, drizzle-combined images for all ACS associations. It will also be released within Pyraf as an off-line version capable of running WFPC2 and STIS data, in the same way as the current version. We expect the Pipeline release to occur in mid to late Summer 2004, followed shortly by the updated release within Pyraf.


TOC PREV NEXT INDEX PDF
Space Telescope Science Institute
http://www.stsci.edu
Voice: (410) 338-1082
help@stsci.edu
Shortcuts

ETCs
Cycle 17 Instrument Handbook
Data Handbook
ISRs
Instrument Comparisons
Call for Proposals
HST Primer
Phase II Proposal Instructions
Newsletters(STANs)


Copyright  | Help  | Printable Page