Invoke mvsa from another Macro, use the result

The Macro testMvsa, see below, demonstrates how mvsa is called from another Macro. And it demonstrates also how the mvsa result is used.

#!/usr/bin/env python

from sardana.macroserver.macro import *
from sardana.macroserver.macro import macro
    
class testMvsa(Macro):
    """ test mvsa and demonstrate how to use the result """
    
    param_def = []
    
    def run(self):
        #
        self.execMacro( "ascan", "exp_dmy01", "0", "1", "25", "0.1")
        res = self.execMacro( "mvsa", "peak", "0")
        res = res.getResult()
        #
        # res can be, e.g.:
        #   status=False
        #   status=True,exp_dmy01=0.48
        #
        lst = res.split(',')
        dct = {}
        for elm in lst:
            key, value = elm.split( '=')
            dct[ key] = value
        self.output( "testMvsa: %s" % str( dct))
        #
        # -> testMvsa: {'status': 'True', 'exp_dmy01': '0.48'}
        #



2020-07-03