Keck-DataReductionPipelines / MosfireDRP

http://keck-datareductionpipelines.github.io/MosfireDRP
10 stars 13 forks source link

Wavelength.fit_lambda fails to propagate dispersion solution along slit #123

Open hebeling opened 6 years ago

hebeling commented 6 years ago

After an uneventful and apparently successful initial fit of the dispersion solution (no problem with any slit), wavelength.fit_lambda appears to be the culprit for a clearly false dispersion solution for the final (bottom) slit of this mask:

image

This happens for both H and Y-band data of this mask.

Luca tells me this is a known problem... and that there is a solution. Can you help?

Mahalo,

Harald

joshwalawender commented 6 years ago

Hi Harald,

As @lucarizzi says this is a known problem. The wavelength fitting software in the DRP currently does not do a 2D solution the way one might want.

I have a partial fix slated for the next release which helps some slits, but unfortunately it does not fix the problem 100% of the time. If you would like to try that code, install your DRP from the dev branch

Let us know if that helps.

hebeling commented 6 years ago

Hi Josh,

I tried to process the same data with the version from the dev branch, but unfortunately the results are unchanged. What else can I try?

Just to help me understand the nature of the problem (and possibly avoid it in the future): is the length of the slit likely to be the cause of the DRP failure? If so, I could insert dummy objects at either end of my mask in future MOSFIRE runs, in order to shorten the slits of the last real target at top and bottom.

Mahalo,

Harald

joshwalawender commented 6 years ago

@hebeling Sorry, it looks like I gave you a bad link, my attempt at a fix has not been incorporated in to that branch yet. Download the DRP from my fork and try again.

Here's what the DRP does for the wavelength fit (in broad strokes):

The key code is in the Wavelength.py file. I believe the problem occurs when that polynomial fit gets caught up in spurious or misidentified values for the arc lines.

In my update, I've tried to constrain the actions of the DRP by limiting the offset between adjacent lines and filtering the input to the chebyshev fit to remove spurious values. That often helps, but sometimes does not yield a perfect straight arc line in the rectified arc spectrum.

hebeling commented 6 years ago

@joshwalawender Thanks, Josh, your tweak certainly helped. It did not quite fix the problem though:

screen shot 2018-06-25 at 4 36 58 pm

So, whatever secret sauce you added, perhaps adding another spoonful will do it?

Mahalo!

Harald

joshwalawender commented 6 years ago

@hebeling Glad you were able to try the updated version. Unfortunately, that result is about what I expected. I don't know if there's a lot more we can do short of a major refactoring of the code (which is actually something we're discussing, but won't be happening anytime soon). I'm heading out on travel starting Thursday, so likely nothing will happen for a few weeks while I'm gone. I can check one other avenue when I return, but you might want to look in to alternative DRP solutions if that is a critical slit for your science.