|
Next: Newpar Up: PLT Command Summary Previous: MArker
MOdel
MOdel ?List all built-in model components.
MOdel @filenameCause 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.
QDP/PLT currently supplies the model components defined below, which may be combined into multi-component models:
MOdel CONSSelect a model with a constant component: FNY=FNY+CO.
MOdel LINRSelect a model with a linear component: FNY=FNY+LI*X.
MOdel QUADSelect a model with a quadratic component: FNY=FNY+QU*X**2.
MOdel CUBISelect a model with a cubic component: FNY=FNY+CU*X**3.
MOdel X4Select a model with an x4 component: FNY=FNY+X4*X**4.
MOdel X5Select a model with an x5 component: FNY=FNY+X5*X**5.
MOdel POWRSelect a model with a power-law component: FNY=FNY+PN*X**IN.
MOdel SINSelect a model with a sinusoidal component: FNY=FNY+SN*SIN(2*PI*(X-PH)/PE).
MOdel GAUSSelect 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 EXPSelect a model with an exponential component: FNY=FNY+EN*EXP(-(X-EC)/EW).
MOdel AEXPSelect a model with a symmetric exponential component (e-|x| for all x): FNY=FNY+EN*EXP(-ABS(X-EC)/EW).
MOdel BURSSelect 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 SBURSelect 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 PEARSelect 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 WINDSelect a model with a window-function component: FNY=FNY+LE for T1<X<T2; and FNY=FNY+0 otherwise.
MOdel KINGSelect a model with a King-profile component: FNY=FNY+S0*(1.+(X/RC)**2)**(-IN).
MOdel LORESelect 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 DEMOCall 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 $codfileCall 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 ; characterThis 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 |