The erros for the optimally extracted spectra seems to be underestimated compared to the 'real' expectation. i.e. from the ETC or looking ash the error values from single exposures from the pipeline. The extract_spectrum function seems to be where the real science happens here.
We did a few experiments with some of 2565 data to see what was going on.
Removing any background subtraction we get 3 spectra with good continuum.
The flux levels are not similar between the 3 dithers due to object entering issues, so we've fit a polynomial to 2 of the dithers to normalise the flux and errors to the first dither position. The same correction is also applied to the error spectrum.
Once this normalisation is applied, the flux variation between the individual pixels can be thought to be driven by the noise value. So the RMS of the flux values in the 3 dithers (show in solid black below) can be compared with the normalised errors of the 3 dither positions. They agree well (some sigma clipping applied to remove CR noise etc)
Now the figure below shows the S/N for the 3 discussed above + also with background subtraction as handled by msaexp. It is a bit busy, but basically the 3 dither positions with no background subtraction are in the solid rgb colours. The 6 A-B iterations are shown by dashed colours. The black dashed in S/N = 30 to guide the eye.
The solid black is the optimally extracted spectrum produced by the extract_spectrum function.
The S/N is ~ sqrt(6) higher compared to the individual error levels. However, since the background errors in A-B and A-C are correlated, it should be only sqrt(3) higher.
The erros for the optimally extracted spectra seems to be underestimated compared to the 'real' expectation. i.e. from the ETC or looking ash the error values from single exposures from the pipeline. The
extract_spectrum
function seems to be where the real science happens here.We did a few experiments with some of 2565 data to see what was going on.
Removing any background subtraction we get 3 spectra with good continuum.
The flux levels are not similar between the 3 dithers due to object entering issues, so we've fit a polynomial to 2 of the dithers to normalise the flux and errors to the first dither position. The same correction is also applied to the error spectrum.
Once this normalisation is applied, the flux variation between the individual pixels can be thought to be driven by the noise value. So the RMS of the flux values in the 3 dithers (show in solid black below) can be compared with the normalised errors of the 3 dither positions. They agree well (some sigma clipping applied to remove CR noise etc)
Now the figure below shows the S/N for the 3 discussed above + also with background subtraction as handled by msaexp. It is a bit busy, but basically the 3 dither positions with no background subtraction are in the solid rgb colours. The 6 A-B iterations are shown by dashed colours. The black dashed in S/N = 30 to guide the eye.
The solid black is the optimally extracted spectrum produced by the
extract_spectrum
function.The S/N is ~ sqrt(6) higher compared to the individual error levels. However, since the background errors in A-B and A-C are correlated, it should be only sqrt(3) higher.
The
extract_spectrum
function stacks all 6 iterations together and takes the sum with optimal ivar scaling. So basically the 6 background subtractions are considered to be independent. Like https://github.com/gbrammer/msaexp/blob/d7368560cf465a0828e942454cfcc0bbe6870278/msaexp/pipeline.py#L1605Is our understanding here correct?