toPyspMonitor()

To find the information about toPyspMonitor():

 
In [1]: import PySpectra
In [2]: PySpectra.toPyspMonitor?
In [3]: PySpectra.toPyspLocal?

The commands above should produce the information which is up-to-date. Below you find the output of toPyspMonitor? and toPyspLocal? as from April 23, 2020:

In [3]: PySpectra.toPyspMonitor?

    Send a dictionary to the pyspMonitor process via ZMQ. 
    pyspMonitor processes the dictionary by calling PySpectra.toPyspLocal()

    testAlive == True: 
        it is checked whether a pyspMonitor process responds to 
        the { 'isAlive': True} dictionary. 
          if not, pyspMonitor is launched

    Example: 
      ret = PySpectra.toPyspMonitor( {'command': ['delete', 'cls', 'create s1', 'display']})
      if ret[ 'result'] != 'done': 
          print( "error" % ret[ 'result'])

In [4]: PySpectra.toPyspLocal?

    toPyspLocal executes dictionaries which are received 
      - from toPyspMonitor()
      - from a Queue, from pyspDoor
      - from an application directly, e.g. to simulate the toPyspMonitor interface

       Command, see PySpectra.ipython.ifc?
         {'command': ['delete']}
           delete all internal data

         {'command': ['cls']}
           clear the screen

         {'command': ['delete', 'cls']}
           deletes all internal data and clears the screen

         {'command': ['display']}
           display all GQEs

         { 'command': ['setArrowCurrent sig_gen position 1.234']}
         { 'command': ['setArrowCurrent sig_gen show']}
         { 'command': ['setArrowCurrent sig_gen hide']}
           handle the arrow pointing to the current position. sig_gen is
           the Scan containing data from the SignalCounter (MS env. variable)

         { 'command': ['setArrowSetPoint sig_gen position 1.234']}
         { 'command': ['setArrowSetPoint sig_gen show']}
         { 'command': ['setArrowSetPoint sig_gen hide']}
           handle the arrow pointing to the setpoint

         { 'command': ['setArrowMisc sig_gen position 1.234']}
         { 'command': ['setArrowMisc sig_gen show']}
         { 'command': ['setArrowMisc sig_gen hide']}
           handle the arrow pointing to a position defined e.g. by mvsa

         {'command': [u'setTitle "ascan exp_dmy01 0.0 1.0 3 0.2"']}
           set the title for the whole widget
         {'command': [u'setComment "tst_01366.fio, Wed Dec 18 10:02:09 2019"']}
           set the comment for the whole widget

         {'spock': [ 'umv eh_mot66 51']}

       Misc:
         {'isAlive': True}
           return values:
             { 'result': 'done'}
             { 'result': 'notAlive'}

         {'getDoorState': True}
           returns:
             { 'result': 'ON'}

       Scan, see PySpectra.Scan?
         {'Scan': {'name': 'eh_c01', 'xMax': 1.0, 'autoscaleX': False, 'lineColor': 'red', 'xMin': 0.0, 'nPts': 6}}
           create an empty scan. Notice, the inner dictionary is passed to the Scan constructor

         {'Scan': {'yMax': 2.0, 'symbol': '+', 'autoscaleY': False, 'autoscaleX': False, 
                   'xMax': 1.0, 'nPts': 24, 'symbolColor': 'red', 'name': 'MeshScan', 
                   'symbolSize': 5, 'lineColor': 'None', 'xMin': 0.0, 'yMin': 1.0}}
           create an empty scan setting more attributes.

         {'Scan': {'name': 'eh_mca01', 'flagMCA': True, 'lineColor': 'blue', 
                   'y': array([  0., ..., 35.,  30.]), 
                   'x': array([  0.0, ..., 2.047e+03]), 'reUse': True}}
           create an MCA scan, which is re-used

         {'command': ['setY eh_c01 0 71.41']}
           set a y-value of eh_c01, index 0

         {'command': ['setX eh_c01 0 0.0']}
           set a x-value of eh_c01, index 0

         {'command': ['setXY MeshScan 0 0.0 1.0']}
           set the x- and y-value by a single call, index is 0

         {'putData': { 'columns': [{'data': [0.0, ..., 0.96], 'name': 'eh_mot01'}, 
                                  {'data': [0.39623, ... 0.01250], 'name': 'eh_c01'}, 
                                  {'showGridY': False, 'symbolColor': 'blue', 'showGridX': False, 
                                   'name': 'eh_c02', 'yLog': False, 'symbol': '+', 
                                   'data': [0.1853, ... 0.611], 
                                   'xLog': False, 'symbolSize': 5}], 
                      'title': 'a title', 
                      'comment': 'a comment'}}
           The data are sent as a list of dictionaries containing columns. The first column 
           is the common x-axis. All columns have to have the same length. 
           In this example, the Scans eh_c01 and eh_c02 are created. The common x-axis is given by eh_mot01

         { 'putData': {'gqes': [ {'x': x, 'y': tan, 'name': 'tan'},
                                 {'x': x, 'y': cos, 'name': 'cos'},
                                 {'x': x, 'y': sin, 'name': 'sin', 
                                  'showGridY': False, 'symbolColor': 'blue', 'showGridX': True, 
                                  'yLog': False, 'symbol': '+', 
                                  'xLog': False, 'symbolSize':5}],
                       'title': 'a title', 
                       'comment': 'a comment'}}
           The data are sent as a list of dictionaries containg the x- and y-data and other
           parameters describing the Scans.

       Image, see PySPectra.Image?
         {'Image': {'name': 'MandelBrot', 
                    'height': 5, 'width': 5, 
                    'xMax': -0.5, 'xMin': -2.0, 
                    'yMin': 0, 'yMax': 1.5}}
           create an empty image

         { 'Image': { 'name': "MandelBrot", 'data': data, 
                      'xMin': xmin, 'xMax': xmax, 
                      'yMin': ymin, 'yMax': ymax}})
           pass the entire image data

         { 'putData': { 'images': [{'name': "Mandelbrot", 'data': data,
                                    'xMin': xmin, 'xMax': xmax, 
                                    'yMin': ymin, 'yMax': ymax}]}}
           data is a numpy array, e.g.: data = np.ndarray( (width, height), np.float64)

         {'command': ['setPixelImage Mandelbrot 1 3 200']}
           set a pixel value. the position is specified by indices

         {'command': ['setPixelWorld Mandelbrot 0.5 1.5 200']}
           set a pixel value. the position is specified by world coordinate

         Text
         {'command': ['setText MeshScan comment string "Sweep: 1/4" x 0.05 y 0.95']}
           create a text GQE for the scan MeshScan, the name of the text is comment

       Retrieve data:
         {'getData': True}
           {'getData': {'EH_C02': {'y': [0.3183, ... 0.6510], 'x': [0.0, ... 0.959]}, 
                        'EH_C01': {'y': [0.0234, ... 0.4918], 'x': [0.0, ... 0.959]}}, 
            'result': 'done'}



Subsections

2020-07-03