Here are some details about cs8.

This step is performed if the header switch RPTCORR is set to "PERFORM".
The number of groups to be added together is obtained by dividing the
value of NEXTEND by three.  This is expected to be equal to NRPTEXP;
if not, a warning message is printed.

The first group is read into memory from the input file, then each
subsequent group is read and added to the first.  If the data have been
converted from counts to absolute flux (by cs7), then the data should be
weighted by the exposure time when adding.  This is indicated by keyword
FLUXCORR = "COMPLETE".  As each group is read into memory, if FLUXCORR
has been done for the input file the SCI and ERR extension data are
multiplied by the exposure time EXPTIME.  The ERR extension values are
squared to give variance.  The data are then combined pixel by pixel with
the first group; the SCI data are added, the variance values in the ERR
array are added, and the DQ values are bitwise ORed.  After all groups
have been added together, the square root of the ERR values is then taken
to convert back from variance to standard deviation.  If FLUXCORR has
been done, the SCI and ERR array values are divided by the sum of the
exposure times.

Statistics are computed on the summed data if STATFLAG = T, and results
are written to the SCI and ERR extension headers, as in other calstis
modules (e.g. cs1, cs7).

Header keywords are updated after summing the groups.  In the primary
header of the output file, keyword RPTCORR is set to "COMPLETE", NEXTEND
is set to three (one group), and history records are written.  NRPTEXP
retains its original value, in order to correspond to the proposal
instructions.  In the SCI extension header, EXPTIME is set to the sum of
the EXPTIME values of all the input groups.  and EXPEND is set to the
EXPEND of the last input group.  Finally, the three arrays and headers
in memory are written to the output file.
