STScI Logo

Hubble Space Telescope
WFPC2 Drizzle Cookbooks

WFPC2 drizzling

See the WFPC2 drizzling overview to select the cookbook and/or sample dataset that best represents your dataset, with regards to target placement and pointing strategy.

Refining the image registration

Drizzle will use the World Coordinate System (WCS) information in the image headers to align the images. For data from the same visit, refining the image registration may not be necessary -- the frames are all likely registered to within 0.1 WF pixel or 5-10 mas. However, drizzling sub-sampled data to a finer output scale is very sensitive to the image registration, and even frames from the same visit can experience some drift due to guide star loss of lock. So measuring shifts is advisable, even if only to verify that they are insignificantly small. But if your dataset involves mosaic shifts greater than 100 arcsec, and/or data from different epochs and/or observing programs, then different guide stars were used, and you will certainly need to measure and apply delta shifts before combining your data.

Have MultiDrizzle generate the *single_sci.fits files images (distortion-corrected, and in the final output space), and measure shifts using them. These files are generated by the first drizzle step in MultiDrizzle, so you can turn off all subsequent steps, since we are just generating input for tweakshifts. Now, tweakshifts only works for data which are already reasonably well-registered (small rotation angles, and within 1 pixel of each other). This is generally true for data taken within the same visit, or otherwise with the same guide stars. But in combining data from different visits, and/or mosaic data where there are small overlaps between some frames (not many stars to use for registration), the misregistration can be 10-20 pixels. So in preparation for running tweakshifts, first measure (with imexam and possibly geomap) crude shifts and rotations using just a few stars, put them into a shiftfile, and apply them to generate the single_sci above.

The report Providing Updated Image Shifts to PyDrizzle (PDF file) provides a description of the shiftfile format. The following is a sample WFPC2 shiftfile -- note that the files listed are not the input GEIS c0h files, but c0h.fits files generated by MultiDrizzle. The reference image is the image arbitrarily chosen to be (0,0), and all other frames will be registered to it. By default it will be the first image in your list, but you can alter the order of your list to make another image the reference. The reference file can be a copy of the reference single_sci image, or tweakshifts will also generate a reference WCS file.

# frame: output
# reference: u2ew0205t_wcs.fits
# form: delta 
# units: pixels 

u2ew0205t_c0h.fits    0.0   0.0
u2ew0206t_c0h.fits    0.0   0.0
u2ew0207t_c0h.fits    0.0   0.0
u9ga5301m_c0h.fits  -16.0  -1.0
u9ga5302m_c0h.fits  -16.0  -1.0
After crudely removing most of the delta-shifts (by measure just a few stars positions), the new single_sci images are ready for tweakshifts, where every available star (possibly hundreds) can be used to refine the shifts. Some suggested tweakshifts parameters:
tweakshifts.input = '@list_single_i'
tweakshifts.shiftfile = ''
tweakshifts.reference = 'm82_i_21_wcs.fits'
tweakshifts.output = 'm82_i_shifts.txt'
tweakshifts.findmode = 'catalog'
tweakshifts.gencatalog = 'daofind'
tweakshifts.sextractpars = ''
tweakshifts.undistort = no
tweakshifts.computesig = no
tweakshifts.idckey = 'idctab'
tweakshifts.clean = no
tweakshifts.verbose = no
tweakshifts.catfile = ''
tweakshifts.xcol = 1
tweakshifts.ycol = 2
tweakshifts.fluxcol = 3
tweakshifts.fluxmax = INDEF
tweakshifts.fluxmin = INDEF
tweakshifts.fluxunits = 'counts'
tweakshifts.nbright = INDEF
tweakshifts.refcat = ''
tweakshifts.refxcol = 1
tweakshifts.refycol = 2
tweakshifts.rfluxcol = 3
tweakshifts.rfluxmax = INDEF
tweakshifts.rfluxmin = INDEF
tweakshifts.rfluxunits = 'cps'
tweakshifts.refnbright = INDEF
tweakshifts.minobj = 5
tweakshifts.nmatch = 30
tweakshifts.matching = 'tolerance'
tweakshifts.tolerance = 0.7
tweakshifts.fwhmpsf = 2.5
tweakshifts.sigma = 0.1
tweakshifts.datamin = INDEF
tweakshifts.datamax = INDEF
tweakshifts.threshold = 6.0
tweakshifts.nsigma = 1.0
tweakshifts.fitgeometry = 'shift'
tweakshifts.function = 'polynomial'
tweakshifts.maxiter = 5
tweakshifts.reject = 3.0
tweakshifts.crossref = ''
tweakshifts.margin = 50
tweakshifts.tapersz = 50
tweakshifts.pad = no
tweakshifts.fwhm = 7.0
tweakshifts.ellip = 0.05
tweakshifts.pa = 45.0
tweakshifts.fitbox = 7
tweakshifts.mode = 'al'

The first image in the input list above (list_single_i) becomes the reference image, and tweakshifts automatically generates the reference WCS file from it (m82_i_21_wcs.fits). You can change the natural sequence of the listed files, to make a particular frame the reference image (e.g. a central frame, rather than a corner frame).

Note that the shiftfile tweakshifts generates is really a delta-delta shiftfile, i.e. it must be summed with the original crude shiftfile to get the shifts you want to provide for the final MultiDrizzle combination.

Repeat the process above, generating new single_sci using the refined shifts, and running tweakshifts again, to verify only small residual shifts are left (less than 0.1 WFC pixel or 5 mas). Then you are ready to use your final shiftfile to combine the dataset with MultiDrizzle.

# frame: output
# reference: u2ew0205t_wcs.fits
# form: delta 
# units: pixels 

u2ew0205t_c0h.fits    0.000   0.000
u2ew0206t_c0h.fits    0.018  -0.005
u2ew0207t_c0h.fits    0.033  -0.005
u9ga5301m_c0h.fits  -16.044  -0.720
u9ga5302m_c0h.fits  -16.044  -0.720
Note: If there are not enough stars for measuring delta-shifts, the crosscor task can cross correlate other image features (e.g. nebular knots) to find shifts.