ScanInfo in hooks

The function HasyUtils.createScanInfo() returns a dictionary containing some useful information about the scan. Here is an example:

#!/usr/bin/env python

import HasyUtils
import PyTango
from sardana.macroserver.macro import *
import sardana.macroserver.macro as ms
#
# define detectorName and detectorRoot outside the Macros because they are used twice
#
detectorName = 'pilatus'
detectorRoot = "/home/someUser/data"

class gh_pre_scan(Macro):
    ”'
      ...
    ”'
    def run( self):
        self.output( "general_features.pre_scan hook")
        if not HasyUtils.isInMg( self, detectorName):
            self.output( "general_features.gh_pre_scan: %s not in the MG, DONE" % detectorName)
            return True

        if not HasyUtils.prepareDetectorAttrs( self, name = detectorName, rootDir = detectorRoot):
            self.output( "general_features.gh_pre_scan: prepareDetectors: returned error")
            return False
        #
        # createScanInfo() uses the command, e.g. dscan exp_dmy01 -0.005 0.005 10 0.1, 
        #   to fill the scanInfo dictionary. If the command parameter is not supplied the 
        #   function retrieves the command from the ScanHistory environment variable.
        #
        scanInfo = HasyUtils.createScanInfo( self.getParentMacro().getCommand())
        self.output( "scanInfo: %s" % repr( scanInfo))
        return True

The command

p99/door/haspp99.01 [3]: dscan exp_dmy01 -0.005 0.005 10 0.1

produces this output:

general_features.pre_scan hook
MsUtils.prepareDetectorAttrs: creating /home/someUser/data/tst_04118/pilatus (0777)
scanInfo: {'sampleTime': 0.1, 'serialno': 4118, 'intervals': 10, 
  'motors': [{'start': 0.995, 'stop': 1.005, 'name': 'exp_dmy01'}],
              'title': 'dscan exp_dmy01 -0.005 0.005 10 0.1'}

See also 8.15.4.