# During aperture photometry when simulating an undetected star, why must an upper limit and standard deviation need to be calculated?

I am trying to learn aperture photometry using python

I noticed the following logic in the image below, where an upper limit was determined by simulating an undetected star and the standard deviation was calculated. Why is this logic needed during photometry? What is the purpose of finding an upper limit and calculating the standard deviation for it?

• "finding an upper limit and calculating the standard deviation for it" -- you've got it backwards: the example is about estimating the standard deviation and then estimating the upper limit from that. Commented Aug 22, 2021 at 9:11

The calculated standard deviation is often used as the uncertainty in the measured flux of a single pixel. What you are doing is saying that if the source was three times as bright as this, you would claim it has been detected. Hence this is an upper limit for detection of flux in a single pixel at three times the standard deviation.

However, I don't completely understand the logic here, since the source would normally occupy several, if not many pixels, so the relationship of the number you have calculated to actual detection threshold (or limiting magnitude) of a point source is more complex and depends on the point spread function.

The underlying rationale for doing something like this is that sometimes you have a source (e.g. a star or distant galaxy) that's detected in one image (say, a near-infrared image) and you want to know how bright it is in a different image (say, a blue optical image). So -- assuming the different images are astrometrically calibrated to you can locate where the source should be in the second image -- you do an aperture measurement on the second image.

If there isn't a visible source there, you may still want to have an estimate of how bright it could be in the blue and still go undetected in that image. (You might have two different models for the source: in one model, it's very bright in the blue, and you should have detected it; in the other, it's faint enough in the blue to be consistent with not seeing it in your image.) So measuring an upper limit in cases where you can't immediately see a source is still scientifically useful.

(This is leaving aside the issue that, as @ProfRob pointed out, this example seems to be wrong in the details of how you would calculate a 3-sigma upper limit for the aperture photometry. A better approach might be to perform multiple aperture-photometry measurements in different blank regions of the image (e.g., regions where you have good reason to believe there aren't any sources at all) and use those to get the standard deviation.)