Example: send data as pairs of x- and y-columns

#!/usr/bin/env python
'''
the script sends 3 data structures, each with x- and y-column 
to the pyspMonitor and displays them.
'''

import PySpectra.zmqIfc as zmqIfc
import PySpectra.utils as utils
import numpy as np

def main():

    (status, wasLaunched) = PySpectra.assertPyspMonitorRunning()
    
    PySpectra.toPyspMonitor( { 'command': ['delete', 'cls']})

    MAX = 100
    x = np.linspace(0, 10, MAX)
    tan = np.tan( x)
    sin = np.sin( x)
    cos = np.cos( x)
    
    hsh = { 'putData': 
            {'gqes': 
             [ {'x': x, 'y': tan, 'name': 'tan'},
               {'x': x, 'y': sin, 'name': 'sin'},
               {'x': x, 'y': cos, 'name': 'cos',
                'showGridY': False, 'symbolColor': 'blue', 'showGridX': True, 
                'yLog': False, 'symbol': '+', 
                'xLog': False, 'symbolSize': 5}]}}

    PySpectra.toPyspMonitor( hsh)
    PySpectra.toPyspMonitor( { 'command': 'display'})

    utils.prtc() # press-return-to-continue
    
    #
    # if the pyspMonitor was launched by this script, kill it.
    #
    if wasLaunched:
        PySpectra.killPyspMonitor()
    
    return

if __name__ == "__main__":
    main()



2020-08-07