Table of contents
CSPICE_WNSUMD summarizes the contents of a double precision window.
Given:
window the scalar SPICE window containing zero or more intervals.
help, window
STRUCT = cspice_celld(2*N)
You must create `window' as a window structure via a
cspice_celld call.
the call:
cspice_wnsumd, window, meas, avg, stddev, idxsml, idxlon
returns:
meas the double precision scalar total measure of the intervals in
the input window.
help, meas
DOUBLE = Scalar
This is just the sum of the measures of the individual
intervals.
avg the double precision scalar average measure of the intervals in
the input window.
help, avg
DOUBLE = Scalar
stddev the double precision scalar standard deviation of the measures
of the intervals in the input window.
help, stddev
DOUBLE = Scalar
idxsml,
idxlon the integer scalar indices of the left endpoint of,
respectively, the shortest and longest intervals in the data
contained in `window'.
help, idxsml
LONG = Scalar
help, idxlon
LONG = Scalar
The following algorithm describes the relation of
`idxsml' and `idxlon' to the window data:
data_start = window.data
data_end = data_start + window.card - 1
array = window.base[data_start:data_end]
The shortest interval:
[ array[idxsml], array[idxsml+1] ]
The longest interval:
[ array[idxlon], array[idxlon+1] ]
None.
Any numerical results shown for these examples may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Define an array representing a window with six intervals, and
calculate the summary for that window.
Example code begins here.
PRO wnsumd_ex1
;;
;; Create a cell containing a double precision 12-vector.
;;
win1 = cspice_celld( 12 )
;;
;; Define an array representing a window with six intervals.
;; The values in 'darray' have correct order for a
;; SPICE window.
;;
darray = [ [ 1.d, 3.], $
[ 7., 11.], $
[ 18., 18.], $
[ 23., 27.], $
[ 30., 69.], $
[ 72., 80.] ]
;;
;; Add the 'darray' data to the cell.
;;
count = size( darray, /n_elements)/2l
for i=0l, count -1 do begin
cspice_wninsd, darray[0,i], darray[1,i], win1
endfor
;;
;; Calculate the summary for `win1'.
;;
cspice_wnsumd, win1, $
meas, $
avg, $
stddev, $
idxsml, $
idxlon
;;
;; `idxsml' and `idxlon' refer to the indices of
;; the SPICE cell data array.
;;
intrvl_short= idxsml/2l
intrvl_long = idxlon/2l
print, 'Measure : ', meas
print, 'Average : ', avg
print, 'Standard Dev : ', stddev
print, 'Index shortest : ', idxsml
print, 'Index longest : ', idxlon
print, 'Interval shortest : ', intrvl_short
print, 'Interval longest : ', intrvl_long
data_start = win1.data
data_end = data_start + win1.card - 1
array = win1.base[data_start:data_end]
print, 'Shortest interval : ', [ array[idxsml], array[idxsml+1] ]
print, 'Longest interval : ', [ array[idxlon], array[idxlon+1] ]
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Measure : 57.000000
Average : 9.5000000
Standard Dev : 13.413302
Index shortest : 4
Index longest : 8
Interval shortest : 2
Interval longest : 4
Shortest interval : 18.000000 18.000000
Longest interval : 30.000000 69.000000
2) Let A contain the intervals
[ 1, 3 ] [ 7, 11 ] [ 23, 27 ]
Let B contain the singleton intervals
[ 2, 2 ] [ 9, 9 ] [ 27, 27 ]
The measures of A and B are
(3-1) + (11-7) + (27-23) = 10
and
(2-2) + (9-9) + (27-27) = 0
respectively. Each window has three intervals; thus, the average
measures of the windows are 10/3 and 0. The standard deviations
are
------------------------------------------
| 2 2 2
| (3-1) + (11-7) + (27-23) 2 1/2
| --------------------------- - (10/3) = (8/9)
| 3
\ |
\|
and 0. Neither window has one "shortest" interval or "longest"
interval; so the first ones found are returned: `idxsml' and
`idxlon' are 0 and 2 for A, 0 and 0 for B.
This routine provides a summary of the input window, consisting
of the following items:
- The measure of the window.
- The average and standard deviation of the measures
of the individual intervals in the window.
- The indices of the left endpoints of the shortest
and longest intervals in the window.
All of these quantities are zero if the window contains no
intervals.
1) If `window' has odd cardinality, the error
SPICE(INVALIDCARDINALITY) is signaled by a routine in the call
tree of this routine.
2) Left endpoints of stored intervals must be strictly greater
than preceding right endpoints. Right endpoints must be
greater than or equal to corresponding left endpoints.
Invalid window data are not diagnosed by this routine and may
lead to unpredictable results.
3) If the input argument `window' is undefined, an error is
signaled by the IDL error handling system.
4) If the input argument `window' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
5) If any of the output arguments, `meas', `avg', `stddev',
`idxsml' or `idxlon', is not a named variable, an error is
signaled by the Icy interface.
None.
None.
ICY.REQ
CELLS.REQ
WINDOWS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 17-JUN-2021 (JDR)
Changed output argument names "shortest" and "longest" to
"idxsml" and "idxlon" for consistency with other routines.
Edited the header to comply with NAIF standard. Added
example's problem statement, and a second example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.2, 04-DEC-2008 (EDW)
Edited header to add information to the argument descriptions and
the code example.
-Icy Version 1.0.1, 12-SEP-2006 (EDW)
Correct Required Reading citation cell.req to cells.req.
-Icy Version 1.0.0, 08-AUG-2004 (EDW)
summary of a d.p. window
|