Answer
To take a given magnitude and translate to the number of counts in the image, insertFakes.py
uses photoCalib.magnitudeToInstFlux, which, for a given magnitude, returns the instrumental flux for the given calibration radius used in the photometric calibration step. Thus calibFluxRadius
should be set to this same radius so that we can normalize the PSF model to the correct instrumental flux within calibFluxRadius
.
The implicit convention for this radius is 12 pixels (=4" for HSC), which is why this is the default for calibFluxRadius
in insertFakes.py
.
Original Question
What is the purpose calibFluxRadius
in insertFakes.py
in pipe_tasks
? Its use doesn’t make sense to me. My reading of it is that it changes the effective realized flux to be wrong for objects so that the flux that should be distributed over an infinite aperture is instead distributed just within calibFluxRadius
.
effectively means takes the flux and boosts it by dividing by the enclosed energy within the aperture.
starIm = PSF * flux / correctedFlux
In more detail that relevant lines are:
correctedFlux = psf.computeApertureFlux(self.config.calibFluxRadius, xy)
starIm = psf.computeImage(xy)
starIm /= correctedFlux
flux = photoCalib.magnitudeToInstFlux(row[self.config.magVar % band], xy)
starIm *= flux
I think this is a confusing way to do it at two levels:
- If I simulate a source in a finite region then I should expect that I’ve only laid down a fraction of the flux. I should expect, e.g., that my aperture corrections for a set of fake stars fail when my aperture hits the box size in which I laid down the fakes.
- Even if I thought that I wanted to correct for the finite box size and for some reason make sure that all of the infinite-aperture photons were deposited within the finite bounding box, it’s not even that . There’s a separate
calibFluxRadius
. What sets that? How is it related to the finite size of the generate fake image stamp? How do I know I’m consistently using that radius in generating my catalogs and analyzing the photometry?
I would have expected:
starIm = psf.computeImage(xy)
flux = photoCalib.magnitudeToInstFlux(row[self.config.magVar % band], xy)
starIm *= flux
and I would expect that fake sources placed on an image do not deposit their full 100% of energy within the finite box in which they are simulated. If I wanted to get all of the flux placed on the image, i would create fakes with very large boxes (100s of pixels).