Access to Scan Data

#!/usr/bin/env python
# file name: /home/pXXuser/sardanaMacros/scanData.py 

"""the demo for a data scan"""

__all__ = ["scanData"]

from sardana.macroserver.macro import *
from sardana.macroserver.macro import macro

class scanData(Macro):
    """An example on how to look at the data after a scan has been executed"""
    
    param_def = [
       ['motor',      Type.Motor,   None, 'Motor to move'],
       ['start_pos',  Type.Float,   None, 'Scan start position'],
       ['final_pos',  Type.Float,   None, 'Scan final position'],
       ['nr_interv',  Type.Integer, None, 'Number of scan intervals'],
       ['integ_time', Type.Float,   None, 'Integration time']
    ]
    def run(self, motor, start_pos, final_pos, nr_interv, integ_time):

        ascan, pars = self.createMacro("ascan",motor, start_pos, final_pos, nr_interv, integ_time)
        self.runMacro(ascan)
        
        sigGen = []
        for elm in ascan.data.records:
            sigGen.append( elm.data['hasppXX:10000/expchan/vc_sig_gen/1'])
        self.output( "The Signal Generator output ")
        self.output( sigGen)
    #
    # to understand how the data is packed you may use the following print statements
    #
    # self.output( dir(ascan))
    # self.output( dir(ascan.data))
    # self.output( dir(ascan.data.records))
    # self.output( dir(ascan.data.records[0]))
    # self.output( ascan.data.records[0].data)
    #