Evaluates mathematical expressions applied to NDF data structures
"(IA-IB$+$2)$\ast $PX"
.
In this expression, input NDFs are denoted by the variables IA, IB, …IZ, while
constants may either be given literally or represented by the variables PA, PB, …PZ.
Values for those NDFs and constants which appear in the expression will be requested
via the application’s parameter of the same name.
Fortran-77 syntax is used for specifying the expression, which may contain the usual intrinsic functions, plus a few extra ones. An appendix in SUN/61 gives a full description of the syntax used and an up to date list of the functions available. The expression may be up to 132 characters long and is case insensitive.
PA$\ast $ASIND(FA/PA)$\ast $XA/FA
SQRT(XA$\ast $XA$+$XB$\ast $XB)
10.1
where the parameter name is to the left of $>$ and its value is to the right of the $>$.
"SQRT(IB$+$IA)"
,
then the Parameters IA and IB would be used (in this order) to obtain the two
input NDF data structures. !
and there is no input NDF referenced in the expression.
The number of values required is the number of pixel co-ordinate axes in the
expression. !
) is given the
bounds are obtained via Parameters LBOUND and UBOUND, and the data type through
Parameter TYPE. [!]
"PT$\ast $SIN(IA/PS)"
,
then the Parameters PS and PT (in this order) would be used to obtain numerical values
for substitution into the expression at the appropriate points.
These parameters are particularly useful for supplying the values of constants when
writing procedures, where the constant may be determined by a command-language variable,
or when the constant is stored in a data structure such as a global parameter. In other
cases, constants should normally be given literally as part of the expression, as in
"IZ$\ast $$\ast $2.77"
.
TRUE
, then each input data array will be perturbed once, in the positive
direction only. If QUICK is set to FALSE
, then each will be perturbed twice, in the
positive and negative directions, and the maximum resultant output perturbation
will be used to calculate the output variance. The former approach (the normal
default) executes more quickly, but the latter is likely to be more accurate
in cases where the function being evaluated is highly non-linear, and/or the
errors on the data are large. This parameter is ignored if the expression does
not contain a token to at least one input NDF structure. [TRUE]
[!]
!
and no input NDFs are
referenced in the expression. It must be one either "_DOUBLE"
or "_REAL"
. !
and there is no
input NDF referenced in the expression. These must not be smaller than the
corresponding LBOUND. The number of values required is the number of pixel
co-ordinate axes in the expression. !
. [FALSE]
"IB$+$SQRT(VB$+$VA)"
,
then the Parameters VA and IB would be used (in this order) to obtain the two input
NDF data structures. The first would use just the variance array, whilst the
second would read both data and variance arrays. TRUE
(the normal default), then output
variance values will be calculated if any of the input NDFs contain variance
information. Any which do not are regarded as having zero variance. Variance
calculations will normally be omitted only if none of the input NDFs contain variance
information. However, if VARIANCE is set to FALSE
, then calculation of output
variance values will be disabled under all circumstances, with a consequent
saving in execution time. This parameter is ignored if the expression does not
contain at least one token to an input NDF structure. [TRUE]
"ia-1"
is evaluated to subtract 1
from each pixel of the input NDF referred to as IA, whose values reside in
the data structure dat1. The result is written to the NDF structure dat2. "(ia-ib)/ic"
is evaluated to remove a background from an image and to divide it by a
flat-field. All the images are held in NDF data structures, the input image being
obtained from the data structure data, the background image from back and the
flat-field from flat. The result is written to the NDF structure result. The data
units are unchanged and are therefore propagated to the output NDF. "-2.5$\ast $log10(ii)$+$25.7"
is evaluated to convert intensity measurements into magnitudes, including a zero point.
Token II represents the input measurements held in the NDF structure file1. The
result is written to the NDF structure file2. If file1 contains variance values,
then corresponding variance values will also be calculated for file2. "pa$\ast $exp(ia$+$pb)"
is evaluated with a value of 13.7
for the constant PB, and output is written to the NDF
structure outfile. The input NDF structure to be used for token IA and the
value of the other numerical constant PA will be prompted for. NOVARIANCE
has
been specified so that output variance values will not be calculated. "mod(XA,32)$+$mod(XB,64)"
is evaluated, and output is written to the NDF structure outfile. The output NDF
inherits the shape, bounds, and other properties (except the variance) of the NDF
called comwest. The data type of outfile is _REAL unless comwest has type _DOUBLE. XA
and XB represent the pixel co-ordinates along the x and y axes respectively. "xf$\ast $xf$+$0$\ast $xa"
is evaluated, and output is written to the NDF structure ord2. The
output NDF has data type _REAL, is two-dimensional with bounds
$-$20:20, 10:50.
The XA is needed to indicate that XF represents pixel co-ordinates along the y axis. "xa/max(1,xb)$+$sqrt(va)"
is evaluated, and output is written to the NDF structure ord2. Token VA represents the
input variance array held in the NDF structure fuzz. The output NDF inherits
the shape, bounds, and other properties of fuzz. The title of ord2 is "Fuzz
correction"
. The data type of ord2 is _REAL unless fuzz has type _DOUBLE. XA and XB
represent the pixel co-ordinates along the x and y axes respectively. The alphabetically first input NDF is regarded as the primary input dataset. NDF components whose values are not changed by this application will be propagated from this NDF to the output. The same propagation rules apply to the LIKE template NDF, except that the output NDF does have inherit any variance information.
There are additional tokens which can appear in the expression.
The set of 7 tokens named CA, CB, …CG is used to obtain the data co-ordinates
from the primary input NDF data structure. Any of the 7 parameters may appear
in the expression. The order defines which axis is which, so for example,
"2$\ast $CF$+$CB$\ast $CB"
means the first-axis data co-ordinates squared, plus twice the co-ordinates along the
second axis. There must be at least one input NDF in the expression to use the CA-CG
tokens, and it must have dimensionality of at least the number of CA-CG tokens
given.
The set of 7 tokens named XA, XB, …XG is used to obtain the pixel co-ordinates
from the primary input NDF data structure. Any of the 7 parameters may appear
in the expression. The order defines which axis is which, so for example,
"SQRT(XE)$+$XC"
means the first-axis pixel co-ordinates plus the square root of the co-ordinates along
the second axis. Here no input NDF need be supplied. In this case the dimensionality of
the output NDF is equal to the number of XA-XG tokens in the expression. However, if
there is at least one NDF in the expression, there should not be more XA-XG tokens than
the dimensionality of the output NDF (given as the intersection of the bounds of the
input NDFs).
If illegal arithmetic operations (e.g. division by zero, or square root of a negative number) are attempted, then a bad pixel will be generated as a result. (However, the infrastructure software that detects this currently does not work on OSF/1 systems, and therefore MATHS will crash in this circumstance.)
All arithmetic performed by this application is floating point. Single-precision will normally be used, but double-precision will be employed if any of the input NDF arrays has a numeric type of _DOUBLE.
The main value of the variance-estimation algorithm used here arises when the expression to be evaluated is too complicated, or too infrequently used, to justify the work of deriving a direct formula for the variance. It is also of value when the data errors are especially large, so that the linear approximation normally used in error analysis breaks down.
There is no variance processing when there are no tokens for input NDF structures.
If output variance values are being calculated and the QUICK parameter is set
to TRUE
, then the execution time will be multiplied by an approximate factor
($N+$1),
where n is the number of input NDFs which contain a VARIANCE component. If QUICK is set
to FALSE
, then the execution time will be multiplied by an approximate factor
($2N+$1).
This routine correctly processes the AXIS, DATA, QUALITY, VARIANCE, LABEL, TITLE, UNITS, WCS, and HISTORY components of the input NDFs. HISTORY and extensions are propagated from both the primary NDF and template NDF.
Processing of bad pixels and automatic quality masking are supported.
All non-complex numeric data types can be handled.
NDFs with any number of dimensions can be processed. The NDFs supplied as input need not all be the same shape.