Space Telescope Science Institute
Table of Contents Previous Next Index Print

NICMOS Data Handbook > Chapter 3: Calibration > 3.4 Mosaicing/Drizzling

3.4 Mosaicing/Drizzling
Calnicb was NICMOS’s initial standard method of combining exposures to create mosaiced images. During this period calnicb was incorporated into the OPUS pipeline and recommended to users for use on their local machines. However, calnicb does not correct for the geometric distortion present in NICMOS images, which is small but can be important for some applications (see Section 5.3 for a discussion). Due to this shortcoming calnicb is no longer the recommended software for creating NICMOS mosaic images. We now recommend the MultiDrizzle software package which can be run in PyRAF and includes a geometric distortion correction.
In the following subsections we provide an overview of the MultiDrizzle task and calnicb. Even though we no longer recommend the use of calnicb by users on their local machines the software is still present in the OPUS pipeline and so the user may still come across calnicb outputs while working with NICMOS data. For this and historical reasons we include a brief overview of the calnicb algorithm but still recommend MultiDrizzle for all NICMOS mosaicing applications.
At the time of writing of this handbook, the preferred method to combine and mosaic NICMOS observation is to use the MultiDrizzle routine in the stsdas.analysis.dither package. The latest version of this routine now fully support NICMOS data and allows for users to optimally mosaic their data using the drizzle algorithm. MultiDrizzle can be used to both create a combined mosaic of the available data, further refine the rejection of cosmic rays, and produce images with optimally resampled pixel size to make full use of all the information contained in original dithered data. A full description of how to run MultiDrizzle with NICMOS data is available in the NICMOS section (Section 6.3) of the MultiDrizzle Handbook at:
The calnicb task produces the combined, or mosaiced, image from the multiple images contained in a NICMOS association. The task also performs background subtraction and source identification on the images in the association. It was designed to implement the potentially complex task of image mosaicing in a pipeline fashion, but sometimes a more careful, manual treatment can be worthwhile. As mentioned earlier calnicb does not include any correction for geometric distortion in NICMOS images, nor does it allow pixel subsampling which may be useful in order to improve image resolution for undersampled images (especially with NIC3). Also, some NICMOS users dithered their observations “manually” using POS-TARG offsets rather than the canned patterns available in Phase II; such data sets will not be linked as associations in the HST archive. Finally, you may wish to have more interactive control over the various stages of the background subtraction, registration, and coaddition process than calnicb offers. For all these reasons we recommend that the user employ the MultiDrizzle task.
Input Files
Three pieces of input data are needed by calnicb:
The association table (assoc_id_asn.fits): this is a table containing the list of members in the association and relevant information on the association type, as given in Table 3.1
Table 3.1: Columns of the Association Table (input to calnicb)
Rootname (IPPPSSOOT) of each image in the association.
EXP-BCKn = input exposure of n’th background (for chop patterns)
PROD-BCKn = output product containing n’th background (for chop patterns)
The table extension header of the assoc_id_asn.fits file also contains the keywords which control the background illumination pattern correction (illmcorr). The keywords used are: illmcorr (whether or not the correction is to be performed) and illmfile (reference file name for the illumination correction). These are further discussed later in this Section.
The input calibrated images (ippssoot_cal.fits): the science data images which are part of the association, as listed in the first column of the association table. The images are usually the calibrated outputs of calnica.
The support files (ipppssoot_spt.fits), containing engineering information, so that calnicb can transfer this information to the output support files.
Output Files
Calnicb produces three types of output:
An updated copy of the association table (assoc_id_asc.fits): this copy of the assoc_id_asn.fits file contains additional information about the processing that took place. The assoc_id_asc.fits file contains four additional columns, listed in Table 3.2
Table 3.2: Additional Columns of the Output Association Table
X-offset (in pixels) of the image from the reference frame; a positive value means a positive offset of the image (not of the sources) relative to the reference.
Y-offset (in pixels) of the image from the reference frame; a positive value means a positive offset of the image (not of the sources) relative to the reference.
Additional information contained in the header of the assoc_id_asc.fits table is the mean_bkg keyword, which gives the constant background signal level subtracted from all images in the association.
One or more output mosaic images (assoc_idn_mos.fits): the number of output mosaic images depends on the pattern. The target field is always contained in the assoc_id0_mos.fits file. Patterns which involve chopping onto the sky to produce background reference images result in multiple assoc_idn_mos.fits files after processing through calnicb, with the background positions identified by n=1 to 8.
One assoc_idn_spt.fits support file for each assoc_idn_mos.fits file created.
The basic philosophy of the calnicb algorithm is to remove the background from each image after source identification, to align the images by calculating offsets, and to produce the final mosaic. The processing steps of calnicb can be summarized as follows:
Read the input asn table and input images.
The sections below discuss steps 2 through 6 in greater detail.
Processing Parameters
Header keywords from the input *_cal.fits images are read and evaluated in order to guide the calnicb processing. One set of keywords (Table 3.3) pertains to the association as a whole and therefore are read only once from the first input member image:
Table 3.3: Keywords Common to all Datasets in an Association
A second set of header keywords (Table 3.4) are specific to each member of the association, and must be read from each input image.
Table 3.4: Dataset-specific Keywords
Based on this information, an inventory is taken of which input images exist, where they belong in the pattern, how many images there are at each pattern position, which images belong to the target field, which ones are from background fields, and to which output mosaic image each input image will contribute. As part of the input process, the appropriate ILLMFILE reference file is loaded. Note, however, that the ILLMFILEs used in this step are dummies, and have no effect on the data. In fact, the ILLMFILEs provided by STScI have their PEDIGREE set to DUMMY, thus forcing the stage to be skipped. The ILLMFILEs were introduced to remove a two-dimensional residual background that may exist due to spatial variations in the thermal emission of the telescope and instrument. However, in practice, it does not appear that there are strong spatial illumination variations requiring such corrections, and therefore the ILLMFILEs used in the processing pipeline are dummies. These files must be present, however, in order for calnicb processing to proceed. The step may also be turned off entirely by setting illmcorr to omit in the association table (by default, it is set to perform, even though dummy files are used). In order to disable illmcorr, the keyword must be changed in the association table header itself, not in the primary image header of the association table FITS file. This must be done with the tables.parkey task, not with hedit. See the highlighted note at the end of Section 3.5.2 for how to do this. Ordinarily, it is simplest to just leave illmcorr=perform and use the dummy reference files.
Combination of Multiple Exposures
If there is more than one image at any pattern position (NUMITER > 1), the multiple images at each position are first registered and then combined into a single image. The coordinates (as determined by the WCS keywords) of the first image at a given pattern position are used as a reference for the registration. The offsets to all other images at that pattern position are first computed by comparing their WCS data, and then refined using a cross-correlation technique, down to a level of 0.15 pixels. The cross-correlation technique employes an algorithm which minimizes the differences between fluxes in the images. The computed offsets, in units of pixels, are recorded in the output association table. After determining the relative offsets, the images are aligned using bilinear interpolation and are then combined on a pixel-by-pixel basis. The combined pixel values are computed as a weighted mean of all unflagged (i.e., DQ = 0) samples, using the input image ERR values as weights. If three or more samples are present, iterative σ-clipping is performed to reject outliers. The number of samples used at each pixel and the total integration time are retained.
Source Identification
The source identification step is used for excluding sources when the background in the images at each pattern position is estimated. The images at each pattern position are searched for pixels suspected to contain signal from a source. The median signal level in the image is computed and pixels that are more than 4.5σ above the median are considered as candidates. Spurious results, such as pixels containing cosmic-ray hits, are filtered out by searching neighboring pixels and only retaining those candidates that have two or more neighbors that are also above the threshold. The DQ flag of the source-affected pixels is then set to 1024.
Background Estimation and Removal
A constant background signal level, which is estimated from the images themselves is removed from the images at each pattern position as follows.
With chop patterns, the median and average deviation of the signal in the image at each chop position is computed. In addition to excluding bad and source-flagged pixels, the calculation of the median also uses iterative sigma-clipping to reject outliers.
With dither-only patterns, or with multiple-exposure single pointings, the median and average deviation of each target image is computed. The result for each image is compared to the background estimate provided by calnica, which is (in principle) stored in the backest1 header keyword of each image. The value computed by calnicb is accepted if it is less than 5σ deviant from that of calnica, otherwise the calnicb value is assumed to be biased by the presence of sources and the calnica value is substituted for it. Note, however, that normally the value of backest1 would be populated by the BACKCALC step of calnica, which has not been implemented (see Section 3.3.2). Therefore ordinarily backest1 has value 0.0, and in this case the background value computed by calnicb is always used, unless the user has manually set backest1 to some non-zero value.
The global constant background signal is computed by taking the mean of the background values for each image, again, using iterative sigma-clipping to reject outliers.
With dither-only patterns, the user has the option of subtracting the individual background values computed for each image from themselves rather than computing and subtracting a global mean background value. This option is controlled by the meanbkg task parameter for calnicb. The default value, “yes”, indicates that the global mean is to be used.
Mosaic Construction
Mosaic (MOS) images are created for each independent pointing within the pattern. For example, a combination DITHER-CHOP pattern will produce one mosaic image out of the dithered pattern at each CHOP location on the sky. Each mosaic image is created as follows:
The relative offsets between images within the mosaic are computed from their WCS information and refined using cross-correlation (as in the case of multiple exposures at each pattern position; see “Combination of Multiple Exposures”). The first image in the list for each mosaic is used as a reference image.
An empty mosaic image is created with x and y dimensions large enough to encompass the maximum offsets in each direction.
Pixel values in the mosaic image are populated by combining samples from overlapping images. The individual images are aligned using bilinear interpolation and the value at a given mosaic pixel location is computed from the error-weighted mean of the samples at that location. Samples flagged as bad are excluded and, if three or more samples are present, iterative sigma-clipping is used to reject remaining outliers. The number of samples retained for a given pixel and their total integration time is recorded in the SAMP and TIME images, respectively. If all samples are rejected for a pixel, the mosaic image SCI, ERR, SAMP, and TIME values are set to zero and a combination of all DQ flags is retained.

Table of Contents Previous Next Index Print