Extended IDL Help

ez_fit.pro

At present this program is installed in the /usr/local/epics/extensions/idllib directory for EPICS R3.14. This is a general purpose curve fitting widget program. It integrates all the line fitting routines into a single system. It allows the IDL user easily to access various form of curve fitting. It is internally available to the data catcher R2.1 and viewer R2.1 or later release.

From the unix operating system to access ez_fit as a stand alone program by entering :

     ezfit

In order to access ez_fit from other IDL program, a user has to make sure that the following environment variable is set before invoking IDL :

    setenv EPICS_EXTENSIONS  /usr/local/epics/extensions 

and make sure including the directory /usr/local/epics/extensions/idllib in his/her IDL search path.

List of Routines


Routine Descriptions

COMFITGRAF

[Next Routine] [List of Routines]
 NAME:
 	COMFITGRAF

 PURPOSE:
       This routine packages the IDL gradient-expansion least
       square fit COMFIT function to fit the paired data {x(i), y(i)}.
       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       COMFITGRAF, X, Y [,A] [,YFIT] [,SIGMA] ,/FIT_TYPE [,/PRINT] [,/TEST]
         

 INPUTS:

       X:        Position X vector of type integer, float or double. 

       Y:        Data value Y vector of type integer, float or double. 

       A:        Optional input, initial estimates of fitting coefficients.
                 Number of elements in A depends on the FIT_TYPE specified.
                 If A given, the number of elements in A must be consistant 
                 with the FIT_TYPE entered.
	
 KEYWORD PARAMETERS:

   FIT_TYPE:    Six type of COMFIT, it can be any of following 

                EXPONENTIAL Y = a0  * a1^x + a2 

                GEOMETRIC Y = a0 * x^a1 + a2 

                GOMPERTZ Y = a0 * a1^(a2*x) + a3 

                HYPERBOLIC  Y = 1./(a0 + a1*x) 

                LOGISTIC Y = 1./(a0 * a1^x + a2) 

                LOGSQUARE Y = a0 + a1*alog10(x) + a2 * alog10(x)^2 

   PRINT:       Specifies whether the output window will be poped up.

   TEST:        Specifies whether the default test data will be used.

 OPTIONAL OUTPUTS:

   YFIT:        Y vector calculated from the fitted equation.

   SIGMA:       Standard deviation for the parameters in A.

 SIDE EFFECTS:

      The computed parameters and the convergence may depend on the data and
      the initial parameters of A vector entered.

 RESTRICTIONS:
      The number of parameters must match exactly to the FIT_TYPE specified.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:
      Run the geometric fitting, and pops up the fitting result window

      X = [ ...]
      Y = [ ...]
      A = [ 0.5, 0.5, 0.5]
      COMFITGRAF,X,Y,A,/GEOMETRIC,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 08-13-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


CURVEFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	CURVEFITGRAF

 PURPOSE:

       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       CURVEFITGRAF,X,Y,Weights [,A ] [,Sigma] [,/PRINT]  $
            [,FUNCTION_NAME='funct']  $
            [,/NODERIVATIVE] [,ITMAX=20] [,TOL=1.e-3] 
         

 INPUTS:
       X:       Position X vector 
       Y:       Data value Y vector
  Weights:      A row vector of weights, the same length as Y. Defaults to 1.
                Instrumental weighting-Gaussian : Weights(i) = 1./sigma(i) ^2
                Statistical weighting-Poisson :  Weights(i) = 1./y(i)
       A:       The coefficients of the fit.  The number of elements in A 
                must be exactly the same as that defined in the function_name.
                If not specified, the fitting function should provide the
                initial default.
	
 KEYWORD PARAMETERS:
      PRINT:    Specifies whether the output window will be poped up.
 FUNCTION_NAME: The name of the procedure function to fit. If omitted,
 NODERIVATIVE:  If this keyword is set then the partial derivatives will be
                calculated by CURVEFIT by forward differences. Otherwise
                the procedure function should provide the partial 
                derivatives calculation.  Defaults nodevivative is not set.
                The procedure function must be written as in 'FUNCT' as
                described in IDL 'CURVEFIT' restrictions.
      ITMAX:    Maximum number of iterations. Default = 20.
      TOL:      The convergence tolerance. Default = 1.e-3. The routine 
                returns when the relative decrease in chi-squared is less
                than TOL.

 OPTIONAL OUTPUTS:
       A:       Returns the coefficients of the fit.  
      Sigma:    A vector of standard deviations for the parameters in A.

 RESTRICTIONS:
       The function to be fit must be defined and called FUNCT,
       unless the FUNCTION_NAME keyword is supplied.  This function,
       (actually written as a procedure) must accept values of
       X (the independent variable), and A (the fitted function's
       parameter values), and return F (the function's value at
       X), and PDER (a 2D array of partial derivatives).
       For an example, see FUNCT in the IDL User's Libaray.
       A call to FUNCT is entered as:
       FUNCT, X, A, F, PDER
 where:
       X = Variable passed into CURVEFIT.  It is the job of the user-written
                function to interpret this variable.
       A = Vector of NTERMS function parameters, input.
       F = Vector of NPOINT values of function, y(i) = funct(x), output.
       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
               PDER(I,J) = DErivative of function at ith point with
               respect to jth parameter.  Optional output parameter.
               PDER should not be calculated if the parameter is not
               supplied in call. If the /NODERIVATIVE keyword is set in the
               call to CURVEFIT then the user routine will never need to
               calculate PDER.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

      For more information please refer the PROCEDURE section of the
      CURVEFIT in IDL online help.

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      CURVEFITGRAF,X,Y,Weights,A,Sigma,/PRINT

      For more information please refer the EXAMPLE section of the CURVEFIT
      in IDL online help.

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-15-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


EZ_FIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       EZ_FIT

 PURPOSE:
       This routine integrates all the IDL line fitting routines into one 
       single package. It provides the IDL user with a very easy to use
       line fitting tool. It is a standalone widget application. It can
       be easily plug into any other IDL program.

       It accepts 1D or 2D arrays either from the input binary file or 
       directly from the command line. It also accepts the spreadsheet
       column type ascii input file. 

       It allows the user to select any vector from the input data and
       perform any fitting he/she desires. It lets the user easily 
       get the hardcopy of fitting graph and tabulated data.

 CATEGORY:
	Curve fitting Widgets application.

 CALLING SEQUENCE:

       EZ_FIT
	
 KEYWORD PARAMETERS:
       XARRAY:	Specifies the independent varialbe  X vector if input to be
               entered from the command line.

       YARRAY:	Specifies the dependent varialbe Y array if input to be 
               entered from the command line. It is used by 1D or 2D data.

               For 2D image data, the YARRAY represents the Y vector of the
               second dimension.

               For 1D data, multiple data vectors can be packed into Y array. 
               The Y(N,M), the N must have the same dimension as in X vector.
               the M represents the number of dependent variables in Y array.
               A user can use the cursor in the image area to select the 
               dependent variable to be fitted, or use the J text field
               to specify the dependent variable to be fitted..
               
       IM:     Specifies the 2D image array corresponding to XARRAY and 
               YARRAY. IMAGE(N,M), where dimenstion N is the same as the 
               number of elements in XARRAY, M is the same as the number 
               of elements in YARRAY.

       IPICK:  Specifies the row # from the Y array or 2D image array to be
               fitted initially.  

       JPICK:  Specifies the column # from the Y array or 2D image array to be
               fitted initially. JPICK supercedes IPICK. 

       INPATH: Specifies the initial search path

       GROUP:  The widget ID of the group leader of the widget. If this
               keyword is specified, the death of the group leader results 
               in the death of EZ_FIT.

 OUTPUTS:
       Pops up plot and list window to show fitting results with respect 
       to the input data.

 COMMON BLOCKS:
       COMMON EZ_FIT_BLOCK,ezfitData,image

 SIDE EFFECTS:
       It uses the PLOT1D and XDISPLAYFILE program to show the fitting results.

 RESTRICTIONS:
       Input binary file must be created by the U_OPERW and U_WRITE rountines.
       The input data is in platform independent XDR binary format. 

       Default input file filter for 1D data is '*.bin1d', the default 
       input file filter for 2D data is '*.bin'. User may override this
       default setting in the file selection dialog.

       Input 1D file should contains only two binary objects XARRAY and 
       YARRAY.  Input 2D file should contains only 3 binary objects XARRAY 
       YARRAY and IMAGE.
    
       Input ASCII type file should contain columns of input data. It
       uses the W_READASCII to read in columns of data. The first column
       will be independent variable, the remaining columns will be dependent
       variables.
        
 EXAMPLE:
       
       Example 1 - Use the File->Open to load input data

	       EZ_FIT

       Example 2 - Use the X,Y keywords to load 1D data 

              EZ_FIT,XARRAY=X, YARRAY=Y

       Example 3 - Use the keywords to load 2D data 

              EZ_FIT,XARRAY=X, YARRAY=Y, IM=image

 MODIFICATION HISTORY:
 	Written by:	Ben-chin K. Cha, 09-12-97.
	02-27-98	Inherit color tables from the calling program
	10-04-99	Incooporate the FUNCT_ERF fit to curvefitgraf
	10-18-99	Add the support of weight factor   
       01-06-00        Add the support of jpick, and ipick for image array
       01-23-02        Upgrade the readascii user interface for 1D/2D data
       03-01-02        R1.6
                       Modify multiple Lorenzian ROI user interface
       04-30-02        Fix GetData menu features with fittin.bin data
                       Handle the case where the table_size is less than 256

