#!/bin/env python __all__ = ["tsm_plot"] from sardana.macroserver.macro import * import os, sys, time import numpy as np import HasyUtils import random class tsm_plot( Macro): ”' demonstrate the HasyUtils.toSardanaMonitor() from a Macro ”' param_def = [] result_def = [] def run( self): if not HasyUtils.isSardanaMonitorAlive(): self.output( "tsm_plot: SardanaMonitor is not alive") return MAX = 100 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)] hsh = { 'putData': {'title': "Important Data", 'symbols': { 'file_name_': 'whatever.fio', 'scan_dir': '/tmp', 'scan_id': 12345, 'scan_date': HasyUtils.getDateTime(), 'scan_cmd': "ascan exp_dmy01 0 1 10 0.1", }, 'columns': [ { 'name': "d1_mot01", 'data' : pos}, { 'name': "d1_c01", 'data' : d1}, { 'name': "d1_c02", 'data' : d2}, ]}} smNode = "haso107d1" hsh = HasyUtils.toSardanaMonitor( hsh, node = smNode) if hsh[ 'result'].upper() != 'DONE': self.output( "tsm_plot: putData caused an error") return return