desihub / desispec

DESI spectral pipeline
BSD 3-Clause "New" or "Revised" License
36 stars 24 forks source link

Pixmasks #2229

Closed Waelthus closed 5 months ago

Waelthus commented 5 months ago

This adds a new script to compute pixmasks based on a range of morning dark exposures. By default the minimum of the absolute value across 4 preprocessed dark exposures is taken to get rid of cosmics, the result is then thresholded to create a mask. Gaps are filled using binary_closure and several such masks are OR-stacked to account for some variability. Finally, columns with more than some fraction of the pixels masked will be fully masked on a per-amp basis. A preexisting mask will be taken into account as well if supplied.

The code runs on either existing preproc files or will preproc the raw files depending on options set. The latter option probably still needs some tuning.

Waelthus commented 5 months ago

This could be used to address #2211.

julienguy commented 5 months ago

PR ready for review and merging, new pixel masks (committed) :

Changes in the most recent 2 commits include improved binary_closing with added margin to the image, different preproc I/O arguments logic, run only 1 mask to improve lisibility of code (hopefully).

The code was tested at the level of preprocessing for all the transition nights, inc. visual inspection of 1200s preprocessed darks.

julienguy commented 5 months ago

I removed previous instances of this pixel mask generation code and renamed this one 'desi_compute_mask'. Please review and merge if happy.

sbailey commented 5 months ago

Minor: of the 3 script names "desi_compute_mask_dark", "desi_compute_mask", and "desi_compute_pixmask", I liked "desi_compute_pixmask" the best so I renamed to make that the name of the new script going forwards. I'll merge after tests re-pass.

@Waelthus @julienguy please update the wiki Pipeline/HowTo/CreatePixmask page with instructions for how to use this new script correctly.