This is atObjectCenterFind unpacked for the DA system (i.e. no REGION) SIGNATURE: int atObjectCenterFind_Ptr(const U16 **rows, /* data */ int nrow, int ncol, /* size of data array */ int x0, int y0, /* initial estimate of centre */ /* x is col, and y is row */ int sky, /* level of background */ float sigma, /* sigma of Gaussian to smooth image with (ignore if <= 0) */ float dark_variance, /* variance of the background */ float gain, /* gain of amplifiers */ float *xc, float *yc, /* center of image */ float *dxc, float *dyc, /* errors in xc, yc */ float *peak, /* peak value */ float *sigsqx, float *sigsqy, float *sigsqp, float *sigsqm) /* estimates of the width^2 of the convolved object along the lines y=0, x=0, y=x, and y=-x */
DESCRIPTION:This routine finds the position angle and sigmas in the major and minor axis directions of a bivariate Gaussian fit to the center of the image. These quantities are calculated as follows:
First look at a Gaussian that is rotated but centered on x=0, y=0. It has equation:
Let's look at the cross section y=0. There,
To get the sigmas in the y=x and y=-x directions, we must parameterize so that arc length will be preserved. We use y=t/sqrt(2) and x=t/sqrt(2) for the y=x case. Plugging in this parameterization, we find
Now we comput the quantites:
It is easy to see from the previous two equations that:
We can then invert the linear equations for the sigmas to find a and b. If sin(pa)^2 < cos(pa)^2, then use the sigx, sigy numbers to calculate a and b. Otherwise, use sigp and sigm.
RETURNS:
SIGNATURE: int atEllipseFind( float sigsqx, float sigsqy, float sigsqp, float sigsqm, float sigma, float convpeak, float *siga, float *sigb, float *pa, float *peak, float *counts)
DESCRIPTION: RETURNS: <listing> <0> OK <-1> center isn't locally highest pixel in atObjectCenterFind_Ptr <-2> object is too close to the edge in atObjectCenterFind_Ptr <-3> object has vanishing second derivative in atObjectCenterFind_Ptr <-4> sky is too high in atObjectCenterFind_Ptr <-10> Zero sigma - peak and counts not calculated after atObjectCenterFind_Ptr <-11> Infinite sigma after atObjectCenterFind_Ptr <-21> Error in setfsigma (sigma too large) in atSigmaFind <-22> Sigma out of range (inf sharp or inf flat) in atSigmaFind <-23> Too many iterations in atSigmaFind <-24> Too close to edge in atSigmaFind <-25> Error in lgausmom - check sky value in atSigmaFind <-26> Too flat in atFindFocMom, from atSigmaFind <-30> Zero sigma - peak and counts not calculated after atSigmaFind <-31> Infinite sigma after atSigmaFind </listing> </HTML> SIGNATURE: int atDACentroid( const U16 **rows, /* data */ int nrow, int ncol, /* size of data array */ int row0, int col0,/* initial estimate of centre */ int sky, /* level of background */ float sigma, /* sigma of Gaussian to smooth image with (ignore if <= 0) */ float dark_variance, /* variance of the background */ float gain, /* gain of amplifiers */ float *rowc, float *colc, /* center of image */ float *drowc, float *dcolc, /* errors in rowc, colc */ float *peak, /* peak value */ float *counts, float *siga, float *sigb, float *pa)