Esempio n. 1
0
    def run(self, mode):
        #
        # the next line throws an exception, if SignalCounter does not exist,
        # so we don't have to check here
        #
        signalCounter = self.getEnv("SignalCounter")
        result = "status=False"
        #
        # createSaDct is restricted to certail scan types
        #
        scanType = self.getEnv("ScanHistory")[-1]['title'].split()[0]

        supportedScanTypes = [
            'ascan', 'dscan', 'a2scan', 'd2scan', 'a3scan', 'd3scan', 'hscan',
            'kscan', 'lscan', 'hklscan'
        ]
        if not scanType.lower() in supportedScanTypes:
            self.output("createSaDct: scanType %s not in %s" %
                        (scanType, repr(supportedScanTypes)))
            saDct = {
                'message':
                "createSaDct: scanType %s not in %s" %
                (scanType, repr(supportedScanTypes))
            }
            self.setEnv("saDct", saDct)
            return result

        self.scanInfo = HasyUtils.createScanInfo()
        if self.scanInfo is None:
            self.output("createSaDct: last scan aborted?")
            saDct = {'message': 'last scan aborted?'}
            self.setEnv("saDct", saDct)
            return result

        fileName = HasyUtils.getScanFileName()
        if fileName is None:
            self.output("createSaDct: failed to getScanFileName")
            saDct = {'message': 'failed to getScanFileName'}
            self.setEnv("saDct", saDct)
            return result

        #
        # data from pyspMonitor or SardanaMonitor
        #
        message = 'undefined'
        flagDataFound = False
        flagDataFromMonitor = True
        toMonitorFunc = None
        if HasyUtils.isPyspMonitorAlive():
            toMonitorFunc = HasyUtils.toPyspMonitor
        elif HasyUtils.isSardanaMonitorAlive():
            toMonitorFunc = HasyUtils.toSardanaMonitor
        #
        # data from monitor
        #
        if toMonitorFunc is not None:
            hsh = toMonitorFunc({'getData': True})
            if hsh['result'].upper() != 'DONE':
                self.output(
                    "createSaDct: monitor did not send DONE, instead: %s" %
                    hsh['result'])
                saDct = {
                    'message':
                    "createSaDct: monitor did not send DONE, instead: %s" %
                    hsh['result']
                }
                self.setEnv("saDct", saDct)
                return result
            if len(hsh['getData'].keys()) == 0:
                self.output("createSaDct: no data")
                saDct = {'message': "no data"}
                self.setEnv("saDct", saDct)
                return result
            if not signalCounter.upper() in hsh['getData']:
                self.output("createSaDct: column %s is missing (from SM)" %
                            signalCounter)
                saDct = {
                    'message':
                    "createSaDct: column %s is missing (from SM)" %
                    signalCounter
                }
                self.setEnv("saDct", saDct)
                return result
            flagDataFound = True
            dataX = hsh['getData'][signalCounter.upper()]['x']
            dataY = hsh['getData'][signalCounter.upper()]['y']
        #
        # data from file
        #
        else:
            flagDataFromMonitor = False
            a = HasyUtils.fioReader(fileName)

            for col in a.columns:
                if col.name == signalCounter:
                    dataX = col.x
                    dataY = col.y
                    flagDataFound = True
                    break

        if not flagDataFound:
            self.output("createSaDct: column %s not found in %s" %
                        (signalCounter, fileName))
            saDct = {
                'message':
                "createSaDct: column %s not found in %s" %
                (signalCounter, fileName)
            }
            self.setEnv("saDct", saDct)
            return result

        message, xpos, xpeak, xcms, xcen, npSig = HasyUtils.fastscananalysis(
            dataX, dataY, mode)

        if message != 'success':
            if toMonitorFunc is not None:
                self.output(
                    "createSaDct: failed to find the maximum, mode %s " % mode)
                self.output("             reason: %s" % (message))
                saDct = {
                    'message':
                    "createSaDct: failed to find the maximum reason: %s, mode %s"
                    % (message, mode)
                }
            else:
                self.output("createSaDct: failed to find the maximum for %s" %
                            (fileName))
                self.output("             reason %s" % (message))
                saDct = {
                    'message':
                    "createSaDct: failed to find the maximum for %s, reason %s, mode %s"
                    % (fileName, message, mode)
                }
            self.setEnv("saDct", saDct)
            return result

        saDct = {}
        saDct['fileName'] = fileName
        saDct['signalCounter'] = signalCounter
        saDct['flagDataFromMonitor'] = flagDataFromMonitor
        saDct['scanInfo'] = dict(self.scanInfo)
        saDct['message'] = message
        saDct['xData'] = dataX[:]
        saDct['yData'] = dataY[:]
        saDct['yMin'] = min(dataY)
        saDct['yMax'] = max(dataY)
        saDct['npSig'] = npSig
        saDct['npTotal'] = len(dataX)
        saDct['mode'] = mode
        saDct['xpos'] = float(xpos)
        if mode.lower() in ['dip', 'dipc', 'dipm']:
            saDct['xdip'] = float(xpeak)
            saDct['xdipm'] = float(xcms)
            saDct['xdipc'] = float(xcen)
        elif mode.lower() in ['dipssa', 'dipcssa', 'dipmssa']:
            saDct['xdipssa'] = float(xpeak)
            saDct['xdipmssa'] = float(xcms)
            saDct['xdipcssa'] = float(xcen)
        elif mode.lower() in ['step', 'stepc', 'stepm']:
            saDct['xstep'] = float(xpeak)
            saDct['xstepm'] = float(xcms)
            saDct['xstepc'] = float(xcen)
        elif mode.lower() in ['stepssa', 'stepcssa', 'stepmssa']:
            saDct['xstepssa'] = float(xpeak)
            saDct['xstepmssa'] = float(xcms)
            saDct['xstepcssa'] = float(xcen)
        elif mode.lower() in ['slit', 'slitc', 'slitm']:
            saDct['xslit'] = float(xpeak)
            saDct['xslitm'] = float(xcms)
            saDct['xslitc'] = float(xcen)
        elif mode.lower() in ['slitssa', 'slitcssa', 'slitmssa']:
            saDct['xslitssa'] = float(xpeak)
            saDct['xslitmssa'] = float(xcms)
            saDct['xslitcssa'] = float(xcen)
        elif mode.lower() in ['peak', 'cms', 'cen']:
            saDct['xpeak'] = float(xpeak)
            saDct['xcms'] = float(xcms)
            saDct['xcen'] = float(xcen)
        elif mode.lower() in ['peakssa', 'cmsssa', 'censsa']:
            saDct['xpeakssa'] = float(xpeak)
            saDct['xcmsssa'] = float(xcms)
            saDct['xcenssa'] = float(xcen)
        else:
            self.output("createSaDct: Mode %s wronmg" % mode)
            return
        #
        # scanInfo:
        # {
        #  motors: [{'start': 0.0, 'stop': 0.1, 'name': 'e6cctrl_l'}],
        #  serialno: 1230,
        #  title: 'hscan 0.0 0.1 20 0.1",
        # }
        #
        motorArr = self.scanInfo['motors']
        if len(motorArr) == 0:
            self.output("createSaDct: len( motorArr) == 0, something is wrong")
            saDct = {
                'message':
                "createSaDct: len( motorArr) == 0, something is wrong"
            }
            self.setEnv("saDct", saDct)
            return result
        #
        # xpos is the peak position w.r.t. the first motor.
        # the ratio r is used to calculate the target positions
        # of the other motors
        #
        r = (xpos - motorArr[0]['start']) / \
            (motorArr[0]['stop'] - motorArr[0]['start'])

        if len(motorArr) == 1:
            motorArr[0]['targetPos'] = xpos
        elif len(motorArr) == 2:
            motorArr[0]['targetPos'] = xpos
            motorArr[1]['targetPos'] = (motorArr[1]['stop'] - motorArr[1]
                                        ['start']) * r + motorArr[1]['start']
        elif len(motorArr) == 3:
            motorArr[0]['targetPos'] = xpos
            motorArr[1]['targetPos'] = (motorArr[1]['stop'] - motorArr[1]
                                        ['start']) * r + motorArr[1]['start']
            motorArr[2]['targetPos'] = (motorArr[2]['stop'] - motorArr[2]
                                        ['start']) * r + motorArr[2]['start']
        else:
            self.output("createSaDct: error, more than 3 motors")
            saDct = {'message': "createSaDct: more than 3 motors"}
            self.setEnv("saDct", saDct)
            return result

        saDct['motorArr'] = motorArr[:]

        self.setEnv("saDct", saDct)
        result = "status=True"
        return result
