Guest Observer Facilities & Science
Centers |
NASA Archives |
|
Next: Newpar
Up: PLT Command Summary
Previous: MArker
MOdel ?
List all built-in model components.
MOdel @filename
Cause the model definition and parameters to be read from the file
with name filename.
MOdel $
Use to define models. Any combination of model components can
be added together. For example, MOdel CONS LINR QUAD will add a
constant term, a linear term, and a quadratic term.
For each parameter required by the MOdel command, you will be prompted
for four numbers - VAL, SIG, PLO, and PHI - as described below.
For each parameter, you should enter an initial value for VAL; but
you can usually default on the other three numbers.
- VAL: This is the actual value of the parameter. Although CURFIT
will often find the the best set of parameters to model the data, it
never hurts to start it with parameters near the expected best fit.
- SIG: Any value of SIG greater than or equal to 0
will not affect the outcome of Fit. After
you fit the model, SIG will contain the one-sigma curvature errors.
This number is used by the Uncertainty command to start a formal error
determination. If the Uncertainty command fails to converge
because the original error estimate is wrong, sometimes you can help
the convergence by adjusting SIG to be a better estimate before
using Uncertainty. If you set SIG=-1, then the parameter
is frozen such that CURFIT is not allowed to change the parameter
value while fitting. If you set SIG=-IPAR, the next number
(PLO) will default to 1, such that the current parameter value
is forced to equal the value of parameter IPAR. (Note: IPAR can
not equal 1 or the current parameter number.) If you place a number
(N) after SIG, this will force the current parameter to be N times
the specified parameter. (N defaults to 1.0.)
Example:
PLT> MOdel GAUS GAUS
1, GC: VAL( 1.00), SIG( 0.00 ), PLO( 0.00), PHI( 0.00)?
,-4,2
2, GW: VAL( 1.00), SIG( 0.00 ), PLO( 0.00), PHI( 0.00)?
3, GN: VAL( 1.00), SIG( 0.00 ), PLO( 0.00), PHI( 0.00)?
4, GC: VAL( 1.00), SIG( 0.00 ), PLO( 0.00), PHI( 0.00)?
3.
5, GW: VAL( 1.00), SIG( 0.00 ), PLO( 0.00), PHI( 0.00)?
6, GN: VAL( 1.00), SIG( 0.00 ), PLO( 0.00), PHI( 0.00)?
defines a model consisting of two gaussians, with the x values of
the centers differing by a factor of 2. Although you did not enter
a value for parameter 1, it will be set to the value of 6 (2 times
value of parameter 4). This relation will be maintained throughout
a fit.
- PLO, PHI: If SIG greater than or equal to 0
and if PLO<PHI, the parameter value is
constrained to lie in the range PLO to PHI. Note: If PLO and PHI
are both the same (say equal to zero), then the parameter will not
be constrained in any way. In general, if you have difficulty fitting
some data, the best thing to do is to freeze some parameters near
to their expected values and then fit the reduced parameter set.
When a good fit has been found with the reduced set, thaw some of
the parameters and refit. If this method does not work, then you
may be forced to use PLO and PHI to limit certain parameters to a
meaningful range.
QDP/PLT currently supplies the model components defined below, which
may be combined into multi-component models:
MOdel CONS
Select a model with a constant component: FNY=FNY+CO.
MOdel LINR
Select a model with a linear component: FNY=FNY+LI*X.
MOdel QUAD
Select a model with a quadratic component: FNY=FNY+QU*X**2.
MOdel CUBI
Select a model with a cubic component: FNY=FNY+CU*X**3.
MOdel X4
Select a model with an x4 component: FNY=FNY+X4*X**4.
MOdel X5
Select a model with an x5 component: FNY=FNY+X5*X**5.
MOdel POWR
Select a model with a power-law component: FNY=FNY+PN*X**IN.
MOdel SIN
Select a model with a sinusoidal component: FNY=FNY+SN*SIN(2*PI*(X-PH)/PE).
MOdel GAUS
Select a model with a gaussian component: FNY=FNY+GN*EXP(-Z*Z/2.), where Z=(X-GC)/GW and with integral SQRT(2*PI)*GN*GW.
MOdel EXP
Select a model with an exponential component: FNY=FNY+EN*EXP(-(X-EC)/EW).
MOdel AEXP
Select a model with a symmetric exponential component
(e-|x| for all x): FNY=FNY+EN*EXP(-ABS(X-EC)/EW).
MOdel BURS
Select a model with a burst component (linear rise followed by an
exponential decay): FNY=FNY+0 for X<ST; FNY=FNY+BN*(X-ST)/(PT-ST) for ST<X<PT; and FNY=FNY+BN*EXP(-(X-PT)/DT) for PT<X.
MOdel SBUR
Select a model with a smooth-burst component: FNY=FNY+BN*(T**RR)*EXP(-(X-TS)/DT), where T=EXP(1)*(X-TS)/(RR*DT),
such that SBUR = BN at the peak.
MOdel PEAR
Select a model with a Pearson-function component: FNY=FNY+K*(F1**M1)*(F2**M2), where F1=[1.+(X-X0)/A1] and F2=[1.-(X-X0)*M1/(A1*M2)].
MOdel WIND
Select a model with a window-function component: FNY=FNY+LE for T1<X<T2; and FNY=FNY+0 otherwise.
MOdel KING
Select a model with a King-profile component: FNY=FNY+S0*(1.+(X/RC)**2)**(-IN).
MOdel LORE
Select a model with a Lorentz-profile component: FNY=FNY+LN/(1.+[ 2.*(X-LC)/LW ]**2), with integral PI*LN*LW/2.
MOdel SPLN #
Select a # -knot spline component.
The number of knots defaults to 2, which generates a straight line.
For unconstrained y values, the natural spline condition is imposed,
which sets y''= 0 at the boundaries. You may not extrapolate this
function outside the interval fitted.
It is possible to impose a periodic boundary condition on the spline
curve. To do this, constrain the y position of the last knot to be
the same as the first. When this constraint is detected, the program
automatically forces the first derivatives to match at the two
boundaries. For this case, you are allowed to access the function
outside the interval fitted. However, the function is assumed to be
periodic, with the period given by the difference in x between the
first and last knots.
For example, MOdel SPLN 5 will generate a 5-knot spline (10
parameters). The spline can be added to other models; thus
MOdel SPLN 5 GA would add a 5-knot spline to a gaussian. Hence,
the spline would model the `background' and the gaussian, a `line'.
It is possible for the x position of two knots to lie between two
adjacent data points. This results in a local c2 minimum as the
lower knot adjusts to fit data below it, the upper knot adjusts to
fit data above it. A strong wiggle occurs between the two knots but
since there are no data points there, c2 is not affected. In this
section, two knots very close to each other will be called a collision.
If collision occurs during a fit, then convergence will be very slow.
One method to greatly reduce the number of collisions is to first
fit the y locations before attempting to fit the x locations. By
default, the knots are evenly spaced in the x direction and are not
allowed to vary. For the first fit you should leave the x positions
frozen, although you can move the knots (using Newpar) to concentrate
them where the function is changing rapidly. Once a reasonable set
of y positions is determined you can then thaw the x positions and
re-fit. You should never thaw the end points: They determine the
range over which the spline is to be evaluated.
With the above recipe, collisions can still occur. The straight-forward
method to separate the knots is: Use Newpar to re-position the two
knots, freeze the x locations, and then re-fit. After this the knots
will sometimes stay separated when you thaw their positions and re-fit.
The trick is to force the knots far enough apart so that they will
not be attracted to the local minimum, but not so far apart as to grossly
distort the fit.
Sometimes two knots collide when you are trying to fit the data with
too few knots. This case can be easily tested for by increasing the
number of knots and re-fitting.
MOdel AKIM #
Select a # -knot Akima component.
An Akima component is very similar
to SPLN in that both use a cubic function to interpolate between
the knots. Akima's method does not introduce false extrema and
inflection points as does the cubic spline and therefore, is far
superior for data that show abrupt transitions.
Like SPLN two different boundary conditions are allowed. If the
last y value is unconstrained, then the code uses `virtual' knots
outside the boundaries to determine the function at the boundaries.
The locations of the virtual knots mirror the location of the knots
just inside the boundaries. If the y position of the last knot is
constrained to match the y position of the first knot then a periodic
boundary condition is imposed.
MOdel DEMO
Call the Fortran user-defined component. Chapter 6
describes how to create how to write a Fortran function that can
be linked in to PLT to replace the DEMO component.
MOdel $codfile
Call the user-defined COD (COmponent Definition) function found in
codfile.COD. Briefly, a COD function is a program written in a
Forth-like computer language. To understand COD, read the documentation
or help file for COD. A COD file can be added to any
combination of built-in components. For example, the model specified by
MOdel CONS LINR $TEST would calculate the sum of a constant term,
a linear term, and the value of the COD function contained in the
file TEST.COD.
At the present time only one COD function can be defined in a model,
although this function can be referenced more than once. If you wish
to combine two COD functions, you will need to write a third function
that combines the first two.
COD should be used for all simple components that cannot be expressed
by adding together the built-in components. Since a COD function
is interpreted, it will run slower than the user-defined component.
However, since COD is highly efficient and supports many mathematical
functions, it is expected that the interpreter will be good enough
for most purposes. For large numbers of points (>104) or models
that involve reading a disk file, the user is advised to write a Fortran
function using the user component.
Example:
: GAUS ! The file must contain a : followed by a dummy name
X ! Push current value of X onto the stack
X ! Push current value of X onto the stack
* ! Multiply the top two numbers on the stack to get X*X
P1 ! Push the value of parameter 1 onto the stack
* ! Multiply to get P1*X*X
NEG ! Negate the number on the top of the stack (-P1*X*X)
EXP ! Calculate EXP of -P1*X*X
P2 ! Push the value of parameter 2 onto the stack
* ! Multiply to get P2*EXP(-P1*X*X)
; ! The function must end with a ; character
This simple COD function (GAUS.COD) contains two parameters and
calculates the value of P2*EXP(-P1*X*X). It could be written much
more concisely as
: GAUS X X * P1 * NEG EXP P2 * ;
Next: Newpar
Up: PLT Command Summary
Previous: MArker
Web Page Maintained by: Dr. Lawrence E. Brown elwin@redshift.gsfc.nasa.gov
|