(See ez_fit.pro)


GAUSSFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	GAUSSFITGRAF

 PURPOSE:
       This routine uses the IDL GAUSSIAN fit function y=f(x) where:
               F(x) = A0*EXP(-z^2/2) + A3 + A4*x + A5*x^2
                        and
                z=(x-A1)/A2

        A0 = height of exp, A1 = center of exp, A2 = sigma (the width).
        A3 = constant term, A4 = linear term, A5 = quadratic term.

       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       GAUSSFITGRAF,X,Y [,A ] [,ESTIMATES=extimates] [,NTERMS=nterms] [,/PRINT] 
         

 INPUTS:
       X:        Position X vector 
       Y:        Data value Y vector
	
 KEYWORD PARAMETERS:
  ESTIMATES:    Optional starting estimates for the parameters of the 
                equation.  Should contain NTERMS (6 if NTERMS is not
                provided) elements.
     NTERMS:    Set NTERMS of parameters used in Gaussian fit.
      PRINT:    Specifies whether the output window will be poped up.

 OPTIONAL OUTPUTS:
       A:       The coefficients of the fit.  A is a three to six
                element vector as described under PURPOSE.

 RESTRICTIONS:
        The peak or minimum of the Gaussian must be the largest
        or smallest point in the Y vector.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      GAUSSFITGRAF,X,Y,NTERMS=4,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-03-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


LADFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	LADFITGRAF

 PURPOSE:
       This routine uses the IDL LADFIT function to fit the paired data 
       {x(i), y(i)} with the linear model Y = A + Bx. 
       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       LADFITGRAF, X, Y [,YFIT] [,ABSDEV=absdev] [,/DOUBLE] [,/PRINT] [,/TEST]
         

 INPUTS:
       X:        Position X vector 
       Y:        Data value Y vector
	
 KEYWORD PARAMETERS:
  ABSDEV:       Specifies whether the mean absolute deviation to be returned.
   PRINT:       Specifies whether the output window will be poped up.
   TEST:        Specifies whether the default test data will be used.
  DOUBLE:       If set to a non-zero value, computations are done in double 
                precision arithmetic.

 OPTIONAL OUTPUTS:
   YFIT:        Y vector calculated from the fitted equation.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      LADFITGRAF,X,Y,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 08-13-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


LINFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	LINFITGRAF

 PURPOSE:
       This routine uses the IDL LINFIT function to fit the paired data 
       {x(i), y(i)} with the linear model Y = A + Bx.  It minimize the
       chi-square error statistic.
       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       LINFITGRAF, X, Y [,YFIT] [,CHISQ=chisq] [,PROG=prob] [,SDEV=sdev] 
                  [,SIGMA=sigma] [,/DOUBLE] [,/PRINT] [,/TEST]
         

 INPUTS:
       X:        Position X vector 
       Y:        Data value Y vector
	
 KEYWORD PARAMETERS:
   CHISQ:    Use this keyword to specify a named variable which returns the
             chi-square error statistic as the sum of squared errors between
             Y(i) and A + BX(i). If individual standard deviations are 
             supplied, then the chi-square error statistic is computed as
             the sum of squared errors divided by the standard deviations.
    PROB:    Use this keyword to specify a named variable which returns the
             probability that the computed fit would have a value of CHISQR 
             or greater. If PROB is greater than 0.1, the model parameters 
             are "believable". If PROB is less than 0.1, the accuracy of the
             model parameters is questionable.
    SDEV:    An n-element vector of type integer, float or double that 
             specifies the individual standard deviations for {X(i), Y(i)}.
   SIGMA:    Use this keyword to specify a named variable which returns a 
             two-element vector of probable uncertainties for the model par-
             ameters, [SIG_A,SIG_B].
   PRINT:    Specifies whether the output window will be poped up.
   TEST:     Specifies whether the default test data will be used.
  DOUBLE:    If set to a non-zero value, computations are done in double 
             precision arithmetic.

 OPTIONAL OUTPUTS:
   YFIT:        Y vector calculated from the fitted equation.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      LINFITGRAF,X,Y,sigma=sigma,chisq=chisq,prob=prob,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 08-13-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


LORENTZFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	LORENTZFITGRAF

 PURPOSE:
       This routine uses the CURVEFIT function with the non-linear fitting
       function_name='lorentzian' specified. y=f(x) where:
         F(X) = A0 * A2^2 / ((X-A1)^2 + A2^2) and
          A0 = height of exp, A1 = center of exp, A2 = FWHM/2

       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       LORENTZFITGRAF, X, Y [,A] [,/PRINT] [,YFIT=yfit]
         

 INPUTS:

       X:        Position X vector of type float or double. 
       Y:        Data value Y vector of type float or double. 
       A:        Optional input [A0,A1,A2], initial estimates of 
                 fitting coefficients.
	
 KEYWORD PARAMETERS:
   PRINT:       Specifies whether the output window will be poped up.
   YFIT:        Y vector calculated from the fitted equation.

 SIDE EFFECTS:
      The computed parameters and the convergence may depend on the data and
      the initial parameters of A vector entered.

 RESTRICTIONS:
      The number of parameters must be three. The initial value should be
      close to the real data value with:
          A0 = height of exp, A1 = center of exp, A2 = FWHM/2
      Especially the center of expectation must corresponds to the peak 
      of the lorentzian.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:
      Run the geometric fitting, and pops up the fitting result window

      X = [ ...]
      Y = [ ...]
      A = [ Peak, Mean, FWHM/2 ]
      LORENTZFITGRAF,X,Y,A,/GEOMETRIC,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-15-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


LORENTZIAN_CURVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	LORENTZIAN_CURVE

 PURPOSE:
       For a given set of lorentzian parameters [a0,a1,a2], this routine
       calculate the corresponding {y(i)} for a given set of {x(i)}.

 CATEGORY:
 	Fitted data with plot.

 CALLING SEQUENCE:
       LORENTZIAN_CURVE, A, X, Y [,/PLOT]

 INPUTS:
       A:        Fitted lorentzian coefficients, [A0,A1,A2].
       X:        Position X vector of type float or double. 
       Y:        Data value Y vector of type float or double. 
	
 KEYWORD PARAMETERS:
   PLOT:       Specifies whether to plot the Y vector.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:
      Run the geometric fitting, and pops up the fitting result window

      X = [ ...]
      A = [Peak, Mean, FWHM/2] 
      LORENTZIAN_CURVE,A,X,Y,/PLOT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-15-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


MULTI_LORENTZFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	MULTI_LORENTZFITGRAF

 PURPOSE:
       This routine uses the CURVEFIT function to fit a set of multiple 
       LORENTZIAN functions y=f(x) where:
         F(X) = A0 * A2^2 / ((X-A1)^2 + A2^2) + ... and
          A0 = height of exp, A1 = center of exp, A2 = FWHM/2

       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       MULTI_LORENTZFITGRAF, X, Y, A [,YFIT=yfit] [,/PRINT] [,/SUBPLOT] 
         

 INPUTS:

       X:        Position X vector of type float or double. 
       Y:        Data value Y vector of type float or double. 
       A:        Lorentzian coefficients vector. It consists of a set of 
                 multiple of 3 parameters for each lorentzian.  
                 [ [A0,A1,A2], [A0,A1,A2], ... ] 
	
 KEYWORD PARAMETERS:
   YFIT:        Y vector calculated from the fitted lorentzian equations.
   PRINT:       Specifies whether the output window will be poped up.
   SUBPLOT:     If specified, a plot window shows the composition of all
                the multiple lorentzian curves.

 SIDE EFFECTS:
      The computed parameters and the convergence may depend on the data and
      the initial parameters of A vector entered.

 RESTRICTIONS:
      The number of parameters must be multiple of 3. The initial value 
      should be close to the real data value with:
          A0 = height of exp, A1 = center of exp, A2 = FWHM/2
      Especially the center of expectation must corresponds to each local
      peak of the lorentzian.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:
      Run the geometric fitting, and pops up the fitting result window

      X = [ ...]
      Y = [ ...]
      A = [ Peak1, Mean1, FWHM1/2, Peak2, Mean2, FWHM2/2, ... ]
      MULTI_LORENTZFITGRAF,X,Y,A,/GEOMETRIC,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-15-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


POLYFITGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	POLYFITGRAF

 PURPOSE:
       This routine uses the IDL least square polynomial fit function
       PLOYFIT with optional error estimates. Double precision computation
       is assumed. 
       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       POLYFITGRAF,X,Y,NDEGREE [,A ] [,YFIT] [,YBAND] [,SIGMA] [,CORRM] [,/PRINT] 

 INPUTS:
       X:        Position X vector 
       Y:        Data value Y vector
     NDEGREE:    The degree of polynomial to fit.
	
 KEYWORD PARAMETERS:
   PRINT:       Specifies whether the output window will be poped up.

 OPTIONAL OUTPUTS:
            A:  Correlation matrix of the coefficients.
         YFIT:  The vector of calculated Y's.  Has an error of + or - Yband.
        YBAND:  Error estimate for each point = 1 sigma.
        SIGMA:  The standard deviation in Y units.
        CORRM:  The correlation matrix of the coefficients.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      POLYFITGRAF,X,Y,4,A,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-03-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


POLYFITWGRAF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	POLYFITWGRAF

 PURPOSE:
       This routine uses the IDL least square polynomial fit function
       PLOYFITW with optional error estimates. 
       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       POLYFITWGRAF,X,Y,W,NDEGREE [,A ] [,YFIT] [,YBAND] [,SIGMA] [,/PRINT] 
         

 INPUTS:
       X:        Position X vector 
       Y:        Data value Y vector
       W:        The vector of weights.  This vector should be same length as 
                 X and Y.
     NDEGREE:    The degree of polynomial to fit.
	
 KEYWORD PARAMETERS:
   PRINT:       Specifies whether the output window will be poped up.

 OPTIONAL OUTPUTS:
            A:  Correlation matrix of the coefficients.
         YFIT:  The vector of calculated Y's.  Has an error of + or - Yband.
        YBAND:  Error estimate for each point = 1 sigma.
        SIGMA:  The standard deviation in Y units.

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      POLYFITWGRAF,X,Y,W,4,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 10-03-97.
      xx-xx-xxbkc  comment

(See ez_fit.pro)


READASCII

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
      READASCII

 PURPOSE:
      Read data from an ASCII file into an array. It is assumed that each line
      with same number of entries. It can extract a sub-rectangle of region
      from the ascii file.

 CATEGORY:
      Input/Output

 CALLING SEQUENCE:
      READASCII, Filename, Rarray, X, Y [ /DOUBLE, SKIP=skip, LINES=lines,
                        L_COLUMN=l_column, COLUMNS=columns , XCOL=xcol ]

 INPUT:
      Filename -  Input file name

 KEYWORD PARAMETERS:
      DOUBLE    -  specifies output variable in double position
      SKIP      -  skip number of lines at beginning of file
      LINES     -  total number of lines to be read
      L_COLUMN  -  skip number of columns from the input line
      COLUMNS   -  total number of columns to be read from the line
      XCOL      -  specifies the X axis column number, defualt 0
      YROW      -  specifies the Y axis column number, defualt 3 for 2D array
      
 OUTPUTS:
      Rarray   -  Return the dependent variable columns read in
      X        -  Return the column as X independent variable
      Y        -  Return dependent variable(s) for 1D data 
                  Return the Y independent variable for 2D data

 RESTRICTIONS:
     The input file must be in ASCII form. The header lines must be placed
     at the beginning of the file. They can be skipped by setting the SKIP 
     equal to the number of header lines at beginning. Each data line must 
     contains the exactly same number of columns.

 EXAMPLE:
   
       READASCII, 'Filename', RARRAY, X, Y 

 MODIFICATION HISTORY:
       Written by:     Ben-chin K. Cha

       09-16-98      bkc  Allows blank lines at end of ascii file, no blank
                          lines allowed between data
       11-23-99      bkc  Use keyword XCOL to specify the column to be used
                          as X-axis
       01-23-02      bkc  Use keyword YROW to specify the line to be used 
                          as Y-axis ( only used by 2D data array)
       07-15-02      bkc  Move drawing area  cursor event to top

(See ez_fit.pro)


REGRESSFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     REGRESSFIT

 PURPOSE:
     Linear regression fitting program allows the user to calibrate the
     data and call the IDL REGRESS function to get the linear regression
     fitting to find A0, A1, and A2 

	Yi = A0 + A1 * Xi1 + A2 * Xi2   for all i 

     The sample data can be loaded into REGRESSFIT from an ASCII file.
     The fitting plot and fitting report can be generated from 
     this program.

 CATEGORY:
     Widgets.

 CALLING SEQUENCE:

     REGRESSFIT [,X,Y]  [,GROUP=Group]

 INPUTS:
     X[2,NPT]:      The independent variable [Xi1,Xi2] corresponding to Yi
     Y[NPT]:        The dependent variable Yi
                    where NPT is the total number of data point.
 
 KEYWORD PARAMETERS:
     GROUP:         If specified, the close of parent window will close this
                    regressfit window.

 SIDE EFFECTS:
     If no X, Y data arrays are specified on the command line, then the 
     default sample data from the IDL reference book is initially assumed.

RESTRICTIONS:
     The fitting.rpt... is shared by all fitting methods. If the fitting 
     result is desired, it must be pressed before committing the next
     fitting method.

 EXAMPLES:

	regressfit

 MODIFICATION HISTORY:
       Written by:     Ben-chin K. Cha, Mar. 7, 2002.

(See ez_fit.pro)


REGRESSGRAF

[Previous Routine] [List of Routines]
 NAME:
 	REGRESSGRAF

 PURPOSE:
       This routine uses the IDL multiple linear regression fit function
       REGRESS with optional weighting vector specification estimates. 
       Then calls PLOT1D to graph the calculated results with the raw 
       data in a pop-up window.

 CATEGORY:
 	Curve fitting with plot.

 CALLING SEQUENCE:

       REGRESSGRAF,X,Y,W [,YFIT] [,A0] [,SIGMA] [,FTEST] [,R] [,RMUL]
               [,Chisq] [,Status] [,/Relative_weight] [,/PRINT] [Group=group] 
         

 INPUTS:
       X:        Position X vector 
       Y:        Data value Y vector
       W:        The vector of weights.  This vector should be same length as 
                 Y.
	
 KEYWORD PARAMETERS:
   PRINT:       Specifies whether the output window will be poped up.
   RELATIVE_WEIGHT: If specified no weighting is desired

 OPTIONAL OUTPUTS:
         YFIT:  The vector of calculated Y's.  Has an error of + or - Yband.
        A0:     Returns the constant item.
        SIGMA:  The standard deviation in Y units.
        FTEST:  Returns the value of F for test of fit.
        R:      Returns the vector of linear correlation coefficents.
        RMUL:   Returns the multiple linear correlation coefficient.
        CHISQ:  Returns the reduced, weighted chi-squared
        STATUS: Returns the status of internal array inversion computation.
                0-successful, 1-singular, 2-small pivot point 

 PROCEDURE:
      Before accessing this routine, the 'ez_fit.pro' must be loaded into
      IDL and the path to 'ez_fit.pro' must be in the IDL search path.  

 EXAMPLE:

      X = [ ...]
      Y = [ ...]
      REGRESSGRAF,X,Y,W,YFIT,A0,/PRINT

 MODIFICATION HISTORY:
      Written by:  Ben-chin K. Cha, 03-01-02.
      xx-xx-xxbkc  comment

(See ez_fit.pro)