Esempio n. 2
0
    def run(self, mode, interactiveFlag):
        #
        # the next line throws an exception, if SignalCounter does not exist,
        # so we don't have to check here
        #
        signalCounter = self.getEnv("SignalCounter")
        result = "status=False"
        #
        # mvsa is restricted to certail scan types
        #
        scanType = self.getEnv("ScanHistory")[-1]['title'].split()[0]

        supportedScanTypes = [
            'ascan', 'dscan', 'a2scan', 'd2scan', 'a3scan', 'd3scan', 'hscan',
            'kscan', 'lscan', 'hklscan'
        ]
        if not scanType.lower() in supportedScanTypes:
            self.output("mvsa: scanType %s not in %s" %
                        (scanType, repr(supportedScanTypes)))
            return result

        self.scanInfo = HasyUtils.createScanInfo()
        if self.scanInfo is None:
            self.output("mvsa: last scan aborted?")
            return result

        fileName = HasyUtils.getScanFileName()
        if fileName is None:
            self.output("mvsa: fileName cannot be created")

        #
        # data from pyspMonitor or SardanaMonitor
        #
        message = 'undefined'
        flagDataFound = False
        flagDataFromMonitor = True
        toMonitorFunc = None
        isPysp = False
        if HasyUtils.isPyspMonitorAlive():
            toMonitorFunc = HasyUtils.toPyspMonitor
            isPysp = True
        elif HasyUtils.isSardanaMonitorAlive():
            toMonitorFunc = HasyUtils.toSardanaMonitor

        if toMonitorFunc is not None:
            hsh = toMonitorFunc({'getData': True})
            if hsh['result'].upper() != 'DONE':
                self.output("mvsa: monitor did not send DONE, instead: %s" %
                            hsh['result'])
                return result
            if len(hsh['getData'].keys()) == 0:
                self.output("mvsa: no data")
                return result
            if not signalCounter.upper() in hsh['getData']:
                self.output("mvsa: column %s is missing (from SM)" %
                            signalCounter)
                return result
            flagDataFound = True
            #
            # try-except because npSig has been added, 21.09.2020
            #
            try:
                message, xpos, xpeak, xcms, xcen, npSig = HasyUtils.fastscananalysis(
                    hsh['getData'][signalCounter.upper()]['x'],
                    hsh['getData'][signalCounter.upper()]['y'], mode)
            except:
                npSig = 0
            if mode.lower() == 'show':
                #
                # par-3: flag-non-background-subtraction
                #
                ssaDct = HasyUtils.ssa(
                    np.array(hsh['getData'][signalCounter.upper()]['x']),
                    np.array(hsh['getData'][signalCounter.upper()]['y']),
                    False)
        #
        # data from file
        #
        else:
            flagDataFromMonitor = False
            if fileName is None:
                self.output("mvsa.run: terminated ")
                return result
            a = HasyUtils.fioReader(fileName)

            for col in a.columns:
                if col.name == signalCounter:
                    #
                    # try-except because npSig has been added, 21.09.2020
                    #
                    try:
                        message, xpos, xpeak, xcms, xcen, npSig = HasyUtils.fastscananalysis(
                            col.x, col.y, mode)
                    except:
                        pass
                    if mode.lower() == 'show':
                        #
                        # par-3: flag-non-background-subtraction
                        #
                        ssaDct = HasyUtils.ssa(np.array(col.x),
                                               np.array(col.y), False)
                    flagDataFound = True
                    break

        if not flagDataFound:
            self.output("Column %s not found in %s" %
                        (signalCounter, fileName))
            for col in a.columns:
                self.output("%s" % col.name)
            return result

        if message != 'success':
            if toMonitorFunc is not None:
                self.output("mvsa: failed to find the maximum, mode %s" %
                            (mode))
                self.output("mvsa: fsa-reason %s" % (message))
            else:
                self.output(
                    "mvsa: failed to find the maximum for %s, mode %s" %
                    (fileName, mode))
                self.output("mvsa: fsa-reason %s" % (message))
            return result

        if mode.lower() == 'show':
            self.output("mvsa: file name: %s " % fileName)
            self.output("mvsa: dataFromSM %s" % repr(flagDataFromMonitor))
            self.output("mvsa: message '%s'" % (message))
            self.output("mvsa: xpos %g" % (xpos))
            self.output("mvsa: xpeak %g, cms %g cen  %g" % (xpeak, xcms, xcen))
            self.output("mvsa: status %d, reason %d" %
                        (ssaDct['status'], ssaDct['reason']))
            self.output("mvsa(SSA): xpeak %g, cms %g midp %g" %
                        (ssaDct['peak_x'], ssaDct['cms'], ssaDct['midpoint']))
            self.output("mvsa(SSA): l_back %g, r_back %g    " %
                        (ssaDct['l_back'], ssaDct['r_back']))
            return result
        #
        # scanInfo:
        # {
        #  motors: [{'start': 0.0, 'stop': 0.1, 'name': 'e6cctrl_l'}],
        #  serialno: 1230,
        #  title: 'hscan 0.0 0.1 20 0.1",
        # }
        #
        motorArr = self.scanInfo['motors']
        if len(motorArr) == 0:
            self.output("mvsa: len( motorArr) == 0, something is wrong")
            return result
        #
        # xpos is the peak position w.r.t. the first motor.
        # the ratio r is used to calculate the target positions
        # of the other motors
        #
        r = (xpos - motorArr[0]['start']) / \
            (motorArr[0]['stop'] - motorArr[0]['start'])

        if len(motorArr) == 1:
            motorArr[0]['targetPos'] = xpos
        elif len(motorArr) == 2:
            motorArr[0]['targetPos'] = xpos
            motorArr[1]['targetPos'] = (motorArr[1]['stop'] - motorArr[1]
                                        ['start']) * r + motorArr[1]['start']
        elif len(motorArr) == 3:
            motorArr[0]['targetPos'] = xpos
            motorArr[1]['targetPos'] = (motorArr[1]['stop'] - motorArr[1]
                                        ['start']) * r + motorArr[1]['start']
            motorArr[2]['targetPos'] = (motorArr[2]['stop'] - motorArr[2]
                                        ['start']) * r + motorArr[2]['start']
        else:
            return result
        #
        # prompt the user for confirmation, unless we have an uncoditional 'go'
        #
        if interactiveFlag == 1:
            if flagDataFromMonitor:
                self.output("Scan name: %s, data from SM" % fileName)
            else:
                self.output("File name: %s " % fileName)
            for elm in motorArr:
                p = PyTango.DeviceProxy(elm['name'])
                elm['proxy'] = p
                self.output("Move %s from %g to %g" %
                            (elm['name'], p.Position, elm['targetPos']))
            #
            # move the red arrow to the target position
            #
            if isPysp:
                toMonitorFunc({
                    'command': [
                        'display %s' % signalCounter,
                        'setArrowMisc %s position %g' %
                        (signalCounter, motorArr[0]['targetPos']),
                        'setArrowMisc %s show' % signalCounter
                    ]
                })
            answer = self.input("Exec move(s) [Y/N], def. 'N': ")
            if not (answer.lower() == "yes" or answer.lower() == "y"):
                self.output("Motor(s) not moved!")
                return result
        #
        # start the move. for hklscans it is important to use 'br'.
        # We must not start 'single' motors ( e.g.: e6cctrl_h) because
        # they are coupled.
        #
        if self.scanInfo['title'].find('hklscan') == 0:
            self.execMacro("br %g %g %g" %
                           (motorArr[0]['targetPos'], motorArr[1]['targetPos'],
                            motorArr[2]['targetPos']))
        else:
            for elm in (motorArr):
                p = PyTango.DeviceProxy(elm['name'])
                p.write_attribute("Position", elm['targetPos'])
        moving = True
        while moving:
            moving = False
            for elm in (motorArr):
                p = PyTango.DeviceProxy(elm['name'])
                if p.State() == PyTango.DevState.MOVING:
                    moving = True
                    break
            time.sleep(0.1)
            # if isPysp:
            #    toMonitorFunc( {'command': ['setArrowCurrent %s position %g' % \
            #                                ( signalCounter, motorArr[0][ 'proxy'].position)]})
        result = "status=True"
        #
        # hide the misc arrow
        #
        if isPysp:
            toMonitorFunc(
                {'command': ['setArrowMisc %s hide' % signalCounter]})
        for elm in (motorArr):
            p = PyTango.DeviceProxy(elm['name'])
            self.output("Motor %s is now at %g" % (elm['name'], p.Position))
            result = result + ",%s=%s" % (elm['name'], str(p.Position))

        # self.output( "mvsa returns %s" % result)
        return result
