One problem in NIR data reduction that may happen is the presence of OH lines after the sky subtraction. These lines introduce additional noise after the extraction that can compromise the science spectrum. I attach a file showing an example of these lines in my spectrum.
One way that I found to workaround this problem is do an addition extraction in the 2D image for the sky (in the vicinity of the signal of the science target). After that, will be two spectra: one for the target signal (including the sky noise) and another for the spectrum of the sky. In order to remove the sky contamination, I used the IRAF task SKYTWEAK (onedspec package). The result was satisfactory, but not perfect with some noise still.
If someone know a better/different way to do this subtraction please share your technique with us and lets discuss about it…
There always will be excess noise at the locations of the OH lines because there is excess sky background at those wavelengths and thus the fluctuations in the background are larger there than in between the sky lines.
The reason that there is residual OH line emission even after subtraction of two frames is because the OH line intensity is time variable – it does not remain constant through the night. However, the OH line intensities should be quite constant along the slit. Thus the residuals should be constant along the slit, and indeed they appear to be so in mmarinello’s subtracted image, apart from the random fluctuations.
The way that most people remove the residuals is simply to subtract the negative spectrum of the star from the positive spectrum; the star signals thus add while the residual OH emission lines cancel (apart from the noise). If for some reason there is a gradient in the residuals, then the technique that mmarinello describes can be applied to remove them.