THistogram2D
Previous  Top  Next

THistogram2D(strName, strSrcHorzItem, strSrcVertItem, strDestItem, HorzDimension, [YMax], [Left], [Right], [Bottom], [Top], [strEventCntItem], [bAutoScaleMode=False], [strLogMode='Lin'], [strCalcMode='Mean'])

The Histogram2D constructor creates a new 2D histogram decoder. You have to specify a unique name, the source data items (one for the x- and one for the y-axis), the destination data item, and the horizontal dimension of the destination matrix. Optionally you can specify a clipping area, event count item, and some histogram modes.

ParameterDescription     
strNameThe unique name identifies the histogram decoder. This is the name you will see in the GSEOS Explorer.     
strSrcHorzItemThe strSrcHorzItem parameter specifies the item name of the horizontal source item. You have to specify the name of a data item here (string) and not the data item itself. If you specify an array item you can specify the number of elements to use for histogramming: Histo1Src.HorzData[:12]. If the number of elements to be evaluated is dynamic you can use the EventCntItem (see below).  
strSrcVertItemThe strSrcVertItem parameter specifies the item name of the vertical source item. You have to specify the name of a data item here (string) and not the data item itself. If you specify an array item you can specify the number of elements to use for histogramming: Histo1Src.VertData[2:4]. If the number of elements to be evaluated is dynamic you can use the EventCntItem (see below). The dimension of the horizontal and vertical source items should match.  
In most cases the horizontal and vertical items will be from the same source block. However, if you configure the items from different source blocks the histogram will only be evaluated on arrival of the horizontal source item block.  
strDestItem This parameter specifies the destination item name (note again that this is a string, e.g.: 'Histo.Data').  
HorzDimensionThe HorzDimension parameter specifies the dimension of the horizontal axis of the histogram matrix. The vertical dimension is determined by the length of the destination item divided by the horizontal dimension.  
YMaxThe maximum Y value any bin in the histogram can take on. If auto scaling is enabled the histogram will be scaled down, otherwise it will be clipped at the YMax value.  
ClipLeftThe ClipLeft and ClipRight parameters specify the horizontal dimensions of the clipping area. The horizontal 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 the destination item at position 7-Left = 7-6 = 1 to be updated (incremented). Therefore the clipping area allows you to map a certain area of your source data onto the destination. The ClipRight value is not included in the range. E.g.: If you specify 0 for ClipLeft and 256 for ClipRight the indices from 0..255 will be mapped. This parameter is optional, if not specified it will be set to 0.  
ClipRightSee ClipLeft. This parameter is optional, if not specified it will be set to the horizontal dimension as specified in HorzDimension.  
ClipBottomSimilar to ClipLeft but for the vertical dimension. The ClipBottom and ClipTop parameters specify the vertical dimensions of the clipping area. The vertical source values are only mapped into the destination item if they fall within the clipping area. E.g. if the clipping interval is Bottom=6, Top=12 a source value of 5 would be discarded, a source value of 7 would cause the destination item at vertical position 7-Bottom = 7-6 = 1 to be updated (incremented), given the horizontal dimension is within the horizontal clipping area. Therefore the clipping area allows you to map a certain area of your source data onto the destination. The ClipTop value is not included in the range. E.g.: If you specify 0 for ClipBottom and 256 for ClipTop the indices from 0..255 will be mapped. This parameter is optional, if not specified it will be set to 0.  
ClipTopSee ClipBottom. This parameter is optional, if not specified it will be set to the number of elements in the vertical direction, that is the lenght of the destination item divided by the horizontal dimension as configured with HorzDimension.  
strEventCntItemThe strEventCntItem parameter is the name of a data item that is read to determine the range of input values to use. By default, that is if no strEventCntItem item is specified all values in the strSrcHorzItem, strSrcVertItem items will be added to the histogram. This may not always be true. 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 yield the currently valid number of items in the source data items. Only these items contribute to the histogram. The strEventCntItem item does not have to be located in the source block but can be any item.  
bAutoScaleModeIf set the histogram will operate in auto scale mode. The YScale item indicates the current scaling factor.  
strLogModeCan be 'Log' or 'Lin'. If log mode the source items are computed using the log function. In linear mode the values are added up verbatim.  
strCalcModeIn the case that multiple source values map into one destination bin the calculation mode allows you to control how the mapping is performed. The available modes are: 'Min', the minimum value, 'Max', the maximum value, 'Mean', the mean value.  
 
 
Returns
The new histogram object.

Comments
The histogram is automatically registered for its source block (only the horizontal source block will trigger the histogram computation). There is no need to append it to the Decoder list of the source block like you have to do for an ordinary decoder.

Be aware that the items specified in the contstructor are names of data items and therefore strings. Do not pass in the item directly. The item would be resolved and therefore an integer would be passed in the constructor.

E.g.:   Use:   
GseosHistogram.THistogram2D('MyHisto', 'Block.HorzSource', ....)
   Do NOT use:
GseosHistogram.THistogram2D('MyHisto', Block.HorzSource, ....)

This applies to all items you specify in the constructor. In addition to the special histogram functionality you can use all the methods a normal decoder offers like bEnable to enable or disable the histogram.


Example
The following example defines a simple 2D histogram decoder which clips the input data to the area 0, 400, 0, 100.

GseosHistogram.THistogram2D('My2DHistogram',
                            'SrcBlock.SrcHorzItem[:20]',
                            'SrcBlock.SrcVertItem[:20]',
                            'DestBlock.DestItem',
                            400,
                            256,
                            0, 400, 0, 100)