SPECPR Users’ Manual                                            Page 8-f18.1

F18:  Block Averages and Statistics                         Alias: bloc[kav]
Special function f18 averages data blocks into single data channels and
computes the statistics (standard deviation of the mean) for each
block.  The size of the block is defined by the user.  The blocks
can be a number of channels, or a range from the
wavelength set.  The blocks can be overlapping, as in Nyquist
sampling, or contiguous (half Nyquist sampling).
To start f18, you must supply a data set from math operations.  For
example, from math, type:


As in most specpr routines, when you first enter f18, the title of
the current data set being operated on is displayed along with the
wavelength set in use and the number of channels.  You may change
the wavelength set in use at this point by typing in the new
wavelength set file ID(upper case letter)and the record number.  If
you do not wish to change the wavelength set, press return.
Next you will be asked if you want the blocks defined as channels or
wavelengths.  Type:

              c    to define block in units of channels, or
              w    to define blocks in units of the wavelength set.

Now you are asked to enter the block size. If in channel mode, enter the number of channels to be averaged in each block. If in wavelength mode, enter the wavelength range in the same units as your wavelength set. For example, if you have a wavelength set going from 0.3 to 2.5 μm and you want blocks of 0.1 μm, enter 0.1 (be sure you are in wavelength mode). The block size must be less than or equal to the number of channels in channel mode, or less than or equal to the upper end of the wavelength range. The block always starts at 0 and in includes the upper end of the block. For example, in channel mode a block size of 5 will include channels 1, 2, 3, 4, and 5. In wavelength mode, a block size of 0.1 will include all channels whose wavelengths fall from 0.00 to 0.10. Next you are asked for half or full Nyquist sampling. Enter

              h    for half Nyquist sampling, or
              f    for full Nyquist sampling.

Say the block size is 6 and you select full Nyquist sampling. The input to each block would be as follows:

              Input channels               Output channel
              (1+2+3+4+5+6)/6                    1
              (4+5+6+7+8+9)/6                    2
              (7+8+9+10+11+12)/6                 3
              (10+11+12+13+14+15)                4
              (13+14+15+16+17+18)/6              5

However, for half Nyquist sampling, the input would be:

              Input channels               Output channel
              (1+2+3+4+5+6)/6                    1
              (7+8+9+10+11+12)/6                 2
              (13+14+15+16+17+18)/6              3

The average of a block j is computed from the equation


                          Σ  xi
                    xj = ———————————————
                          (n2 - n1 + 1)

where (n1 - n2 +1) = N if n2 is less than or equal to the number of channels. If errors have been included, the standard deviation is calculated by the following

                          ╭  n2     ╮ ½
                          │          │
                          ┥  Σ  σi2 ┝
                          │ i=n1     │
                          ╰         ╯
                    ‾j = ——————————————
                         (n2 - n1 + 1)

where σj is the new standard deviation. If the errors have not been read in, the following equation is used:

                          ╭  n2   (xj - ‾j)2   ╮
                          │                     │
                          ┥  S   ————————————— ┝
                          │ i=n1 (n2 - n1 + 1)  │
                          ╰                    ╯
                    ‾j = ———————————————————————,
                              (n2 - n1 + 1)½

which computes the standard deviation of the mean.