11.3 Patterns and Dithering

A pattern refers to a series of exposures of a single target taken at slightly different telescope pointings, with the same set of guide stars. For STIS, patterns are commonly used to:

  • Dither to decrease the effects of small-scale detector nonuniformity, eliminate hot pixels, and/or increase the spatial resolution (the latter requires sub-pixel stepping) by offsetting the target along a long slit in the spatial direction for spectroscopic observations or by performing a small stepping pattern for imaging or slitless spectroscopic observations (see Section 11.3.5).
  • Spectroscopically map out a two-dimensional region of the sky by stepping the slit across the object of interest.
  • Spectroscopically subsample the line spread function by stepping a fraction of a pixel along the dispersion direction—see Section 12.6.

In Cycles 9 through 11, patterns were defined and then added to exposures as special requirements. In the APT Orbit Planner, this approach was replaced by the use of pattern containers. The observer selects a pattern (or constructs a composite pattern) from a list of generic and instrument-specific patterns and then defines one or more pattern containers which use this selected pattern. The exposures to be dithered are then put into these containers.

The pre-defined STIS patterns have a number of adjustable parameters. All patterns allow the Point_Spacing, which is given in units of arcseconds, as well as the Pattern_Orient, given in units of degrees, to be adjusted by the observer. Specifying Center_Pattern = YES, will cause the pattern as a whole to be centered at the specified coordinates; otherwise, the given coordinates will apply to the first point in the pattern.

A full description of all patterns, including illustrations and a list of all adjustable parameters and default values for each pattern type, are given in the HST Phase II Proposal Instructions. Additional examples and advice are given in the Dither Handbook, the online drizzlepac documentation, The DrizzlePac Handbook (Hoffmann et al. 2021), and the other references listed at the end of this section.

11.3.1 STIS Imaging Patterns

STIS-SPIRAL-DITH can be used to make a mosaic of images. It performs a spiral dither pattern, starting at the center and moving outward counterclockwise. For this pattern, both the Number_of_Points and the Point_Spacing (in arcseconds) must be specified by the observer.

STIS-CCD-BOX and STIS-MAMA-BOX are parallelograms based on the BOX patterns used with WFPC2 and STIS in Cycle 8 to dither images. The default parameters for these two patterns give offsets in integer numbers of pixels along the X-axis and Y-axis, which can be used, for example, to dither hot pixels. By dividing the default point spacing by 2, one can achieve half-pixel shifts in each coordinate to improve spatial sampling.

11.3.2 STIS Spectroscopic Patterns

STIS-ALONG-SLIT, which steps the target along the slit, can be used to dither hot pixels (integer pixel steps) or to improve spatial sampling (fractional pixel steps) in spectroscopic images (see Figure 11.7).

STIS-PERP-TO-SLIT can be used to step the slit across an extended source to map the spectral characteristics of the source (see Figure 11.8). It can also be used to subsample the line spread function by moving a target by fractions of a pixel.

For both of these patterns, the Point_Spacing (in arcseconds) and the Number_of_Points must be specified by the observer.

11.3.3 Generic Patterns

Generic patterns, available for all instruments, have been added for flexibility in pattern design. The generic LINE pattern allows for movement along a line at an arbitrary angle. The generic SPIRAL pattern is essentially the same as the STIS-SPIRAL-DITH.

11.3.4 Combining Patterns

In Cycle 9, the ability to combine two patterns was introduced. After selecting a pattern and defining its parameters, one can choose to add a secondary pattern, which is then executed at each point in the primary pattern. The secondary pattern can either be centered on the primary points or it can use the primary points as its initial points. For example, instead of just stepping a slit across an extended target at five points with STIS-PERP-TO-SLIT, you can add STIS-ALONG-SLIT with two points to make a 5 × 2 grid of observations. If Center_Pattern=yes for both patterns, the grid will be centered on the target position. To check that you have specified a pattern correctly, you can display it using the APT.

Figure 11.7: Stepping a Target Along a Long Slit to Dither Hot Pixels or Improve Spatial Sampling.


This example shows the pattern STIS-ALONG-SLIT, with NUMBER_OF_POINTS = 5 and POINT_SPACING = 0.15 (arcseconds).
Figure 11.8: Stepping Target Perpendicular to Slit to Map 2-D Region of Sky.


This example shows the pattern STIS-PERP-TO-SLIT, with NUMBER_OF_POINTS = 5 and POINT_SPACING = 0.2 (arcseconds).

11.3.5 Dither Strategies

