Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flats.py fails to handle lamps off flats correctly #137

Open
joshwalawender opened this issue Feb 9, 2019 · 9 comments
Open

Flats.py fails to handle lamps off flats correctly #137

joshwalawender opened this issue Feb 9, 2019 · 9 comments

Comments

@joshwalawender
Copy link
Contributor

The handle_flats method in Flats.py does not appear to handle lamps off flats correctly.

First, looking at the code, the file which contains the combined lamps off data is actually formed from the lamps on data. Line 132 reads"

IO.imcombine(flatlist, out, options, reject="minmax", nlow=1, nhigh=1)

but it should presumably be:

IO.imcombine(lampOffList, out, options, reject="minmax", nlow=1, nhigh=1)

As a result of this, the difference file between the lamps on and lamps off data is all zeros (i.e. combflat_lamps_on_2d_K.fits).

Even if this were fixed and the correct data was present in combflat_lamps_on_2d_K.fits, the make_pixel_flat method which would be called with lampsOff=True does not use that flag. It does nothing with the lamps off data.

@themiyan
Copy link

themiyan commented Apr 9, 2019

Hi @joshwalawender has there been any updates on this? We've been reducing some K band data and the combined flats comes out as 0 because of this issue.

@lucarizzi
Copy link

@themiyan would you be available to work with us on this? unfortunately, we have very little bandwidth to work on MOSFIRE pipeline right now.
The Flats.py portion of the pipeline contains this comment:
2014-01-09: MK - Functions added to subtract dome "lamps off/thermal" flats from the dome "lamps on" flats.
The functions combine both sets of flats using your current method to create a lamps on and
lamps off flat, and then subtracts those two images to remove the contribution of the dome
emission. Files renamed combflat_lamps_on* and combflat_lamps_off*. The final flat has the
same name that you output: combflat_2s_band_.fits .
To reduce the thermal flats, the flat functions have an optional keyword for the
"lampOffList" that acts as the reduction trigger. The driver file should include a call
like the example below.
Flats.handle_flats('Flat.txt', maskname, band, flatops, lampOffList='FlatThermal.txt')

Does this work?

@joshwalawender
Copy link
Contributor Author

@themiyan @lucarizzi Sorry for being slow on the response to this. When I originally logged this, I tried to work out the code path and as far as I can tell, it is not fully implemented. I don't think handling of lamps off flats was ever completed, so it would require developing the rest of that code path.

@csteidel
Copy link

csteidel commented Apr 16, 2019 via email

@lucarizzi
Copy link

The previous version of the pipeline is still here, in a repository called https://github.com/Keck-DataReductionPipelines/MosfireDRP_preWMKO so we can check.

@themiyan
Copy link

I agree with @csteidel I do recall it used to work at some point in the past. @lucarizzi I'll have a look at this.

@lucarizzi
Copy link

Is it possible that it was just a typo in Flats.py?

see commit 4669b84

I tried on a data set and it correctly calculates the on and off flats and subtracts them.

@themiyan
Copy link

yes, that seems to do the trick. Sorry i didn't get a chance to look into this.

make_pixel_flat() also seems to take the lampoff list but not do anything with it.

@lucarizzi
Copy link

I think that make_pixel_flat() uses whatever flat you save on disk. But yes I don't think that we are actually using the on minus off flat to feed make_pixel_flat.
It should be a simple fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants