| fitparams | noao.digiphot.photcal | fitparams |
fitparams -- solve for the parameters of the transformation equations
fitparams observations catalogs config parameters
FITPARAMS parses the configuration file config checking for grammar and syntax errors. FITPARAMS attempts to recover from any errors and to finish parsing the configuration file, but it will not process the input data if errors are present. The configuration file is described briefly in the configuration file section and in detail in the help page for the configuration file.
Once the configuration file is successfully parsed, FITPARAMS reads the list of catalog files and loads the values of the catalog variables declared in config into memory. If no catalog section is declared in config , if the catalog section is empty, or if catalogs is "", no catalog data is read and all the required input data is assumed to be in observations . After the catalog data is read, FITPARAMS reads the observations files observations , matches the object ids of the observations with the corresponding catalog object ids, and loads all the observations variables declared in config into memory. Id matching is disabled if no catalog data is read, otherwise only those observations which have a matching catalog entry will be used in the fit. If a catalog section declaration was made in config , even an empty one, FITPARAMS assumes that the object ids are in column 1 of observations .
Legal catalog and observations files are multi-column text files whose columns are delimited by whitespace. The first column of a catalog file is always reserved for an object id. The first column of an observations file is usually reserved for an object id which can be used to match the observational data with the corresponding catalog data. All other columns may contain any quantity which can be expressed as an integer or real number. Sexagesimal format numbers (hh:mmm:ss) are interpreted internally as real numbers. The constant INDEF can be used to represent data that is missing or undefined. Double precision and complex data are not supported. Lines beginning with "#" are treated as comment lines.
FITPARAMS solves the fit for each equation in the configuration file either interactively or non-interactively depending on the value of interactive , and writes the solution in the output file parameters for later use by the evaluation routines EVALFIT or INVERTFIT. Selected results can also be written to logfile if any of the switchs log_unmatched , log_fit , or log_results are enabled. In interactive mode the user can use all the interactive capabilities of the interactive non-linear least squares package INLFIT. INLFIT is described more fully below.
The configuration file is a text file which specifies how the data is organized in the input files and how the transformation equations are to be fit.
The input data are assumed to come from two different sources that may be either in the same input file or in different input files. These sources are known as the catalog and the observations respectively.
The catalog contains values indexed by a name called the matching name. This name must be in the first column of the catalog and is also assumed to be unique, i.e, each catalog entry is assumed to be unique.
The observations are values that may be either indexed by a matching name if a catalog section is specified in the configuration file, or a stream of input values in an ordinary text file. If a catalog section is specified and non-empty, each observation is matched against the catalog entries, and only observations whose matching names are found in the catalog are used to compute the transformation equations. Otherwise all values are used.
The configuration file is divided in three sections: the catalog section which describes the format of the catalog files, the observations section which describes the format of the observation files, and the transformation section which defines the transformation equations in that order.
The catalog and observations sections permit the user to assign names to the input file columns. These columns can later be referenced by name in the configuration file by using these assigned names as if they were variables in a programming language.
The transformation section is used to define the equations to solve, and assign initial values to the fitting parameters. The user may also optionally define equations for the derivatives of the transformation equations with respect to the parameters, the weights to be used in the fit, the errors of the fit and the default equations to be plotted in the interactive fitting process. It is possible to specify any number of transformation equations in this section.
SAMPLE CONFIGURATION FILES
Example 1. Configuration file for reducing UBV photoelectric photometry.
# Configuration file for reducing UBV photoelectric photometry.
catalog
V 2 # V magnitude
BV 3 # B - V color
UB 4 # U - B color
observation
v 2 # v instrumental magnitude
b 3 # b instrumental magnitude
u 4 # u instrumental magnitude
ev 5 # error in v instrumental magnitude
eb 6 # error in b instrumental magnitude
eu 7 # error in u instrumental magnitude
X 8 # airmass
transformation
fit v1 = 0.0, v2=0.16, v3=-0.043
VFIT: V = v1 + v - v2 * X + v3 * (b - v)
weight(VFIT) = 1.0 / ev ** 2
plot(VFIT) = V, V - (v1 + v - v2 * X + v3 * (b - v))
fit b1 = 0.0, b2=0.09, b3=1.21
BVFIT: BV = b1 - b2 * X + b3 * (b - v)
weight (BVFIT) = 1.0 / (eb ** 2 + ev ** 2)
plot(BVFIT) = BV, BV - (b1 - b2 * X + b3 * (b - v))
fit u1 = 0.0, u2=0.300, u3=0.861
UBFIT: UB = u1 - u2 * X + u3 * (u - b)
weight (UBFIT) = 1.0 / (eu ** 2 + eb ** 2)
plot(UBFIT) = UB, UB - (u1 - u2 * X + u3 * (u - b))
Example 2. Configuration file for reducing UBV CCD photometry.
catalog V 2 # V magnitude BV 3 # B - V color UB 4 # U - B color error(V) 5 # error in V magnitude error(BV) 6 # error in B-V color error(UB) 7 # error in U-B color observation m1 2 # filter 1 instrumental magnitude error(m1) 3 # error in filter 1 instrumental magnitude Xm1 4 # airmass of filter 1 observation m2 6 # filter 2 instrumental magnitude error(m2) 7 # error in filter 2 instrumental magnitude Xm2 8 # airmass of filter 2 observation m3 10 # filter 3 instrumental magnitude error(m3) 11 # error in filter 3 instrumental magnitude Xm3 12 # airmass of filter 3 observation transformation fit u1 = 27.0, u2=0.68, u3=0.05 UFIT: m3 = u1 + V + BV + UB + u2 * Xm3 + u3 * UB fit b1 = 26.0, b2=0.30, b3=0.18 BFIT: m2 = b1 + V + BV + b2 * Xm2 + b3 * BV fit v1 = 25.0, v2=0.17, v3=-0.02 VFIT: m1 = v1 + V + v2 * Xm1 + v3 * BV
DESCRIPTION
INLFIT fits an n-dimensional function to a set data points, iterating until the reduced chi-squared changes by less than tolerance percent between sucessive iterations, or machine precision is reached and the fit converges, or until the maximum number of iterations maxiter is reached. If the maximum number of iterations is reached before convergence a status flag is set.
After computing an initial fit, INLFIT presents the user with a plot of the fit and activates the graphics cursor. At this point the user may examine and/or interact with the fit by, for example, reprogramming the default graph keys, editing the default convergence or bad data rejection parameters, deleting and undeleting points, altering which parameters in the fitting function are actually to be fit and which are to be held constant, and refitting the data.
If nreject is greater than zero the RMS of the residuals is computed and points whose residuals are less than low_reject * RMS or high_reject * RMS value are excluded from the fit. Points within a distance grow of a rejected point are also excluded from the fit. The function is then refit without the rejected points. The rejection algorithm is executed until the number of rejection iterations reaches nreject or no more points are rejected.
ALGORITHMS
INLFIT uses the standard Levenberg-Marquardt non-linear least squares algorithm to fit the data. Detailed descriptions of the algorithm can be found in the following two references.
1. Bevington, P.R., 1969, Data Reduction and Error Analysis for the Physical Sciences, Chapter 11, page 235. 2. Press, W.H. et al., 1986, Numerical Recipes: The Art of Scientific Computing, Chapter 14, page 523.
CURSOR COMMANDS
The following interactive cursor keystroke commands are available from with the INLFIT paclage.
function Dependent variable or function
fit Fitted value
residuals Residuals (function - fit)
ratio Ratio (function / fit)
nonlinear Nonlinear component
identifier Independent variable named "identifier" (if defined)
var n Independent variable number "n"
user n User defined plot equation "n" (if defined)
The application program can define independent variable names and user plot
functions, aside from the standard options provided. If variable names are
supplied, the user can reference them by their names. Otherwise they can be
always referenced by "var n", where "n" is the variable number (the user has
to know the variable order in this case). The ":variables" command will
list the currently defined variables by name and number.
The application program may
define any number of plot equations aside from the defaults provided. In this
case the user may refence them by "user n", where "n" is the plot function
number (the user must know the equation order in this case).
h function, fit
i function, residuals
j function, ratio
k var 1, function
l user 1, user 2 (default)
The initial graph key, if not redefined by the application program is h.
Colon commands are used to show or set the values of parameters. The application program calling inlfit can add more commands. Parameter names can be abbreviated. The following commands are supported.
1. Fit a set of UBV standard star data non-interactively using the automatic bad data rejection algorithm and the configuration file shown in example 2 under the configuration file section.
ph> fitparams m92.obs m92.cat m92.config m92.fit nreject=10 inter-
... compute valued for the parameters in all the transformation
equations
ph> page m92.fit
... check that the fitted parameter values are reasonable
ph> invertfit m92.obs m92.cat m92.config m92.fit m92.out
... evaluate the transformation equations for all the standard
stars
2. Fit the same set of data interactively but deleting bad points by eye instead of using the automatic rejection algorithm.
ph> fitparams m92.obs m92.cat m92.config m92.fit
... a default plot of the UFIT equation comes up on the screen
(the fit or right-hand side of the equation is plotted
versus the function or left-hand side of the equation)
... type '?' to show the available commands
... type 'i' to plot the residuals versus the function (LHS of
the equation)
... delete bad points with the 'd' key and refit using the 'f'
key
... check for any dependencies of the residuals on the the color
term by reprogramming the graph key 'l' using the 'g' key
(type 'g' to enter the reprogramming menu, 'l' after the
prompt to reprogram the 'l' key, and "UB, residuals" in
response to the question of which axes to plot
... list the plot windowing menu by typing 'w' followed by '?'
after the "window:" prompt
... type 'w' followed by 'z' after the ":window" prompt to zoom
up on an interesting area in the plot, a 'w' followed by 'a'
will return to normal scaling
... type 'q' to quit the fit for this equation
... answer "yes" to the question about saving the fit
... proceed to the next fit by typing "next" in response to the
prompt
chkconfig,mkconfig,gtools,inlfit