#!/usr/bin/env python3 # # this script some random data. # import random, time import PySpectra, HasyUtils def main(): (status, wasLaunched) = PySpectra.assertPyspMonitorRunning() MAX = 25 pos = [10.*float(n)/MAX for n in range( MAX)] rd = [random.random() for n in range( MAX)] ret = PySpectra.toPyspMonitor( { 'command': ["cls", "delete"]}) if ret[ 'result'].upper() != 'DONE': print( "error from pyspMonitor %s" % ret[ 'result']) return name = "TestScan" ret = PySpectra.toPyspMonitor( {'Scan': { 'name': name, 'x': pos, 'y': rd}}) ret = PySpectra.toPyspMonitor( { 'command': ["display"]}) print( "Press <space> to continue") while 1: key = HasyUtils.inkey() if key == 32: break time.sleep( 0.1) # # if the pyspMonitor was launched by this script, kill it. # if wasLaunched: hshRet = PySpectra.toPyspMonitor( { 'command': [ 'exit']}) return if __name__ == "__main__": main()