There is no single observing strategy that is entirely satisfactory in all circumstances for STIS. One must consider cosmic rays, hot pixels (pixels with high, time-variable dark current), and spatial undersampling of the image. One strategy that can be used to minimize the effects of undersampling and to reduce the effects of hot pixels is to dither, that is, to offset the telescope between exposures by either integer or sub-pixel steps. The best choice for the number and size of the dithers depends on the amount of time available and the goals of the project. In the following we will address a few issues related to dithering:

  • Undersampling of images: Individual images taken with sub-pixel offsets can be combined to form an image with higher spatial resolution than that of the original images. A single dither from the original pixel position, call it (0,0), to one offset by half a pixel in both x and y (0.5,0.5) will produce a gain in spatial information. On the other hand, very little extra information is gained from obtaining more than four positions. Therefore the recommended number of sub-pixel dither positions is between 2 and 4.
  • Undersampling of spectral images: The spatial undersampling of compact sources in spectral images becomes apparent after the images are rectified. Interpolation during the rectification process spreads flux from the local peak row of the spectrum into adjacent rows. The result is undulation of the flux level in the individual spectral rows of the rectified image. If the spectrum is nearly horizontal on the detector (which is the case for gratings G140L, G230LB, G230MB, G430L, and G750L), the resulting undulation pattern is broad and irregular. On the other hand, if the spectrum has an appreciable tilt across the detector (as for gratings G140M, G230M, G230L, G430M, and G750M; see e.g., STIS ISR 1998-19), the undulation is quasi-periodic. Two representative cases are shown in Figure 11.9, which displays the flux in the peak row in the rectified image normalized by the total flux for stellar observations taken with G430L (top) and G750M (bottom).  Note that this effect is inconsequential in most cases: if the source is unresolved, several rows of the spectrum will be extracted to make a single spectrum, eliminating the effect; if the source is sufficiently extended to be well sampled, the undulations will not occur. A problematic situation is encountered when row-by-row spectral analyses are needed of an extended component which is affected by the undulations produced by a compact component (e.g., near the center of a galaxy containing an active nucleus). For example, kinematic measurements of spatially extended emission or absorption lines can be affected in cases where a compact continuum component produces a baseline that fluctuates rapidly across the spectral lines of interest. The amplitude of the fluctuations can be reduced by using the Python tool wx2d instead of x2d. (See STIS ISR 2007-04, but note that this references the PYRAF version of the tool.) To obtain substantially greater improvement, one must combine data dithered by a non-integer number of pixels along the slit, (e.g., N+0.5 pixels), but be aware that spectroscopic data are not supported by AstroDrizzle.

Figure 11.9: Undulations in the Flux Level of Individual Rows in Rectified Spectra of Point Sources, Caused by Rectification of Spatially Undersampled Spectral Images.


  • Hot Pixels in CCD Data: There are three ways to deal with hot pixels: (1) Correct them using superdarks constructed from darks taken on the day of the observation. These can be created using stistools weekdark (similar to the previously recommended task daydark in STSDAS). (2) Dither by an integer number of pixels. Dithered images can be combined with AstroDrizzle; dithered spectral images can be aligned with the Python tool sshift before being combined with ocrreject. If three or more exposures are obtained, cold pixels that produce low fluxes can be rejected (e.g., with mscombine, which allows rejection of low fluxes as well as high fluxes). Alternatively, anomalously low fluxes can be set to very high values (e.g., as previously done with imrepl); they can then be rejected by ocrreject like hot pixels or cosmic rays. (3) Use a task such as STSDAS warmpix (no longer supported) to filter out the known hot pixels. Hot pixels are flagged in the data quality array during dark subtraction and propagate through to the output images.
  • Hot Pixels in MAMA data: The MAMA detectors show few hot pixels and they appear to evolve slowly, thus they are usually not an issue. Nevertheless, dithering is an easy way to avoid them, and there is no read noise or cosmic-ray removal penalty for doing so.
  • Cosmic Rays: Cosmic rays in the raw CCD images are most easily removed by running ocrreject on CR-SPLIT exposures. At least two exposures are needed, but more are recommended, especially for longer exposures where the possibility of cosmic ray coincidence in two exposures is greater. For spectroscopic observations, integer pixel dithers along the slit are recommended to aid in the rejection of hot and cold pixels along with cosmic rays, as discussed above. For imaging observations, dithered exposures are recommended for the same reasons, but will have to be combined with a task like AstroDrizzle, a more resource-intensive and time-consuming process.
  • Dithering Spectroscopic Observations: In the case of spectroscopic observations, extra care should be taken in choosing the optimum dither strategy, which depends on the spatial extent of the extractions and the nature of the science target. However, beware that dithering spectroscopic observations will only be useful if your exposure times are long enough, especially for CCD spectra that can become severely read noise limited (see Section 7.3.4).
    • Spectra of Point Sources: 1-D first-order spectra of point sources are usually extracted over 7 spatial pixels for the CCD, 11 spatial pixels for the MAMAs (during STIS pipeline processing). Hence, the effect of hot pixels is exacerbated compared to the case of imaging observations. The best practice is to dither the target by an offset large enough to avoid having the same hot pixels fall in the individual extracted spectra. This means that you should move the spectrum by more than 0.35 arcseconds (for a 7 pixel CCD extraction) along the slit between dither positions. Exposures with integer pixel shifts can be aligned with sshift. A pair of dithered exposures is preferable to a CR-SPLIT=2 exposure, but more exposures (e.g., CR-SPLIT dithered exposures) will provide better cosmic ray rejection, especially for long exposure times.
    • Spectra of Extended Sources: For extended sources, one should consider the spatial size of the extractions to be made during post-observation analysis, or whether rectified spectral images will be analyzed instead of extracted spectra. To enable a proper rejection of hot pixels within broad extractions, the telescope move between dithers should be larger than the spatial size of the extractions made. If a spectral image is to be analyzed, and the region of interest is at or near a sharp peak in the surface brightness distribution, one should consider dithering by a non-integer number of pixels to deal with the undulation issue due to undersampling (see above).
    • Dithering of Echelle Observations: Because most echelle observations are done using small apertures, many of the dithering strategies recommended for 1st order spectra are not applicable to the echelle modes. However, there are still a number of ways to shift the spectrum on the detector to work around hot pixels or flat-fielding artifacts. For many observers, the simplest way to dither echelle data will be to observe using two or more different CENWAVE settings that each cover the wavelengths of interest; however, wavelengths near the ends of the wavelength ranges will then not be covered by all of the exposures. Another way is the use of FP-SPLIT apertures (see Section FP-SPLIT Slits for Echelle Observations), which are displaced along the dispersion direction. And observers using the echelle with a long slit can also dither up and down the length of the aperture. Observers should also remember that there is some overlap between many adjacent echelle orders, so some wavelengths will appear at two different locations in the same spectral image.
  • Accuracy of Dithering: During the Hubble Deep Field campaign, nearly all dithers were placed to within 10 milliarcsec (mas) (during 1.3 arcsecond offsets and returns separated by multiple days), although in a few cases the dither was off by more than 25 mas, and on one occasion (out of 107 reacquisitions) the telescope locked on a secondary FGS peak – causing the pointing to be off by approximately 1 arcsecond and a field rotation of about 4 arcminutes. The software which was developed for the Hubble Deep Field was able to reconstruct images even for those non-optimal dithers, and still yielded gains in resolution over non-dithered data. Those capabilities are now available in drizzlepac (current successor to the STSDAS dither package), which is based on the variable-pixel linear-reconstruction technique developed by Fruchter and Hook (known as drizzling). STIS imaging data can be drizzled together provided several preparatory steps are taken: updating the WCS with the stwcs.updatewcs routine and accurately aligning the images to sub-pixel accuracy with the drizzlepac.tweakreg routine. For help with combining STIS images, contact the Help Desk.
  • Flat-Field Accuracy: For the MAMAs, dithering on scales of several pixels can help to smooth out pixel-to-pixel variations in detector sensitivity. For this purpose it is best to use dither steps that are not integral multiples of half a pixel (the intrinsic high-resolution format of the MAMAs); integral pixel steps should be used instead.

