Keck-DataReductionPipelines / KCWI_DRP

KCWI python DRP
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

Pixels in icube MASK extension mask whole columns #82

Closed MNBrod closed 3 years ago

MNBrod commented 3 years ago

Rather than only mask specific pixels, the pipeline masks the entire column. Looking at the MASK extension of an icube file, I find that each pixel corresponds to an entire column being masked improperly throughout each slice of the cube.

MNBrod commented 3 years ago

Update: It's not columns that are being masked, but entire slices (same visual effect, but illuminates the problem). In MakeCube.make_cube_helper, each slice of the input frame is warped with skimage.transform.warp. Near as I can tell, SciKit Image as a rule does not play nicely with NaN values, and expects you to deal with them prior to any transformations. We don't do that, and when a slice with any number of masked pixels is passed in, the entire warped output comes out as NaN, hence the masked 'columns.'

Solution is to replace the NaN values with a sensible interpolated value, find another warping method, or come up with some other clever workaround.