atHgMath
Routines which operate on HGs AFs and VECTORs
DESCRIPTION:
Fits a Gaussian to an HG histogram and returns a FUNC
with the parameters of the Gaussian in it. maxit
controls the maximum number of iterations for fiting.
iprt is a flag for printing fit status at each iteration,
but hasn't been implemented in this version and does nothing.
Calls the SLATEC routine smaDNLS1.
RETURN VALUES:
Returns a FUNC struct of Gaussian type.
SIGNATURE:
FUNC *atHgGaussianFit(
HG *hg,
int maxit,
int iprt
)
DESCvRIPTION:
Fits a Polynomial to an HG histogram and returns a FUNC.
Calls the SLATEC routines smaDPOLFT and smaDPCOEF.
RETURN VALUES:
Returns a FUNC of type dpol and fills in tcVec with the coefficients
from a Taylor Series expansion of the best fit polynomial.
SIGNATURE:
FUNC *atHgPolyFit(HG *hg, int order, VECTOR *tcVec)
DESCRIPTION: Function which does the conversion of grid to sky
coordinates and vice versa.
Author: K.G. Begeman; copied and installed in ASTROTOOLS by Chris S.
RETURN VALUES:
0: successful conversion
1: unknown projection
2: unknown mode
3: CROTA2 = 90.0 for mode 1 and 2
4: CDELT1 or CDELT2 equal to zero
xin Input X coordinate (Longitude in degrees or
X grids).
yin Input Y coordinate (Latitude in degrees or
Y grids).
xou Output X coordinate (X grids or Longitude
in degrees).
you Output Y coordinates (Y grids or Latitude
in degrees).
a0 Projection centre longitude (Longitude in
degrees).
d0 Projection centre latitude (Latitude in
degrees).
dx X grid separation in degrees.
dy Y grid separation in degrees.
rho Rotation angle in degrees.
sys Type of projection:
1 AITOFF equal area projection
2 Equivalent Cylindrical projection
3 Flat projection
4 Gnomonic projection
5 Orthographic projection
6 Rectangular projection
7 Global Sinusoidal projection
8 North Celestial Pole projection
9 Stereographic projection
10 Mercator projection
mode Mode determines what type of input/output
coordinates are given/wanted.
MODE XIN YIN XOUT YOUT
0 LON LAT X Y
1 X LAT LON Y
2 LON Y X LAT
3 X Y LON LAT
Updates: Jan 5, 1990: KGB, Document created.
Apr 19, 1996: Chris S. installed in Astrotools
SIGNATURE:
int atProco( double *xin , /* input */
double *yin , /* input */
double *xou , /* output */
double *you , /* output */
double *a0 , /* input */
double *d0 , /* input */
double *dx , /* input */
double *dy , /* input */
double *rho , /* input */
int *sys , /* input */
int *mode /* input */
)
DESCRIPTION: Plot a region in a PGPLOT window defined in a PGSTATE
RETURN VALUES: SH_SUCCESS
SIGNATURE:
RET_CODE atRegPlot(
PGSTATE *pg, /* the PGPSTATE to plot in */
REGION *reg, /* the REGION to plot */
float fg, /* minimum pixel value to show */
float bg, /* maximum pixel value to show */
TRANS *trans, /* TRANS to get from row,col to display */
int mode, /* 0=linear; 1=log; 2-sqrt */
char *xlab, /* x label string */
char *ylab, /* y label string */
int nobox /* 0=plot box, 1=no plotting of box */
)
DESCRIPTION: Plot a region in a PGPLOT window defined in a PGSTATE
RETURN VALUES: SH_SUCCESS
SIGNATURE:
RET_CODE atRegColorPlot(
PGSTATE *pg, /* the PGPSTATE to plot in */
REGION *reg, /* the REGION to plot */
float fg, /* minimum pixel value to show */
float bg, /* maximum pixel value to show */
TRANS *trans, /* TRANS: row,col to display */
int smode, /* 0=linear; 1=log; 2-sqrt */
int cmode, /* 1=gray; 2=rainbow; 3=heat;
4=weird IRAF; 5=AIPS; 6=TJP;
-1=inverse gray */
char *xlab, /* x label string */
char *ylab, /* y label string */
int nobox /* 0=plot box, 1=no plotting of box */
)
DESCRIPTION:
Make a new HG2
RETURN VALUES:
pointer to the HG2
SIGNATURE:
HG2 *atHg2New(
double xmin, /* minimum x value */
double xmax, /* maximum x value */
int nx, /* number of bins in x */
double ymin, /* minimum y value */
double ymax, /* maximum y value */
double ny, /* number of bins in y */
char *xlab, /* label for x axis */
char *ylab, /* label for y axis */
char *name /* name of HG2 */
)
DESCRIPTION:
Delete a HG2 structure
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atHg2Del(
HG2 *hg2 /* the HG2 to delete */
)
DESCRIPTION:
Fill the HG2 at the specified location with the weight given
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atHg2Fill(
HG2 *hg2, /* the HG2 to fill */
double x, /* x position to fill */
double y, /* y position to fill */
double w /* weight -- increments bin by this amount */
)
DESCRIPTION:
Get the value of a bin of a HG2 structure
RETURN VALUES:
the value, or 0 if x and/or y are out of range
SIGNATURE:
double atHg2Get(
HG2 *hg2, /* the HG2 to evaluate */
double x, /* x position for evaluation */
double y /* y position for evaluation */
)
DESCRIPTION:
Fill the HG2 with the contents of a vector
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atHg2VFill(
HG2 *hg2, /* the HG2 to fill */
VECTOR *vx, /* vector of x values */
VECTOR *vy, /* vector of y values */
VECTOR *vw /* vecotr of weights */
)
DESCRIPTION:
Plot the HG2 as a contour
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atHg2Cont(
PGSTATE *pg, /* where to make the plot */
HG2 *hg2, /* the HG2 to plot */
VECTOR *cVec /* vector of contour levels */
)
DESCRIPTION:
Plot the HG2 as gray scale image
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atHg2Gray(
PGSTATE *pg, /* where to make the plot */
HG2 *hg2, /* the HG2 to plot */
float fg, /* foreground value */
float bg /* background value */
)
DESCRIPTION:
Make the TRANS (tc) that does the same thing as applying
tb and then ta. Only the affine terms are used.
RETURN VALUES:
Returns SH_SUCCESS
SIGNATURE:
RET_CODE atTransMultiply(TRANS *ta, TRANS *tb, TRANS *tc)
DESCRIPTION:
Convert a struct of type MATRIX to a struct of type TRANS.
Only the affine terms are converted.
RETURN VALUES:
Returns 0
SIGNATURE:
RET_CODE atMatrixToTrans(MATRIX m, TRANS *t_ptr)
DESCRIPTION:
Convert a struct of type TRANS to a struct of type MATRIX
Only the affine terms are converted.
RETURN VALUES:
Returns 0
SIGNATURE:
RET_CODE atTransToMatrix(TRANS *t_ptr, MATRIX m)