tclHgMath
ABSTRACT:
Routines which operate on histograms (HG) and two dimensional
histograms (HG2).
C ROUTINE CALLED:
atHgGaussianFit in atHgMath.c
Fit a gaussian to a histogram. Returns a FUNC of type "gauss".
maxit allows on to limit the number of iterations.
iprt does nothing in this version, printing the status of the fit
may be added in a future version.
TCL SYNTAX:
hgGaussFit "<hg>" "-maxit" "-iprt"
TCL HELP STRING:
Fit a gaussian to the histogram.
TCL ARGUMENTS:
:
"<hg>" : the histogram to fit
"-maxit" : maximum number of iterations, Default: 100
"-iprt" : how much status to print, Default: 0, no printing
C ROUTINE CALLED:
atHgPolyFit in atHgMath.c
Fits a polynomial of arbitrary order to a histogram. Returns a
keyed list of the form "{ {FUNC h0} {COEF h1} }" where h0 is a
FUNC of type "dpol", and h1 is a VECTOR with the coefficients of
the Taylor Series expansion of the best fit function. I.e., the
VECTOR h1 contains the a_i in:
<PRE>a_0 + a_1 * x + a_2 * x * x + a_3 * x * x * x + ... </PRE>
TCL SYNTAX:
hgPolyFit "<hg>" "<order>"
TCL HELP STRING:
Fit a polynomial to the histogram.
TCL ARGUMENTS:
:
"<hg>" : the histogram to fit
"<order>" : 0 for constant, 1 for linear, 2 for quadratic, 3 for cubic, etc.
C ROUTINE CALLED:
atProco in atHgMath.c
TCL SYNTAX:
proco "<xin>" "<yin>" "-a0" "-d0" "-dx" "-dy" "-rho" "-sys" "-mode"
TCL HELP STRING:
convert from grid to sky coordinates and back again
TCL ARGUMENTS:
:
"<xin>" : input x coordinate (longitude in degrees of x grids)
"<yin>" : input y coordinate (latitude in degrees of y grids)
"-a0" : projection center longitude (degrees), Default: 180.0
"-d0" : projection center latitude (degrees), Default: 0.0
"-dx" : x grid separation (degrees), Default: 0.1
"-dy" : y grid separation (degrees), Default: 0.1
"-rho" : rotation angle (degrees), Default: 0.0
"-sys" : type of projection (1=AITOFF, 2=Equivalent
Cylindrical, 3=Flat 4=Gnomonic, 5=Orthographic,
6=Rectangular, 7=Global Sinusoidal,
8=North Celestial Pole, 9=Stereographic
10=Mercator), Default: 1
"-mode" : mode (0=lon,lat->x,y; 1=x,lat->lon,y; 2=lon,y->x,lat; 3=x,y->lon,lat), Default: 0
C ROUTINE CALLED:
atRegPlot in atHgMath.c
TCL SYNTAX:
regPlot "<pgstate>" "<reg>" "<fg>" "<bg>" "<trans>" "[mode]" "-xlab" "-ylab" "-noBox"
TCL HELP STRING:
Plot the region using pgPlot
TCL ARGUMENTS:
:
"<pgstate>" : The PGSTATE to use
"<reg>" : The REGION to plot
"<fg>" : array value to map to c1
"<bg>" : array value to map to c2
"<trans>" : The TRANS from row,col to x,y position
"[mode]" : mode for scaling: 0=linear 1=log 2=sqrt, Default: 0
"-xlab" : label for the x axis, Default: no label
"-ylab" : label for the y axis, Default: no label
"-noBox" : if 1, do not plot box, Default: 0
C ROUTINE CALLED:
atRegColorPlot in atHgMath.c
TCL SYNTAX:
regColorPlot "<pgstate>" "<reg>" "<fg>" "<bg>" "<trans>" "[smode]" "[cmode]" "-xlab" "-ylab" "-noBox"
TCL HELP STRING:
Plot the region in color
TCL ARGUMENTS:
:
"<pgstate>" : The PGSTATE to use
"<reg>" : The REGION to plot
"<fg>" : array value to map to c1
"<bg>" : array value to map to c2
"<trans>" : The TRANS from row,col to x,y position
"[smode]" : mode for scaling: 0=linear 1=log 2=sqrtn;
Default: 0
"[cmode]" : mode for color: 1=gray; 2=rainbow;
3=heat; 4=weird IRAF; 5=AIPS; 6=TJP; 7=red;
8=green; 9=blue; 10=yellow; 11=cyan;
12=magenta; 13=SAO B; (negative values are
inverse values, e.g., -1=inverse gray); Default : 1
"-xlab" : label for the x axis, Default: no label
"-ylab" : label for the y axis, Default: no label
"-noBox" : if 1, do not plot box, Default: 0
C ROUTINE CALLED:
atHg2New in atHgMath.c
TCL SYNTAX:
hg2New "<xmin>" "<xmax>" "<nx>" "<ymin>" "<ymax>" "<ny>" "-xlab" "-ylab" "-name"
TCL HELP STRING:
Create a new HG2
TCL ARGUMENTS:
:
"<xmin>" : minimum x value
"<xmax>" : maximum x value
"<nx>" : number of x bins
"<ymin>" : minimum y value
"<ymax>" : maximum y value
"<ny>" : number of y bins
"-xlab" : label for the x axis, Default: no label
"-ylab" : label for the y axis, Default: no label
"-name" : name for the HG2, Default: none
C ROUTINE USED:
atHg2Del in atHgMath.c
TCL SYNTAX:
hg2Del "<hndl>"
TCL HELP STRING:
Delete the HG2 and its handle
TCL ARGUMENTS:
:
"<hndl>" : The HG2's handle
C ROUTINE USED:
atHg2Fill in atHgMath
TCL SYNTAX:
hg2Fill "<hndl>" "<x>" "<y>" "[w]"
TCL HELP STRING:
Fill the HG2 and its handle
TCL ARGUMENTS:
:
"<hndl>" : The HG2's handle
"<x>" : x position in the HG2
"<y>" : y position in the HG2
"[w]" : weight; Default: 0
C ROUTINE CALLED:
atHg2Get in atHgMath.c
TCL SYNTAX:
hg2Get "<hndl>" "<x>" "<y>"
TCL HELP STRING:
Get the contents of the hg2
TCL ARGUMENTS:
:
"<hndl>" : The HG2's handle
"<x>" : x position in the HG2
"<y>" : y position in the HG2
C ROUTINE CALLED:
atHg2VFill in atHgMath.c
TCL SYNTAX:
hg2VFill "<hndl>" "<x>" "<y>" "[w]"
TCL HELP STRING:
Fill the HG2 and its handle
TCL ARGUMENTS:
:
"<hndl>" : The HG2's handle
"<x>" : vector with x positions in the HG2
"<y>" : vector with y positions in the HG2
"[w]" : vector with weights; Default: all weights = 1
C ROUTINE USED:
atHg2Cont in atHgMath.c
TCL SYNTAX:
hg2Cont "<pgstate>" "<hg2>" "<cVec>"
TCL HELP STRING:
Plot the HG2 using pgCont
TCL ARGUMENTS:
:
"<pgstate>" : The PGSTATE to use
"<hg2>" : The HG2 to plot
"<cVec>" : VECTOR of contour levels
C ROUTINE USED:
atHg2Gray in atHgMath.c
TCL SYNTAX:
hg2Gray "<pgstate>" "<hg2>" "<a1>" "<a2>"
TCL HELP STRING:
Plot the HG2 using pgGray
TCL ARGUMENTS:
:
"<pgstate>" : The PGSTATE to use
"<hg2>" : The HG2 to plot
"<a1>" : array value to map to c1
"<a2>" : array value to map to c2
C ROUTINE USED:
atRegHistEq in atHgMath.c
TCL SYNTAX:
regHistEq "<region>" "<hg>" "<min>" "<max>"
TCL HELP STRING:
histogram equalization of a region
TCL ARGUMENTS:
:
"<region>" : The REGION to equalize
"<hg>" : The HG to use for equalization
"<min>" : minimum equalized value
"<max>" : maximum equalized value