Esempio n. 3
0
    def testFSA( self):
        import HasyUtils

        xStep = [ 0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25,
                  3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.25, 5.5, 5.75, 6.0, 6.25, 6.5, 6.75,
                  7.0, 7.25, 7.5, 7.75, 8.0, 8.25, 8.5, 8.75, 9.0, 9.25, 9.5, 9.75, 10.0]

        yStep = [17.3459918372, 16.9313967417, 15.9651547963, 17.0004691241, 17.2492800434, 16.2623471323, 
                 15.3173025351, 16.759504276, 16.835155311, 16.0834967856, 17.5422444506, 16.7609800255, 
                 17.5440253556, 17.4648421542, 15.3980036417, 16.8288370033, 17.2743636309, 15.9754000962, 
                 14.5952468464, 14.9124907599, 14.4373360429, 14.0162194209, 13.765833739, 10.585919907, 
                 8.94777710199, 3.82560434687, -2.88635637185, -7.58604812865, -10.0714002366, -10.292867558, 
                 -10.1427735622, -10.63666237, -10.8981355703, -12.1906796316, -12.5912225387, -12.9529943226, 
                 -12.8533949897, -11.6929638382, -13.6873233405, -12.492016025, -12.7775621703]

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xStep, yStep, 'step')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 6.25, 3)
        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xStep, yStep, 'stepc')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 6.338455, 4)
        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xStep, yStep, 'stepm')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 5.49656, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xStep, yStep, 'stepssa')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 6.25, 3)
        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xStep, yStep, 'stepcssa')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 6.36096, 4)
        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xStep, yStep, 'stepmssa')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 6.3678, 4)

        xNoisyGauss = [ -5.0, -4.9, -4.8, -4.7, -4.6, -4.5, -4.4, -4.3, -4.2, -4.1, -4.0, -3.9, -3.8, -3.7,
                        -3.6, -3.5, -3.4, -3.3, -3.2, -3.1, -3.0, -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3,
                        -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9,
                        -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
                        0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3,
                        2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0,
                        4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0]

        yNoisyGauss = [0.0299147957547, .0168968636839,0.0145305261865,0.0306594896256,0.046335616252,0.00920741233747,0.00331724298224,
                       0.0203503190909,0.00123096854558,0.0318488276838,0.0173356288839,0.0273562413695,0.0178579590509,0.0143894191057,
                       .0255538820742,0.0310892181983,0.0150783725347,0.0191122737592,0.0487901438742,0.0175936469785,0.038682823054,
                       0.0372402539836,0.00921153292341,0.033558334358,0.0459610547927,0.0425260231937,0.0508766820508,0.0744637574022,
                       0.0720808295356,0.0878253201221,0.100399806851,0.0787165563411,0.0810949160214,0.132047325028,0.121007579296,
                       0.141921831357,0.190961819975,0.177911108281,0.198357909089,0.247150221877,0.265818718392,0.293427173383,
                       0.298179329616,0.35846981134,0.342494387515,0.352795882445,0.415925459061,0.388352917228,0.412810506375,
                       0.420419140245,0.411610324772,0.403501250267,0.435998838112,0.394319432585,0.378976465578,0.401841879225,
                       0.375207006284,0.359740415467,0.335141039704,0.291289150217,0.273846493299,0.241130108697,0.203804166004,
                       0.185181236659,0.182915802388,0.132053481055,0.14413810589,0.128147658334,0.0818619552257,0.0953306252548,
                       0.0981032703333,0.0675792502097,0.0446618078713,0.0358566328542,0.0459994339,0.0488523349758,0.0180195757756,
                       0.0106551224445,0.0445115136198,0.0190188486393,0.00833806392824,0.0362300534186,0.0398946125237,0.0191328682554,
                       0.00747828335653,0.0108836352256,0.0431935243891,0.0377918546986,0.0446413393484,0.0048989901671,0.017830714998,
                       0.0438412039254,0.029357193764,0.0175577280098,0.00604122347099,0.029937194221,0.000334614207852,0.0123354699032,
                       0.00833822923928,0.0151228204788,0.040092423947]


        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xNoisyGauss, yNoisyGauss, 'peak')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 0.2, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xNoisyGauss, yNoisyGauss, 'cen')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 0.011957415, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xNoisyGauss, yNoisyGauss, 'cms')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, -0.01465730, 4)


        data = [ "-2.4298828125 37681148972.8", 
                 "-2.4048828125 38401871477.4", 
                 "-2.3798828125 38288686270.4", 
                 "-2.3548828125 39185991728.4", 
                 "-2.3298828125 38456517187.0", 
                 "-2.3048828125 39194360929.6", 
                 "-2.2798828125 37675200637.4", 
                 "-2.2548828125 38996830621.8", 
                 "-2.2298828125 38551627446.6", 
                 "-2.2048828125 37100623732.0", 
                 "-2.1798828125 36825602737.3", 
                 "-2.1548828125 34963557105.2", 
                 "-2.1298828125 32163944722.6", 
                 "-2.1048828125 29299318167.0", 
                 "-2.0798828125 27794769897.0", 
                 "-2.0548828125 26176477795.0", 
                 "-2.0298828125 24897579745.6", 
                 "-2.0048828125 22452187722.0", 
                 "-1.9798828125 20009478027.1", 
                 "-1.9548828125 17694863875.7", 
                 "-1.9298828125 15497083354.3", 
                 "-1.9048828125 12901608052.8", 
                 "-1.8798828125 10673203037.1", 
                 "-1.8548828125 7980209447.64", 
                 "-1.8298828125 5662638085.9", 
                 "-1.8048828125 3098076234.4", 
                 "-1.7798828125 1296338340.95", 
                 "-1.7548828125 708398132.123", 
                 "-1.7298828125 592764964.744", 
                 "-1.7048828125 252664555.849", 
                 "-1.6798828125 81626386.5509", 
                 "-1.6548828125 971789.900217", 
                 "-1.6298828125 3887184.77659", 
                 "-1.6048828125 0.0", 
                 "-1.5798828125 0.0", 
                 "-1.5548828125 3887285.48112", 
                 "-1.5298828125 0.0", 
                 "-1.5048828125 4858729.21921", 
                 "-1.4798828125 2915256.41246", 
                 "-1.4548828125 0.0", 
                 "-1.4298828125 0.0"]

        xArr = []
        yArr = []
        for line in data: 
            (x, y) = line.split( ' ')
            xArr.append( float( x))
            yArr.append( float( y))

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xArr, yArr, 'stepssa')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, -2.1298828125, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xArr, yArr, 'stepcssa')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, -1.980878, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xArr, yArr, 'stepmssa')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, -1.992848, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( [1, 2,3], [4, 5, 6], 'peak')
        self.assertTrue( message, 'Not enough scan data points. Please scan over at least 9 points!')

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( [1,2,3], [ 5, 6], 'peak')
        self.assertTrue( message, 'Error: Input vectors are not of identical length!')


        yNoisyGauss = [ -yNoisyGauss[i] for i in range( len( yNoisyGauss))]

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xNoisyGauss, yNoisyGauss, 'dip')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 0.2, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xNoisyGauss, yNoisyGauss, 'dipc')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, 0.0119574157, 4)

        (message, xpos, xpeak, xcms, xcen, npSig) = HasyUtils.fastscananalysis( xNoisyGauss, yNoisyGauss, 'dipm')
        self.assertEqual( message, 'success')
        self.assertAlmostEqual( xpos, -0.0146573, 4)

        return