Histogram Data
Previous  Top  Next

This chapter demonstrates the use of the histogram decoder and displays the TLM data as a histogram. A histogram decoder classifies the input data and maps in into an output block. Let's assume the first 100 items of the TLM block contain event data that you want to histogram and display the distribution as a two dimensional spectrum.

This task involves various steps:

·Create the histogram block definition  
·Setup the histogram decoder  
·Setup the histogram display  

·At first we have to define the destination block. The event values of the TLM block can be in the range [0..255]. We create a TLMHisto block that will take the histogram data and consists of one array item with dimension 256. This way each source value gets mapped onto a destination slot.  

TLMHisto
{
  Histo[128] 0 ,,, 16;
}

The next step is to create the histogram decoder. We can either write a Python script TLMHisto.py which we then load or we can directly type it in the console window. If you don't have a console window open select View|Console from the main menu or press F9. This will open the console window. The application will look like this:

mainwindowwithconsole

To create the histogram decoder we type into the console:

>>> import GseosHistogram
>>> oHisto=GseosHistogram.THistogram1D('TLM Event Spectrum', 'TLM.Data', 'TLMHisto.Histo', 0, 256, 100)

This creates the histogram decoder and starts it. We hold on to a reference with the oHisto variable. This allows us to call various functions on the histogram decoder later. Now lets check out the decoder in the GSEOS Explorer:

explorerhistogram

You can see the 'TLM Event Spectrum' histogram in the decoders node. The checkmark indicates that the decoder is running (as you can also tell from the count). The GSEOS Explorer is a useful tool to get a quick system overview and to manage your block definitions, decoders, monitors, histograms, network connections, etc.

As the last step we have to create the spectrum display. We create a new screen that displays the TLMHisto.Histo item.

screenhistogramhex

Lets change the display format to 'Bargraph' to display the histogram as a spectrum and not just as plain hex data. Right click on the data item and select 'Data Item'. This pops up the Data Item dialog, choose 'Bargraph' and set the width to 100%. We also have to adjust the range property of the Data Item. By default the range is [0..1]. We want to display a range from [0..1000]. Right click on the data item and select Range. This brings up the Range dialog. Select 1000 for the Y max value. Now a bargraph maps all values from 0 to 1000 into a graphical representation. If the value exceeds 1000 it is simply clipped. By now we have the following display:


screenhistogramupsidedown

One obvious flaw is that the histogram is upside down. All displays have a default orientation of right-handed 4th quadrant (which is what you usually use for a textual representation, that is left to right, top to bottom). For graphical representations we usually want to have the origin in the lower left corner which is the 1st quadrant. To change the orientation right click on the data item and select Orientation. This results in our final display:

screenhistogrambargraph