Energy scale correction: ** bin 20 adu and 30-40 adu images from input event file ** determine chip mask area on which to perform offset correction o remove offset columns (read from offset extension) from mask o remove 10 sigma excesses (3x3 pixel sliding box) in 30-40 adu image due to soft sources or optical loading from mask ** inside mask area, if offset map is available and -withoffsetmask=true o create residual offset map by subtracting median from each column and row else o subtract 20 adu calibration reference image from 20 adu image o if statistically significant excesses are found on 4x1 pixel grid look up offset correction value corresponding to the observed excess in each pixel end if ** loop over input event file and o apply offset correction value to PHA value of each event o copy correction value into newly created OFF\_COR column Suppression of detector noise: ** create averaged low energy spectra for each chip row ** determine median spectrum for each +/- 10 rows range ** for each row and each spectral bin determine the ratio of the calibration noise spectra divided by the accumulated median spectra ** apply cutoff value and chip specific correction factors to noise ratios ** loop over the event file and randomly flag the events according to the noise ratio of the corresponding chip row and energy channel