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

Fix or reject sky around some bright stars #665

Open djschlegel opened 3 years ago

djschlegel commented 3 years ago

Anand has reported worse halo subtraction around this bright star:

Dustin thinks it may be due to one z-band exposures, which we could reject, or try to improve the sky-subtraction https://www.legacysurvey.org/viewer-dev/ccd/dr9m-south/decam-253195-N7.xhtml?rect=513,554,200,200

From Rongpu: The particular DECam exposure before sky correction: https://data.desi.lbl.gov/desi/users/rongpu/plots/dr9dev/sky_pattern/sky_templates_v2/original_CP_images/z/z_856_image_253195.png The pattern is clearly caused by the bright star.

And the sky correction does not help because it's a single-exposure pattern rather than sky pattern; here is after sky correction: https://data.desi.lbl.gov/desi/users/rongpu/plots/dr9dev/sky_pattern/sky_templates_v2/median_fit_scale/z/z_856_image_253195_medianscale.png

Here is DR8 version: https://data.desi.lbl.gov/desi/users/rongpu/plots/dr9dev/sky_pattern/sky_templates_v2/original_CP_images_dr8/z/z_856_image_253195_dr8.png It is slightly better but the gradient is still there, so I'm not sure why the sky is much worse in DR9. Perhaps it's due to changes in splinesky around bright stars in DR9? I seem to remember that in DR9 the bright star mask is applied before the splinesky computation, and the mask for that star seems to match the radius of the ghosts in DR9: https://www.legacysurvey.org/viewer-dev/?ra=34.8366&dec=-2.9771&layer=ls-dr9&zoom=11&masks-dr9

rongpu commented 3 years ago

It's most likely not caused by the halo subtraction: the halo subtraction is clipped at 400 arcsec, so that's much smaller than the extent of the sky residuals.

This problem seems to affect all the extremely bright stars in the south. Another (more extreme) example (where the mask boundary clearly matches with the extent of bright ghosts): https://www.legacysurvey.org/viewer-dev?ra=213.9181&dec=19.1872&layer=ls-dr9-south&zoom=10&masks-dr9 and compare with DR8: https://www.legacysurvey.org/viewer-dev?ra=213.9181&dec=19.1872&layer=ls-dr8-south&zoom=10&masks-dr9

If it is indeed due to the bright star masking in the DR9 splinesky estimation, perhaps we should clip the mask radius similar to what we did for halo subtraction.

schlafly commented 3 years ago

I think this is present in the north as well, albeit less importantly. https://www.legacysurvey.org/viewer-dev?ra=222.6766&dec=74.1555&layer=ls-dr9-north&zoom=9&masks-dr9&blink=ls-dr8 https://www.legacysurvey.org/viewer-dev?ra=193.3756&dec=55.9891&layer=ls-dr9-north&zoom=11&masks-dr9&blink=ls-dr8

The difference there seems to be mostly that the primary ghosts that can be subtracted largely okay by the normal sky subtraction are much smaller and brighter and are within the BRIGHT mask. Meanwhile the ghosts outside the bright mask are pretty horrific and don't subtract remotely cleanly, but you can see DR8 making the effort and DR9 not.