FOR EACH pair of spectrum and response: FOR EACH spectrum channel: IF ( acceptable QUALITY ) time = EXPOSURE * AREASCAL rate = COUNTS / time err2 = (HDUCLAS2 == NET) ? (STAT_ERR/time)^2 : rate/time Rebin: map spectrum channel boundaries onto the fluxed channel grid accumulate rate and err2 according to fluxed channel overlap degrade QUALITY in ranked order on all overlapping fluxed channels ELSE mark spectrum channel as discarded FOR EACH response bin (rows): FOR EACH response channel (columns): IF ( corresponding spectrum channel not discarded ) area = MATRIX * (ENERG_HI - ENERG_LO) Rebin: map response channel boundaries onto the fluxed channel grid accumulate area according to fluxed channel overlap FOR EACH fluxed channel: IF ( area != 0 ) FLUX = rate / area ERROR = sqrt(err2) / area ELSE FLUX = ERROR = NaN