putData-gqes

With this syntax the user has more control over the graphics output.

#
# this script communicates with Spectra directly
# the SardanaMonitor is not involved
#
import HasyUtils, Spectra
import random

def main():

    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.
    #
    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}}

    Spectra.putData( hsh[ 'putData'])

main()