The flexible putData-gqes interface

The putData-columns interface is very simple but has very limited capabilities. Below you find an example for putData-gqes which is more flexibel, in particular it is demonstrated how 2 plots are displayed in the same frame. The restriction that data have to have the same length is dropped.

import HasyUtils, Spectra
import random

def main():
    if not HasyUtils.isSardanaMonitorAlive():
        print "SardanaMonitor is not alive"
        return
    MAX = 10
    pos = [float(n)/MAX for n in range( MAX)]
    d1 = [random.random() for n in range( MAX)]
    d2 = [random.random() for n in range( MAX)]
    #
    # the third gqe has a different length
    #
    pos3 = [float(n)/MAX for n in range( MAX + 10)]
    d3 = [random.random() for n in range( MAX + 10)]
    gqeList = []
    #
    # at: (2,1,1) the first position in a 2 x 1 matrix
    #
    gqeList.append( { "name": "d1_c01", "x" : pos, "y": d1, "at": "(2,1,1)", 
                     "xlabel":"Position", "ylabel": "Data"})
    #
    # primitive: 0 - line, 1 - marker
    # type: line/marker types
    # colour: 1 - black, 2 - red, 3 - green, 4 - blue, etc.
    # overlay: d1_c02 is displayed in the frame of d1_c01
    #
    gqeList.append( { "name": "d1_c02", "x" : pos, "y": d2, "at": "(2,1,1)", 
                      "overlay": "d1_c01", "colour": 4, "primitive": 1, "type": 3} )
    gqeList.append({ "name": "d1_c03", "x" : pos3, "y": d3, "at": "(2,1,2)", 
                     "colour": 3} )
    hsh = { "putData":  
               {"title": "Example with overlay",  
                "gqes": gqeList}}

    hsh = HasyUtils.toSardanaMonitor( hsh)
    HasyUtils.dct_print( hsh) 
    if hsh[ 'result'].upper() != 'DONE':
        print "error"
        return  

main()

Figure 7.29: putData-gqes interface
Image tsm_withOverlay