Module GseosHistogram
Previous  Top  Next

The histogram module allows you to easily histogram/classify your data. A histogram decoder is a specialized Decoder. There are two types of histogram decoders a 1D histogram decoder and a 2D histogram decoder. The purpose of a histogram decoder is to classify or histogram the source data. This can be used to display a spectrum of the distribution of events. The picture below depicts a sample of a 1D histogram.

histo4


The histogram decoders take input array items and generate an output block containing the histogrammed data.
In the 1D case a single value will be mapped to a destination array. If we for example get a value of 5 in our source data we would increment the destination item at index position 5 by one. In the 2D case a pair of
source values (x,y) will be mapped to a destination entry in the following way:

Destination Position = x + Width * y

where Width is the width of the matrix. Since in GSEOS all array items are vectors and not two-dimensional matrixes the Width is used to determine the x-dimension of the matrix. The destination array item can then in turn be displayed as a two dimensional bitmap with various color mappings to indicate the distribution of 'intensity' in the two dimensional space.

Autoscaling
The histogram decoders also allow for automatic rescaling of the histogram. If the maximum value in the histogram reaches a certain limit the histogram will be scaled down by simply dividing all values in the histogram by 2. This process is repeated over every time we reach the upper limit. The YScale item in the destination block will be set to the current scale value. This way you can determine what the absolute values for the histogram are (approximately only since we lose resolution every time we scale own).

Configuration
The histogram decoders can be configured with the following parameters most of which can be specified in the according constructor:

1D:   Name
   strSourceXItem
   strDestinationItem
YMax
   ClipLeft
   ClipRight
strEventCntItem
bAutoScaleMode
bLogMode
strCalcMode

2D:   Name
   strSourceXItem
   strSourceYItem
   strDestinationItem
HorzDimension
   ClipLeft
   ClipRight
   ClipBottom
   ClipTop
   Range
   EventCnt

The strSourceXItem and strSourceYItem parameters specify the item names of the source items. In the case of a 1D histogram only the X source is needed. For the 2D histogram a pair of values is required. The strDestinationItem parameter specifies the destination item name and must be an array item.

Be aware that the histograms require according memory. Especially for the 2D histograms if you chose for example (0, 1024, 0, 1024) as the dimensions of your destination histogram the internal histogram buffer alone will occupy 1024*1024*4 byte = 4MB of memory!!!

The Left, Right, Bottom, and Top parameters specify the dimensions of the clipping area. For the 1D histogram this is a simple interval for the 2D histgram this is a rectangle. The source values are only mapped into the destination item if they fall within the clipping area. E.g. if the clipping interval is Left=6, Right=12 a source value of 5 would be discarded, a source value of 7 would cause to increment the destination item at position 7-6 = 1.
Therefore the clipping area gives you the opportunity to map a certain area of your source data onto the destination. You could also think of it as a kind of zoom in/zoom out feature. The Right and Top values are not included in the range. E.g.: If you specify 0 for Left and 256 for Right the indices from 0..255 will be covered.

The YMax parameter allows you to set a maximum value for the histogram. If auto scaling is turned on the entire histogram is scaled down by a factor of 2 if any histogram bin reaches the YMax value. If auto scaling is off the destination item is simply not incremented once it reaches YMax.

The strEventCntItem parameter is the name of a data item that is read at runtime to determine the number of input values to read. By default, that is if no strEventCntItem item is specified all values in the strSourceXItem item will be added to the histogram. This may not always be the appropriate behavior. In case not all values are valid or the number of valid values changes you may want to use the strEventCntItem item. It is assumed that the strEventCntItem will hold the currently valid number of items in the strSourceXItem (and strSourceYItem in the 2D case) data item. Only these items contribute to the histogram.

The histogram decoder exports status data to the destination block. If you define the following elements in your destination block they will be populated by the histogram decoder:


EventCnt:
The total number of histogram events.
YMax:
The configured maximum Y value.
YScale:
The current Y scale factor.
AutoScaleMode:
Flag that indicates if auto scale mode is on.
LogMode:
Flag that indicates if log mode is on.
CalcMode:
0: Min, use the minimum value, 1: Max, use the maximum value, 2: Mean, use the mean of all values.
Zoom:
The current zoom factor in percent.
HorzOffset:
The current horizontal offset.
VertOffset:
The current vertical offset (2D histograms only).
Left:
The left position of the histogram.
Right:
The right position of the histogram.
Top:
The top position of the histogram (2D histograms only).
Bottom:
The bottom position of the histogram (2D histograms only).



Here a sample block definition for a destination block:

Histo1Dest
{
  EventCount    ,,, 32;
  YMax          ,,, 32;
  Zoom          ,,, 16;
  HorzOffset    ,,, 32;
  VertOffset    ,,, 32;
  Left          ,,, 32;
  Right         ,,, 32;
  Top           ,,, 32;
  Bottom        ,,, 32;
  LogMode       ,,, 16;
  CalcMode      ,,, 16;
  AutoScaleMode ,,, 16;
  YScale        ,,, 32;
  Data[200]     ,,, 16;
}


For more information please refer to the 1D and 2D histogram decoders:

·1D Histogram  
·2D Histogram