Find the astrometric center of an object using a fourth-order interpolation scheme appropriate to Gaussian stars. If sigma, the width of the PSF (taken to be a Gaussian N(0,sigma^2)), is greater than 0, the routine first smooths the input image with this Gaussian. If the initial guess for the centre (x0,y0) of the smoothed image is not correct, the routine iterates, but this is a computationally expensive process); it is in practice always OK to use the maximum in the unsmoothed image for this guess. If sigma <= 0, the image is assumed to be already smoothed with the PSF. Any of dxc, dyc, sigsqx, sigsqy, sigsqp, sigsqm and peak may be NULL If dxc or dyc is NULL the dark variance and gain (and sigma if the image is already smoothed) are not required. If desired, the errors are calculated as follows: The standard deviation in the quadratic interpolator is (q |sigma|)/(A \sqrt(2pi))*sqrt(1 - exp(-1/sigma^2)) where q is the per-pixel noise and A the central amplitude in the smoothed image. For sigma == 1 this is 0.32q/A, rising to 0.40q/A for sigma large We shall take q^2 == (sky + A/2)/gain + dark_variance, where A/2 is an estimate of the noise due to the object itself. The dark variance should not include any contribution from the photon noise in the sky Return codes: 0 OK -1 Centre isn't locally highest pixel (this is set after hunting for a maximum and failing after FINDERR tries) -2 Object is too close to the edge -3 Object has vanishing second derivative -4 Sky value is set too high SIGNATURE: int atObjectCenterFind(const REGION *reg, /* region containing object */ int x0, int y0, /* 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 *xc, float *yc, /* centre of image */ float *dxc, float *dyc, /* errors in xc, yc */ float *peak, /* peak value */ float *sigsqx, float *sigsqy, /* estimates of the width^2 of the object in x and y */ float *sigsqp, float *sigsqm)
DESCRIPTION:This routine will calculate the centroid of an object in a REGION. It is a wrapper around atObjectCenterFind. It additionally finds the position angle and sigmas in the major and minor axis directions of a bivariate Gaussian fit to the center of the image using atEllipseFind.
RETURN VALUES:
SIGNATURE: int atCentroidFind(REGION *reg, int row0, int col0, double dbl_sky, double dbl_sigma, double dbl_dark_variance, double dbl_gain, double minval, double maxval, /* for scaling images to U16 */ float *fl_xc, float *fl_yc, float *fl_dxc, float *fl_dyc, float *fl_peak, float *fl_counts, float *fl_siga, float *fl_sigb, float *fl_pa)
DESCRIPTION:This routine will calculate the width of an object in a REGION. It is a wrapper around atSigmaFind.
The routine will accept a region of any type, but if it is not U16, the whole region will be scaled and converted to type U16. Therefore, it is best to send subregions to save time doing the converting. The scaling is linear with minval -> 0 and maxval -> 65535. If minval=maxval, then the min and max of the region will be used as the minval and maxval.
RETURN VALUES:
SIGNATURE: int atGaussianWidthFind(REGION *reg, int row0, int col0, double dbl_sky, double minval, double maxval, /* for scaling images to U16 */ float *fl_siga, float *fl_sigb, float *fl_pa, float *fl_peak, float *fl_counts, float *fl_xf, float *fl_yf)
DESCRIPTION:This routine will calculate position angle and widths from 2nd moments, given the centroid of an object and a REGION containing it.
RETURN VALUES:
SIGNATURE: int at2ndMoments( REGION *reg, double row, double col, double sky, int rmin, int cmin, int rmax, int cmax, double *pa, double *a, double *b)
DESCRIPTION:This routine will calculate the centroid, widths, and position angle of an object in a REGION. It is a wrapper around atDACentroid. This routine should produce the same results as the DA produces in the gang files.
RETURN VALUES:
SIGNATURE: int atDACentroidFind(REGION *reg, int row0, int col0, double dbl_sky, double dbl_sigma, double dbl_dark_variance, double dbl_gain, double minval, double maxval, /* for scaling images to U16 */ float *fl_rowc, float *fl_colc, float *fl_drowc, float *fl_dcolc, float *fl_peak, float *fl_counts, float *fl_siga, float *fl_sigb, float *fl_pa)