Note that dark and flat-field reference files need to be applied before any shift-and-add procedures. This may require running the usual pipeline calibration in pieces with the combination of the different dither positions inserted in the middle. Once dark subtraction has been done, hot pixels are about as likely to be over-subtracted as under-subtracted in the image. In this case, those pixels should be treated as "cold" pixels (see section on Hot Pixels in CCD Data above).

Be sure to use the correct plate scales when calculating the along-the-slit pixel offsets a given dither size will produce. See Table 14.38 for the pixel scales for each detector and Section 13.2.4 for more information on the header PLATESC plate scales.

The simplest way to schedule dithers with STIS is to use the patterns STIS-CCD-BOX or STIS-MAMA-BOX (four-point parallelogram dithers, centering on fractional pixels to gain spatial resolution) or, for spectroscopic observations that use a long slit, the pattern STIS-ALONG-SLIT (for linear dithers in the AXIS2 direction, with user-specified offsets). An alternate approach is to use POS-TARGs.

Note that large dithers will incur small errors due to the camera geometric distortion, which increases toward the CCD corners and alters the image scale by about 1% at the corners. For instance, a 20 pixel offset at the field center will suffer a 0.2 pixel error at the CCD corners. Large dithers may also occasionally require a different set of guide stars for each pointing, thus increasing the overhead for the observations and reducing the expected pointing accuracy.

For related articles on dither strategies, see the following papers (all available through the STScI webpages): A Package for the Reduction of Dithered Undersampled Images (Fruchter et al., in the 1997 HST Calibration Workshop Proceedings), the WFPC2 ISR 98-04, Drizzle: A Method for the Linear Reconstruction of Undersampled Images (Fruchter & Hook 2002, PASP, 114, 144), the Dither Handbook (Koekemoer et al.), the online drizzlepac documentation, and The DrizzlePac Handbook (Hoffmann et al. 2021).

A STIS DrizzlePac Tutorial Jupyter Notebook is now available from the STIS-Notebooks GitHub repository or the STIS Data Analysis & Software Tools webpage. The Notebook includes examples of aligning and combining images from all three STIS detectors using tools from DrizzlePac, as well as an example of using the pixel-based CTI correction code stis_cti on STIS CCD images (see Section 7.3.9).  Further details regarding the Notebook can be found in the STIS April 2022 STAN