quLocus
Routines which fits points to the stellar locus of an input data set
DESCRIPTION: Takes a set of npts locus points described by xt,yt,zt,kx,ky,kz,distmax,
distmin, and theta. Also takes a single data point with errors. If the errors
are unknown, set them to zero. The variance in the x, y and z directions is either the
positive) computed variance, or a flag that distinguishes between UPPER_LIMIT,
LOWER_LIMIT, or UNKNOWN. If the variance flag is a limit, the corresponding value
is assumed to be the limiting color. If the flag is UNKNOWN, the corresponding
value is ignored. If the point is inside the locus, 1 is returned, else 0.
If none of the colors is known (all colors are flagged), then -1 is returned. The
values of distmax and distmin are negative or reversed, a flag of -2 is returned. The
axes are undefined if kx=ky=0, and -3 is returned if this is true for the closest
point, or one of the endpoints.
<P>
The input locus parameters should describe the extent of the locus, not including
any photometric errors. The extent may be determined any reasonable way, including
ntiles or some number of sigma of the intrinsic width. The cross section of the
locus will be assumed to have a Gaussian distribution. The nsigma in this input
determines the size of the error Gaussian around the input coordinates x, y, and z.
The width of the locus will be increased by summing the error Gaussian and the
locus width Gaussians in quadrature. The raw coordinates (without errors) are then
compared with this enlarged locus.
<P>
The ends of the locus are ellipsoids that fit smoothly onto the last locus point,
and are axially aligned in the l,m,k directions. The width in the l and m directions
are the widths of the locus at the closest locus point in the allowed k range.
The widths in the k direction are given by backkdist and forwardkdist. By tweeking
the input locus, we can eliminate stars inside right elliptical cylinders
backkdist=forwardkdist=0) and half ellipsoids; but it is especially designed to do
a sequence of elliptical cylinders with ellipsoids on the ends. Errors in the k
direction are added in quadrature with the ellipse widths in the k direction.
<P>
The limits associated with a variance which contains a flag is assumed to include
any error in the knowledge of the limit. We will assume zero additional error in that
coordinate. Any covariances which are unknown should be set to zero.
SIGNATURE:
int atQuLocusRemove(double *xt,
double *yt,
double *zt,
double *kx,
double *ky,
double *kz,
double *distmax,
double *distmin,
double *theta,
int npts,
double x,
double y,
double z,
double xvar,
double xyvar,
double xzvar,
double yvar,
double yzvar,
double zvar,
double backk,
double backkdist,
double forwardk,
double forwardkdist,
double nsigma,
int *clpnt,
double *eldist)
DESCRIPTION: Given a set of npts locus points xt,yt,zt,kx,ky,kz,theta,
calculate the <k,l,m> values for point <x,y,z>
SIGNATURE:
void atQuLocusKlmFromXyz(double *xt,
double *yt,
double *zt,
double *kx,
double *ky,
double *kz,
double *theta,
int npts,
double x,
double y,
double z,
double *k,
double *l,
double *m)