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

Fiberflux-to-flux ratio for PSF objects #683

Closed rongpu closed 3 years ago

rongpu commented 3 years ago

I have a question about the fiberflux, in particular, the fiberflux-to-flux ratio for TYPE==PSF objects. Given the definition of FIBERFLUX ("Predicted r-band flux within a fiber of diameter 1.5 arcsec from this object in 1 arcsec Gaussian seeing"), I would expect that the fiberflux-to-flux ratios for PSF objects would always be the exact same value. However, it appears that there is some variation in this ratio. The histograms below are fiberflux-to-flux ratios for bright and faint sources in a sweep catalog. Brighter sources have a much larger tail in the fiberflux-to-flux ratios.

![image](https://user-images.githubusercontent.com/16765087/118895218-9cdba400-b8ba-11eb-94a8-bae19ff00a13.png)image

For fainter sources (which are more relevant for DESI targeting), the fiberflux-to-flux ratios are almost all between 0.776 and 0.779: image

@dstndstn Do you know why we have these variations in the fiberflux-to-flux ratio for PSF objects? Perhaps some numerical error? It's a small variation (~0.1%) for faint sources, but I think it would be good to know the source of this variation.

dstndstn commented 3 years ago

Hi Rongpu,

That's odd!

Okay, so looking at the code, I do see one bug. For sources with proper motions, we render the source into our fake 1"-seeing image at a given date (looks like 2020.0 in the code), BUT, when we do the aperture photometry, we do that at the catalog BX, BY coordinates, which are the values derived from the catalog RA,Dec (ie, for Gaia sources whose RA,Decs are nailed down, it would be the 2015.5 epoch). So my theory is that you will find the sources with smaller FIBERFLUX/FLUX have the largest magnitude of proper motion. Ouch.

(And this would also make sense why you see fatter tails in brighter stars = larger proper motions.)

Regarding the 0.776 to 0.779 width of the faint peak, my guess is that these are stationary sources, and the variation is based on inter-pixel BX,BY values, because I'm rendering out a Gaussian profile, but not doing any "pixels are little boxes" integration, and Gaussians aren't purely band-limited, so this is basically numerics coming from aliasing. My guess would be that scatter-plotting them in np.fmod(bx, 1.), np.fmod(by, 1.) space would show this.

cheers, --dustin

rongpu commented 3 years ago

Thanks Dustin!

Here is the FIBERFLUX/FLUX vs proper motion plot: image Clearly it shows that your theory is correct and the large variation is indeed caused by the bug.

And here is the scatter plot (although the points have fused into a continuous image) that you suggested: image Again it confirms your theory that the width of the peak is from aliasing. Glad to know that the stationary sources are only affected by numerical error!

dstndstn commented 3 years ago

Hi Rongpu,

Wow, those plots are great.

Is this bug going to affect targeting? It looks like it's mainly the LRG and BGS samples that use the fiber mags, LRG in z band for a star veto, and, oh, for the faint limit too.

I guess I'll write to desi-targets about this, unless you want to!

djschlegel commented 3 years ago

The subpixel difference is a 0.2% effect that I think we could view as noise. The proper motion "bug" won't effect the galaxies.

rongpu commented 3 years ago

The Milky Way Survey targets don't use fiberflux, so they are not affected. For galaxy targets, I guess that targets that have GAIA proper motion are so rare that it should be safe to ignore them.

dstndstn commented 3 years ago

fixed in #690