3.4 Calibration Steps
The CALACS pipeline consists of four individual calibration tasks: ACSCCD, ACS2D, ACSREJ, and ACSSUM. These tasks are listed in table 3.1 and diagrammed in figure 3.1. CALACS is responsible for controlling the processing rather than actually calibrating the data. The individual tasks apply the desired calibration steps to the data and create the output products, including the trailer files.
In the following four sections, we describe each CALACS task, give a detailed description of the calibrations steps performed within each task, and give a brief description of the reference files used for each step. A detailed discussion of ACS Reference Files can be found in ACS ISR 99-08, "CALACS Reference Files."
3.4.1 ACSCCD
This routine contains the initial processing tasks for all ACS CCD data. These tasks are listed in operational order in table 3.4. The bulk of this routine was based on the code for CALSTIS1. Input to ACSCCD will be an image list or single image which is either automatically called by CALACS or input directly by the user. ACSCCD processes each image in the input list one at a time, using the header keywords to determine which calibrations are performed. Upon completion of ACSCCD, the overscan regions will be trimmed from the image and an output image with the file extension `_blv_tmp.fits' is created.
Table 3.4: ACSCCD processing tasks
| doNoise |
Initialize error array |
| doDQI |
Initialize data quality array |
| doAtoD |
Perform AtoD correction (currently skipped) |
| doBlev |
Subtract bias level from overscan region |
| doBias |
Subtract bias image |
| doFlash |
Subtract post-flash image |
| Final Output |
Output overscan-trimmed or full image |
doNoise - Error Array Initialization
- Header Switch: None
- Header Keywords Updated: None
- Reference File: CCDTAB
First, the image error array must be initialized. The doNoise function examines the ERR extension of the input data to determine the state of the array. Input `_raw.fits' images delivered by Generic Conversion will contain a NULL ERR array, defined by the keywords NPIX1, NPIX2 and PIXVALUE, where PIXVALUE=0. If the ERR array has already been expanded and contains values other than zero, then this function does nothing. Otherwise, CALACS will initialize the array and doNoise will assign a simple noise model.
The noise model reads the science array and for each pixel calculates the error value
(in DN for CCD, in counts for MAMA):
Because MAMA data is not processed with ACSCCD, the doNoise function is later called as part of ACS2D.
The CCDTAB reference file, the CCD Characteristics Table, is used to initialize the ERR array by determining the bias, gain, and readnoise for each observation. The table contains one row for each amp configuration which can be used during readout. Each configuration is uniquely identified by the list of amps possible (CCDAMP), the particular chip being read out (CCDCHIP), the commanded gain (CCDGAIN), the commanded bias level (CCDBIAS), and the pixel bin size (BINAXIS). CCDTAB uses these commanded values to determine each amp's physical read-out characteristics, including readnoise (READNSE), A-to-D gain (ATODGN), and bias level (CCDOFST).
doDQI - Bad Pixel Determination
- Header Switch: DQICORR
- Header Keywords Updated: None
- Reference File: BPIXTAB, CCDTAB
The function doDQI initializes the data quality (DQ) array by combining it with a table of known bad pixels for the detector, stored in the "Bad-Pixel" reference table (BPIXTAB). The type of bad pixels which can be flagged are listed in table 3.5.
The DQ array may already have been populated with some values to flag pixels which were affected by telemetry problems or compression buffer overflow. Other DQ values will only be marked during further processing (such as cosmic-ray rejection). For CCD data, the values in the SCI extension are also checked for saturation by comparison with the value of the SATURATE column in the CCD parameters table CCDTAB.
Table 3.5: Flags for the DQ array
|
|
|
Reed-Solomon decoding error |
|
data replaced by fill value |
|
bad detector pixel or beyond aperture |
|
masked by aperture feature |
|
|
|
|
|
|
|
|
|
|
|
bad pixel in reference file |
|
|
|
|
|
|
|
cosmic ray rejected during image combination |
The doDQI function combines the DQ flags, from pre-processing, from the BPIXTAB, and from saturation tests, into a single result for the particular observation. These values are combined using a "Bitwise/Logical OR Operator" for each pixel. Thus, if a single pixel is affected by two DQ flag, those flag values will be added in the final DQ array. This array then becomes a mask of all pixels which had some problem coming into the calibrations, so that the calibration processing steps can ignore bad pixels during processing.
The BPIXTAB reference file maintains a record of the (x,y) position and DQ value for all known bad pixels in each CCD. These pixels may change as some hot pixels are annealed and others appear over time, for example. Permanently bad pixels due to chip defects may be flagged during Generic Conversion, and it is the job of the BPIXTAB to maintain the list of bad pixels applicable for a given time period.
doAtoD - A-to-D Correction
- Header Switch: ATODCORR
- Header Keywords Updated: None
- Reference File: ATODTAB
The doAtoD function converts pixel values in the raw input image from units of DN (16-bit integer) to counts (32-bit float). An analog-to-digital correction would be applied if the CCD electronic circuitry, which performs the analog-to-digital conversion, were biased toward the assignment of certain DN (data number) values. Ground test results show that this correction is not currently needed, so the ATODCORR switch will always be set to OMIT.
doBlev - Bias-level Correction
- Header Switch: BLEVCORR
- Header Keywords Updated: MEANBLEV, CRPIX[1,2], LTV[1,2]
- Reference File: OSCNTAB
The doBlev function fits the bias level from the overscan region and subtracts it from the image data. The definition of the overscan region is taken from the OSCNTAB reference file. With these regions defined, the overscan level for each row of the input image is measured and a straight line is fit as a function of image line number. The fit will then be evaluated for each row of the input image, and that value will be subtracted from each pixel of that row. If the overscan level cannot be determined, or if the overscan region is not present in the input image, a default value (CCDBIAS from the CCD parameters table) will be subtracted instead. In this case, an error message will be written to the image trailer file.
In CALSTIS, the overscan regions were removed from the image just after the bias-level subtraction, since no subsequent processing was required. CALACS, on the other hand, retains the output image in memory until the completion of all the processing steps in ACSCCD. The overscan regions will not be trimmed until the image is written to disk at the completion of ACSCCD.
The positional keywords CRPIXi and LTVi will be updated in the output to reflect the offset due to removing the overscan. In addition, the mean value of all overscan levels will be computed, and the mean will be written to the output SCI extension header as MEANBLEV.
The OSCNTAB reference file (Overscan Region Table) describes the overscan regions for each chip along with the regions to be used for determining the actual bias level of the observation. Each row corresponds to a specific configuration, given by the CCD amp and chip used. The columns TRIMX* give the number of columns to trim off the beginning and end of each line (the physical overscan region), while the TRIMY* columns give the number of rows to trim off the top and bottom of each column (the virtual overscan region). The result of trimming (TRIMX1 + TRIMX2) columns and (TRIMY1 + TRIMY2) rows from the image will result in the desired calibrated image sizes, 4096x2048 for a full WFC image and 1024x1024 for a full HRC image. The OSCNTAB columns BIASSECTA* and BIASSECTB* give the range of image columns to be used for determining the bias level in the leading and trailing regions, respectively, of the physical overscan region. The virtual overscan region is also defined in the OSCNTAB, where (VX1, VY1) indicates the beginning of the upper or lower overscan region, extending to the position (VX2, VY2).
To determine which overscan regions were actually used for determining the bias level, users are encouraged to check the OSCNTAB reference file. If desired for manual calibration, users may modify the bias section and virtual overscan region definitions in the reference table, but the TRIMX*, TRIMY* columns must not be changed.
doBias - Bias Image Subtraction
- Header Switch: BIASCORR
- Header Keywords Updated: None
- Reference File: BIASFILE
Subtraction of the bias image is performed prior to cosmic-ray rejection using the function doBias. The appropriate reference image, BIASFILE, is selected using the DETECTOR, CCDAMP, and CCDGAIN keywords. The dimensions of the science image are also used to distinguish observations which use the entire chip from sub-array images. Because the bias image has already been scaled by the gain and had the overscan values subtracted, the bias image will have a mean pixel value which is less than one.
Due to the way the bias reference image is created, part of the dark subtraction is also included in this step. Dark counts accumulate for an additional time beyond the exposure time, primarily the time required to read out the detector, and this portion of the dark current is subtracted along with the bias. This is described further in the section on Dark Image Subtraction.
The BIASFILE has the same dimensions as a full-size science image complete with overscan regions, 1062x1044 for HRC and 4144x2068 for WFC. Only after the completion of ACSCCD are the images trimmed to 1024x1024 (HRC) and 4096x2048 (WFC). CALACS assumes that CCD data will not be read-out in binned mode, so any image which does not have the same size as the full-sized image is assumed to be a sub-array. For sub-array images, CALACS will extract the appropriate region from the reference file and apply it to the sub-array input image.
Recent studies indicate, however, that sub-array bias images are measurably different than full-chip bias images and that the proper bias cannot be simply extracted from the full frame in the same way as can be done for the flatfields. The ACS group is currently investigating the best way to solve this discrepancy.
doFlash - Post-Flash Subtraction
- Header Switch: FLSHCORR
- Header Keywords Updated: MEANFLSH, FLASHDUR, FLASHSTA
- Reference File: FLSHFILE
ACS has a post-flash capability to provide the means of mitigating the effects of Charge Transfer Efficiency degradation. The proposer controls whether to use this capability via the FLASHEXP optional parameter in the Phase II proposal.
The function doFlash will subtract the Post-Flash reference file, FLSHFILE, from the science image. This file has the same dimensions as a full-size science image complete with overscan regions, 1062x1044 for HRC and 4144x2068 for WFC. The appropriate FLSHFILE is selected using the following keywords from the image header: DETECTOR, CCDAMP, CCDGAIN, FLASHCUR and SHUTRPOS.
First, the success of the Post-Flash exposure is verified by checking the keyword FLASHSTA. If any problems were encountered, a comment will be added to the history comments in the SCI extension header. The FLSHFILE is then normalized to one second for the appropriate post-flash current level (LOW, MED, HIGH), given by the FLASHCUR keyword. The FLSHFILE is then multiplied by the flash duration in seconds (FLASHDUR) and is subtracted from the science image. Finally, the mean value of the scaled Post-Flash image is written to the output SCI extension header as the keyword MEANFLSH.
Final Output
Upon completion of ACSCCD, the overscan regions will be trimmed from the image when it is written out, but only if BLEVCORR is performed successfully. Otherwise, the full image array will be written out.
3.4.2 ACS2D
Every observation, whether taken with the MAMA or CCD detectors, will eventually be processed by ACS2D. The ACS2D primary functions are listed in table 3.6 and include dark current subtraction, flatfielding, and photometric keyword calculations. ACS2D contains the same data quality and error array initialization functions used in ACSCCD, but ACS2D will check to ensure that the array initialization is not performed twice on CCD data. Calibration switches in the image header control the performance of the remaining calibration functions, with MAMA-specific functions being initiated only when the relevant calibration switches are set.
Table 3.6: The functions performed in ACS2D (in operational order)
| doNoise |
Apply a simple noise model, if not done in ACSCCD |
| doDQI |
Initialize data quality array, if not done in ACSCCD |
| doNonLin |
Correct and flag non-linear data (MAMA only) |
| doDark |
Subtract dark image |
| doFlat |
Combine and divide flatfield images |
| doShad |
Perform CCD shutter shading correction (currently skipped) |
| doPhot |
Compute photometric keyword values for header |
| doStat |
Compute image statistics |
doNoise - Error Array Initialization
- Header Switch: None
- Header Keywords Updated: None
- Reference File: None
ACS2D will first check that the image error array has not been expanded, indicating that no previous processing has been performed. In this case, the value of all pixels in the ERR array will have a value of zero. ACS2D will then perform the same initialization as described in "doNoise - Error Array Initialization" for ACSCCD. If, however, the input image has already been processed, no changes to the ERR array will be made.
doDQI - Bad Pixel Determination
- Header Switch: DQICORR
- Header Keywords Updated: None
- Reference File: BPIXTAB
If the DQICORR header keyword switch is set to COMPLETE (e.g. CCD data), this step will be skipped. Otherwise, the same initialization will be performed as described in "doDQI - Bad Pixel Determination" for ACSCCD.
doNonLin - Linearity Correction for MAMA Data
- Header Switch: LFLGCORR, GLINCORR
- Header Keywords Updated: GLOBLIM
- Reference File: MLINTAB
This routine is capable of flagging global and local nonlinearity in ACS MAMA observations, where the term global refers to the entire ACS detector and local refers to an individual detector pixel. The MAMA Linearity Table, MLINTAB, provides the basic parameters for determining linearity. The global limit (GLOBAL_LIMIT) column from this table refers to the total count rate at which the data are affected by greater than 10% non-linearity across the detector.
CALACS will attempt to correct for non-linearity up to the global limit using the non-linearity time constant in the column TAU. The global linearity correction is computed for every pixel below the global linearity limit specified by iteratively solving the equation
to get the true count rate N.
The LOCAL_LIMIT can actually be much higher than the global limit and is difficult to correct using a simple algorithm. Each pixel found to exceed this limit will simply be marked as non-linear in the DQ file. This DQ flag will be extended by a fixed radius from the original pixel, given in the EXPAND column and currently set to 2 pixels.
If the LFLGCORR switch is set to PERFORM, ACS2D will flag excessive global and local nonlinearity in the DQ array. If GLINCORR is set to PERFORM, it will correct excessive global nonlinearity, if it is not too large, in the SCI array. If the global linearity limit is exceeded, the keyword GLOBLIM in the SCI extension header will be set to "EXCEEDED". Otherwise, the it will have the value "NOT-EXCEEDED".
doDark - Dark Image Subtraction
- Header Switch: DARKCORR
- Header Keywords Updated: MEANDARK
- Reference File: DARKFILE
This task is responsible for subtracting the dark image from the input image. For CCD data, the dark image is multiplied by the exposure time and then divided by the gain before subtracting. (MAMA data do not require this gain correction.) The dark reference file, DARKFILE, is read in line-by-line and subtracted from the input image in memory. The mean dark value is then computed from the scaled dark image and used to update the MEANDARK keyword in the SCI image header. The dark reference file will be updated frequently (~once per week) and will allow the tracking of hot pixels over time.
The "dark time" is simply the exposure time; it does NOT include the idle time since the last flushing of the chip or the readout time. Any dark accumulation during readout time or pre-flash idle will be included automatically into the BIASFILE.
The reference file for dark subtraction, DARKFILE, is selected based on the values of the keywords DETECTOR, CCDAMP, and CCDGAIN in the image header. The dark correction is applied after the overscan regions are trimmed from the input science image. As for the BIASFILE, CALACS assumes that the images have not been binned, so any input image smaller than the full detector size will be interpreted as a sub-array image.
Sub-array science images will use the same reference file as a full-sized image. CALACS simply extracts the appropriate region from the reference file and applies it to the sub-array input image.
doFlat - Flatfield image(s) Correction
- Header Switch: FLATCORR
- Header Keywords Updated: None
- Reference File: PFLTFILE, LFLTFILE, DFLTFILE
The doFlat routine divides the overscan-trimmed science image by the combined flatfield image, which is created using up to three flatfield reference files: the pixel-to-pixel file (PFLTFILE), the low-order flat (LFLTFILE), and the delta flat (DFLTFILE).
The PFLTFILE is a pixel-to-pixel flatfield correction file containing the small scale flatfield variations. Unlike the other flatfields, the PFLTFILE will always be used in the calibration pipeline. The LFLTFILE is a low-order flat which will correct for any large-scale flatfield variations across each detector. This file is stored as a binned image which is expanded when being applied by CALACS. Finally, the DFLTFILE is a delta-flat containing any needed changes to the small-scale PFLTFILE.
If the LFLTFILE and DFLTFILE are not specified in the SCI header, only the PFLTFILE will be used for the flatfield correction. If all three reference files are specified, they will be read in line-by-line and multiplied together to form a complete flatfield correction image. It is still unclear if the DFLTFILE or LFLTFILE will be used for ACS data, but CALACS provides the mechanism for applying these flats should they be needed.
All flatfield reference images will be chosen based on the detector, amp, and filters used for the observation. Any sub-array science image will use the same reference file as a full-size image. CALACS will extract the appropriate region from the reference file and apply it to the sub-array input image.
When performing the flatfield correction, CALACS divides the flatfield reference image by the CCD gain. This is equivalent to multiplying the data by the gain, and therefore the calibrated data will be in units of electrons.
doShad - Shutter Shading File Correction
- Header Switch: SHADCORR
- Header Keywords Updated: None
- Reference File: SHADFILE
The SHADCORR calibration switch is currently set to OMIT, but could be used in future versions of CALACS. (For more information, refer to the report "WFC and HRC Shutter Shading and Accuracy" on the ACS Science and Engineering Team website.
The doShad routine applies the shutter shading correction image (SHADFILE) to the science data if SHADCORR is set to PERFORM. The input image is corrected for the differential exposure time across the detector caused by the shutter opening. This correction only has a significant effect on images with short exposure times (less than 10 seconds).
Pixels are corrected based on the exposure time using the relation:
.
The SHADFILE is selected using the DETECTOR keyword in the input science image. At present, this reference file is an overscanned-trimmed image, binned by a factor of 8 for each dimension, resulting in a 128x128 HRC and a 256x512 WFC SHADFILE.
The shutter shading correction can either be applied during ACS2D processing for single or REPEAT-OBS exposures or during cosmic-ray rejection in ACSREJ for CRSPLIT exposures.
doPhot - Photometry Keyword Calculation
- Header Switch: PHOTCORR
- Header Keywords Updated: PHOTMODE, OBSMODE, PHOTFLAM, PHOTZPT, PHOTPLAM, PHOTBW
- Reference Files: GRAPHTAB, COMPTAB
Before photometry can be performed on ACS observations, a transformation from counts to absolute flux units must be performed. CALACS follows the WFPC2 methodology for calculating the photometry keywords in the calibration pipeline. The calibration reference files, GRAPHTAB and COMPTAB, point to the SYNPHOT tables containing the latest ACS component tables. These tables contain the throughput as a function of wavelength for the various ACS detector and filter combinations. This reliance on SYNPHOT allows the ACS team to maintain the latest throughput files in SYNPHOT to keep CALACS up to date. For further discussion of SYNPHOT, refer to chapter 3 of the HST Introduction.
First, the keywords PHOTMODE and OBSMODE are built to reflect the configuration of the instrument during the exposure. CALACS then uses the OBSMODE string with SYNPHOT to compute the total throughput array for the observation, based on the aperture and filter throughputs, and the photometry keywords: the inverse sensitivity in units of erg cm-2 A-1 electron-1 (PHOTFLAM), the Space Telescope magnitude zero point (PHOTZPT), the bandpass pivot wavelength (PHOTPLAM), and the bandpass RMS width (PHOTBW). Users who wish to convert calibrated images (which are in units of electrons) to flux units may simply divide the image by the exposure time and then multiply by the PHOTFLAM keyword.
doStat - Image Statistics Determination
- Header Switch: STATFLAG
- Header Keywords Updated: NGOODPIX, GOODMIN, GOODMAX, GOODMEAN)
- Reference File: None
This routine computes the minimum, mean, and maximum for science data values which are flagged as "good" in the data quality array. These quantities are updated in the science image header. These statistics are also computed for the image error array.
3.4.3 ACSREJ
- Header Switch: CRCORR
- Header Keywords Updated: TEXPTIME, SKYSUM, EXPEND, REJ_RATE, EXPTIME, NCOMBINE, ROOTNAME
- Header Keywords added as `HISTORY' Comments: INITGUES, SKYSUB, CRSIGMAS, MEANEXP, CRRADIUS, CRTHRESH, SCALENSE, CRMASK, NEXTEND
- Reference File: CRREJTAB
ACSREJ, the cosmic-ray rejection task in CALACS, combines CR-SPLIT exposures into a single image, first detecting and then replacing flagged pixels. The task uses the same statistical detection algorithm developed for STIS data (OCRREJ) and WFPC2 data (CRREJ), providing a well-tested and robust procedure.
First, ACSREJ will remove the sky background from each input image, computed using the mode of each image. Sky subtraction is performed before any statistical checks are made for cosmic rays. Next, ACSREJ constructs an initial comparison image from each input exposure. This comparison image can either be a median- or minimum-value sky-subtracted image constructed from all the input images and represents the `first guess' of a cosmic-ray free image. The comparison image serves as the basis for determining the statistical deviation of each pixel from the input image.
A detection threshold is then calculated for each pixel based on the comparison image. This threshold is equal to a constant times sigma squared, given in the equation below:
where:
-
is the sigma value used as the detection limit,
- noise is the readnoise in DN squared and gain is the e-/DN of the amp used to read the pixel,
- scale is the scale factor for the noise model (default=0),
-
is the exposure time for the input image, and
- value is the pixel value from the median or minimum combined comparison image.
The actual detection criteria for a cosmic-ray is determined as:
where:
- pixn is the pixel value from input image n,
- skyn is the sky background of image n, and
- median is the median or minimum pixel value from the comparison image.
If
, the pixel is flagged as a cosmic-ray in the input image's DQ array and is ignored when images are summed together. Surrounding pixels within some expansion radius are marked as `SPILL' pixels and are given more stringent detection thresholds.
When all input images have been processed, every pixel in the summed output array is scaled to the total exposure time (the same for all pixels). This is done by normalizing the pixel by the factor:
where:
-
is the exposure time for image n,
-
is the shading correction for the pixel (x, y),
-
is the mask value for the n'th image at pixel (x, y),
- T is the total exposure time (regardless of whether all input images were used for that particular pixel).
In short, the cosmic ray rejection task sums all accepted pixel values, computes the true exposure time for that pixel, and scales the sum to correspond to the total exposure time. The final scaled, cleaned pixel is written to the comparison image to be used for the next iteration. This process is then repeated with increasingly stringent detection thresholds.
Cosmic-ray Rejection Table
ACSREJ uses the Cosmic-ray Rejection Parameter Table (CRREJTAB) to determine the number of iterations for cosmic-ray rejection, the sigma levels to use for each iteration, and the spill radius to use during detection. This allows the rejection process to be tuned to each detector, with suitable defaults being applied during pipeline processing. Observers may fine-tune the cosmic-ray rejection parameters when manually reprocessing data with ACSREJ by editing the CRREJTAB.
The CRREJTAB reference file contains the basic parameters necessary for performing cosmic-ray rejection. The column names and default values for the CRREJTAB are given in table 3.7. The appropriate row is selected based on the chip being processed (CCDCHIP), the number of images into which the exposure was split (CR-SPLIT), and the exposure time of each CR-SPLIT image (MEANEXP). The sky fitting algorithm is controlled by the parameter SKYSUB which can have values of `mode' or `none'. The `first guess' CR-combined image is then created using the median or minimum value of the input exposures, as specified by column INITGUES.
Cosmic-ray detection requires the specification of a threshold above which a pixel value is considered a cosmic-ray. This threshold was defined above as
and uses the sigma rejection thresholds
. These sigmas correspond to the column CRSIGMAS in the CRREJTAB reference file. SCALENSE is a multiplicative term (in percent) for the noise model and is given as scale in the threshold equation. This term can be useful when the pointing of the telescope has changed by a small fraction of a pixel between images. Under such circumstances, the undersampling of the image by the CCD will cause stars to be rejected as cosmic rays if a scale noise is not included. The default value for SCALENSE is zero.
Pixels within given radius, CRRADIUS, of a cosmic-ray will also be treated as cosmic-rays. A more stringent rejection threshold, CRTHRESH, can be used for detecting pixels adjacent to a cosmic-ray. As for CRSIGMAS, CRTHRESH is also given as a sigma value. If CRTHRESH is exceeded, pixels within a defined radius of the cosmic ray will also be flagged. All pixels determined to be affected by a cosmic-ray will have their DQ values set to 8192, as described in table 3.5.
Table 3.7: Columns in Cosmic-Ray Rejection Parameters Table
| Column Name |
Default Value |
Contents |
| CRSPLIT |
|
Number of exposures into which observation was split |
| CCDCHIP |
|
Chip to which this conversion applies |
| MEANEXP |
|
Average exposure time (sec) for each image |
| SCALENSE |
0.0 |
Multiplicative term (in percent) for the noise model |
| INITGUES |
minimum |
Method for computing initial-guess image (minimum, median) |
| SKYSUB |
mode |
Sky fitting algorithm (mode, none) |
| CRSIGMAS |
6, 5, 4 |
Rejection thresholds (sigma) |
| CRRADIUS |
1.0 |
Radius (in pixels) for propagating cosmic ray |
| CRTHRESH |
1.0 |
Propagation factor |
| CRMASK |
yes |
Flag CR-rejected pixels in input files? |
3.4.4 ACSSUM
- Header Switch: RPTCORR
- Header Keywords Updated: NEXTEND, NCOMBINE, EXPTIME, EXPEND, ROOTNAME
- Reference File: None
ACSSUM simply sums a list of images one line at a time and updates several keywords to reflect this operation. The task uses the association file to define the input, making it easy to use as both a pipeline and a stand-alone task in STSDAS.
The function SumGrps loops over similar extensions (chips) of each input image when combining files. The first image in the input list will be read into memory, and only enough memory for 1 line of data will be allocated for use by the remainder of the input images. The function then loops over each line in the input image and adds it to the output image in memory.
The calibration switch RPTCORR is set to COMPLETE upon successful completion of the summation. In addition, the keywords NCOMBINE, EXPTIME, and EXPEND are adjusted to reflect the total of all the summed images. With these keywords updated, the summed output image is then written out.