next up previous
Next: Restrictions on Mapped Access
Up: ACCESSING ARRAY COMPONENTS
Previous: Accessing Complex Values

Mapping the Variance Component as Standard Deviations   

The values held in an NDF's variance component are estimates of the mean square error expected on the corresponding values stored in its data component. This particular method of storage is chosen because it allows more efficient computation in the common situation where errors from two or more sources are to be combined. For instance, errors are usually combined by adding the contribution from each source in quadrature, i.e. if $\sigma_{A}$ and $\sigma_{B}$ are the errors associated with two independent values, then the error $\sigma$ in their sum is given by:

$\sigma = \sqrt{ \sigma_{A}^{2} + \sigma_{B}^{2} }$

The corresponding variance values therefore combine by simple addition:

V = VA + VB

and this is a considerably faster computation to perform.

Nevertheless, the variance values stored in an NDF are unsuitable for direct use for such purposes as plotting error bars on graphs. In this case the square root of each variance estimate must be taken, in order to obtain an estimate of the standard deviation, which is the value normally employed. This can be done explicitly, but it is also possible to instruct the NDF_MAP routine to provide an array of standard deviation values directly by specifying a special component name of `Error'. For example:

      CALL NDF_MAP( INDF, 'Error', '_REAL', 'READ', PNTR, EL, STATUS )

would return a pointer to a mapped array of single-precision standard deviation (or ``error'') values, obtained by taking the square root of the values stored in the NDF's variance component. These values should later be unmapped in the usual way, either implicitly, or by an explicit call to NDF_UNMAP, thus:

      CALL NDF_UNMAP( INDF, 'Variance', STATUS )

If a mapping mode of `UPDATE' or `WRITE' had been specified, then the mapped values would be squared before being written back to the NDF's variance component. (Note a component name of `Variance' should be specified when unmapping an array of standard deviation values; it is only during the mapping operation that the name `Error' may be used.)

The same procedure may also be used when obtaining mapped access to complex values using the routine NDF_MAPZ[*]). In this case, the process of taking the square root (or of squaring during the subsequent unmapping operation) will be applied separately to the real (i.e. non-imaginary) and imaginary parts.



next up previous
Next: Restrictions on Mapped Access
Up: ACCESSING ARRAY COMPONENTS
Previous: Accessing Complex Values


Starlink User Note 33
R.F. Warren-Smith
11th January 2000
E-mail:rfws@star.rl.ac.uk

Copyright © 2000 Council for the Central Laboratory of the Research Councils