photutils icon indicating copy to clipboard operation
photutils copied to clipboard

The meaning of 'flux_unc' in PSF photometry & How to include Poisson noise into the error

Open Codeprey opened this issue 3 years ago • 3 comments

Hi Developers,

I'm trying to do a BasicPSFPhotometry with a poisson-noise-added galaxy image (the galaxy image is created in GalSim, and the noise is either added in GalSim or the apply_poisson_noise function, I find it makes no difference) and a PSF image (a 2D PRF generated by GalSim).

I hope I can get the flux (in the unit of photons, surely flux_fit) and its uncertainty (same unit, maybe flux_unc?). In my opinion, the uncertainty (flux_unc?) should be at least 1 $\sigma$ of the poisson noise (almost equal to the square root of flux_fit), however the actual results are not as I thought, but related to the fitshape parameter.

Here are some examples: fitshape=(5,5)-->flux_fit=3004.1527051381345, flux_unc=100.68513878944974 fitshape=(7,7)-->flux_fit=3047.7049016109618, flux_unc=71.20240066856194 fitshape=(11,11)-->flux_fit=3067.331973786521, flux_unc=46.463004077323845 ... fitshape=(25,25)-->flux_fit=3069.040817409932, flux_unc=21.399092403713393 fitshape=(101,101)-->flux_fit=3069.1344428757516, flux_unc=5.451794229386504

Larger fitshape gets smaller uncertainty. So I guess flux_unc is the uncertainty of the fit itself? Sorry if I misunderstand.

My questions are as follows:

  • Why can't I input the error image to the BasicPSFPhotometry function like error in aperture_photometry? In this way flux_unc can take the poisson noise into account. Maybe it is already included in photutils.psf but I omit it?
  • If not included, how should I perform a PSF photometry to a poisson-noise-added image, and count the real flux error of this image? That is, a flux error including the poisson noise and the uncertainty of BasicPSFPhotometry. I expect photutils.psf can output this flux error ($\sigma_{total}$).

I need this flux error to determine if a transient lying in the center of a galaxy is detected (Therefore I do a PSF photometry to the galaxy rather than an aperture photometry). I'd be really appreciated If you could help me deal with it!

Best,

Codeprey

Codeprey avatar Dec 04 '20 15:12 Codeprey

I suspect flux_unc is the flux error in the PSF fit. That error should be correlated with the noise in the data. @mirca?

larrybradley avatar Dec 14 '20 23:12 larrybradley

flux_unc is the uncertainty associated to the flux parameter in the PSF fit. This uncertainty is computed via a local approximation of the Fisher Information Matrix (returned by the optimizer) at the fitted parameters. As far as I'm concerned, one practical way of accounting for Poisson statistics is to approximate them via a Gaussian statistics, which in practice works well as long as the number of photon counts on the portion of the image that you are interested in is sufficiently larger than the background noise.

mirca avatar Dec 17 '20 05:12 mirca

@larrybradley @mirca Thanks for your kind advice! Actually I'd been waiting too long and the deadline is near, so I've used another package call PythonPhot to solve this problem (and have got more reasonable results), but I sincerely hope you can allow users to pass a noise_image into your PSF photometry algorithm, or guide us the proper way to set the fitshape in the tutorial.

Best, Codeprey

Codeprey avatar Dec 18 '20 12:12 Codeprey