コード例 #1
0
def main():
    StartScan = Midas.varget(RCActive)
    try:  # If called from the command line parse the arguements
        print sys.argv
        if len(sys.argv) == 2:
            # Start a PerlRC scan
            if sys.argv[1] == "start":
                Midas.varset(RCActive, 'y')
                StartScan = 'y'
            # Stop a PerlRC scan
            if sys.argv[1] == "stop":
                Midas.varset(RCActive, 'n')
                StartScan = 'n'
        # Change to a tune
        elif len(sys.argv) == 3 and sys.argv[1] == "tune":
            try:
                ChangeTune(sys.argv[2])
                LogSwitchedTune(sys.argv[2])
            except:
                LogSwitchedTune(sys.argv[2], True)
    except:  # calling it as a module, so ignore the stuff above
        pass

    # If we're doing a PerlRC scan, do what's in the ODB.
    if StartScan == 'y':
        ScanFuncs = {
            "SCAN1D": Scan1D,
            "SCAN2D": Scan2D,
            "TUNESWITCH": TuneSwitch
        }

        # Get the scan type and convert to uppercase
        ScanType = Midas.varget(RunControlPath + "RCType").upper()
        try:
            # call scan function based on the ScanType
            scanoutput = ScanFuncs[ScanType]()
            # Write some info to the log file
            # LogScanStart and LogScanStop only write something
            # if it's the beginning or end of a PerlRC scan.
            LogScanStart()
            LogScanVarStep(scanoutput)
            LogScanStop()

            # Sleep for a second so that scepics can update
            # the values
            time.sleep(1)
            Midas.startrun()
        except:
            # Error occurred. Stop future runs, and write an error message
            Midas.varset(RCActive, 'n')
            LogScanError()
            Midas.sendmessage(
                "pythonrc", "There was a problem. " +
                "Please check input variables and values, " +
                "and the message log for more info.")
コード例 #2
0
def main():
    StartScan = Midas.varget(RCActive)
    try:  # If called from the command line parse the arguements
        print sys.argv
        if len(sys.argv) == 2:
            # Start a PerlRC scan
            if sys.argv[1] == "start":
                Midas.varset(RCActive, 'y')
                StartScan = 'y'
            # Stop a PerlRC scan
            if sys.argv[1] == "stop":
                Midas.varset(RCActive, 'n')
                StartScan = 'n'
        # Change to a tune
        elif len(sys.argv) == 3 and sys.argv[1] == "tune":
            try:
                ChangeTune(sys.argv[2])
                LogSwitchedTune(sys.argv[2])
            except:
                LogSwitchedTune(sys.argv[2], True)
    except:  # calling it as a module, so ignore the stuff above
        pass

    # If we're doing a PerlRC scan, do what's in the ODB.
    if StartScan == 'y':
        ScanFuncs = {"SCAN1D": Scan1D,
                     "SCAN2D": Scan2D,
                     "TUNESWITCH": TuneSwitch}

        # Get the scan type and convert to uppercase
        ScanType = Midas.varget(RunControlPath + "RCType").upper()
        try:
            # call scan function based on the ScanType
            scanoutput = ScanFuncs[ScanType]()
            # Write some info to the log file
            # LogScanStart and LogScanStop only write something
            # if it's the beginning or end of a PerlRC scan.
            LogScanStart()
            LogScanVarStep(scanoutput)
            LogScanStop()

            # Sleep for a second so that scepics can update
            # the values
            time.sleep(1)
            Midas.startrun()
        except:
            # Error occurred. Stop future runs, and write an error message
            Midas.varset(RCActive, 'n')
            LogScanError()
            Midas.sendmessage("pythonrc", "There was a problem. " +
                              "Please check input variables and values, " +
                              "and the message log for more info.")
コード例 #3
0
    def test_startrun(self, mock_odbcommand):
        result = Midas.startrun()

        self.assertEqual(result, None)
        mock_odbcommand.assert_called_once_with("start now")
コード例 #4
0
    def test_startrun(self, mock_odbcommand):
        result = Midas.startrun()

        self.assertEqual(result, None)
        mock_odbcommand.assert_called_once_with("start now")