legacysurvey / legacypipe

Image reduction pipeline for the DESI Legacy Imaging Surveys, using the Tractor framework
BSD 3-Clause "New" or "Revised" License
37 stars 22 forks source link

Mask CRs in regions with 1-pass in some bands #428

Open djschlegel opened 5 years ago

djschlegel commented 5 years ago

Starting with DR8, CRs are identified only by the outlier-rejection comparing repeated observations in the same filter. We therefore no longer reject CRs where we only have a single observation in that filter. We should consider falling back to the CRs identified in the CP mask for those cases. An example is attached below near RA=229.602,Dec=-3.5768 .

Screen Shot 2019-07-24 at 5 32 01 PM
djschlegel commented 4 years ago

In these cases with only 1 image in a filter at any pixels, we should use either the CP ood mask or the new cosmic masks being tested by Keming Zhang.

moustakas commented 4 years ago

For the record, here's this patch of sky in DR8-- http://legacysurvey.org/viewer?ra=229.6020&dec=-3.5769&layer=dr8&zoom=16

And below is the DR9-reprocessed image coadd with the dr9d container. Unfortunately there's still some junk. I need to dig and see if the ood image mask is being used correctly.

Screen Shot 2019-12-22 at 1 34 08 PM
moustakas commented 4 years ago

The pipeline (currently only in the dr9d-dev branch) is doing the right thing as far as I can tell. We utilize CP-flagged cosmic rays in all reductions >4.8.0-- https://github.com/legacysurvey/legacypipe/blob/dr9-dev/py/legacypipe/decam.py#L67-L71

This image is on the edge of the imaging footprint, so I propose we close this issue. @djschlegel?

dstndstn commented 4 years ago

Closing unless folks are concerned enough about the edges of the footprint. If someone were interested in testing Keming's code in prod, that could be an option.

djschlegel commented 4 years ago

Let's check that the CP masks are in fact being used in the case of a single image. For example, in the dr9d reductions there's a long CR here that then shows up in the catalog as a bunch of red sources: http://legacysurvey.org/viewer-dev/?ra=266.8144&dec=17.6608&layer=dr9d-south&zoom=16&ccds8&bright The image is decam-553769-S9-z .

djschlegel commented 4 years ago

This may be somewhat worse in DR9 than DR8, since the CP re-reductions are less aggressively masking, especially for 90prime. The fraction of "cosmic ray" (CP mask=5) pixels has been reduced in 90prime & mosaic, and increased in decam: 0.20% -> 0.06% in mosaic 0.09% -> 0.01% in 90prime 0.03% -> 0.07% in decam (The above stats are from a random sampling of images.)

moustakas commented 4 years ago

Here's another example of poor CR/outlier masking-- http://legacysurvey.org/viewer/?ra=209.1709&dec=36.2504&layer=dr8&zoom=15

moustakas commented 4 years ago

Let's check that the CP masks are in fact being used in the case of a single image. For example, in the dr9d reductions there's a long CR here that then shows up in the catalog as a bunch of red sources: http://legacysurvey.org/viewer-dev/?ra=266.8144&dec=17.6608&layer=dr9d-south&zoom=16&ccds8&bright The image is decam-553769-S9-z .

@djschlegel here's where we are in this chunk of sky with the current code base. @dstndstn and I have verified that we're using the correct CP mask bits, and unfortunately we do end up with (here, 4 very red) spurious sources.

Unless you have a specific proposal, I propose we close this ticket (or push to DR10).

image