This is the heart of the program. SRMetric returns the ratio of the peak signal
to the total signal of the supplied star. The peak comes from an oversampled version
via the FTScale routine, and the total signal is that within a radius SR_Conf.phRad.
Details
The routine calculates ary8, an eight-times oversampled version of the input image inAry.
It then searches a region of size SR_Conf.pfRad for the maximum value, max8. The total
flux fTot is calculated from the original inAry within radius SR_Conf.phRad. The returned
SR metric is just max8 / fTot.
Actually, there is a complication...we have to extract a sub-array centered on the star,
(that is, on the peak flux, rather than the center of the array, since the user could have
clicked anywhere) and then only add up those pixels within phRad of this point.
Actually, there is another complication. A proper SR Metric depends on proper background
subtraction. This includes determining the actual peak signal. For this reason, the
routine does the photometry on the input image and then subtracts the original-
image background value from 64 times the maximum pixel derived from the re-sampled
image (FTScale conserves flux, and thus 8x oversampling reduces the peak by 64). The
SR Metric is then actually (64 * max8 - bAvg) / fTot
One more thing...LINC-NIRVANA has very fine sampling (5.11 mas per pixel). This means
that a "postage stamp" extract of an image with, say, 1.5 arcsec radius will be almost
600 pixels across. It does not make sense to 8-times oversample such an image in order
to find the peak pixel: this would require resampling a 1024 square image to 8192 square.
While entirely possible, such a procedure is costly in computing and moreover, entirely
unnecessary. Instead, we extract a smaller sub-region (typically 128 x 128 pixels) for
the peak finding and do the photometry on the original.
Parameters
inAry - Supplied numpy array containing star image
srm - Returned SR Metric
ary8 - Eight-times oversampled version of inAry
mBH - max Box Half...half the size of the peak finding search box, given by
the number of input pixels (SR_Conf.phRad/SR_Conf.pxScl*1000) times 8
(for oversampling) and then divided by 2 (for half the box). i.e. * 4000.0
max8 - Maximum pixel value in this box
inMax - 64 times max8...the effective peak signal in the input
phR - and ibR,obR are the relevant photetry radii in pixels
phAry - Extracted photometry sub-array
fTot,bTot - Total flux in star, background annulus
bAvg, bMed - Average and median background in original image
nfTot,nbTot - and pixel counts
starFlux - Background-subtracted star flux