# For printing status messages to PV
msgPv = PV(pvPrefix + ':MSG')
msgPv.put('Aborting...')
print 'Aborting...'

# Import pvScan module
sys.path.append('/afs/slac/g/testfac/extras/scripts/pvScan/dev/modules/')
import pvscan

# Get PID PV
pid = pvscan.pidPV.get()

# For stopping the wrapper script
runFlagPv = PV(pvPrefix + ':RUNFLAG')

exp = pvscan.Experiment(npvs=2, nshutters=3, abortFlag=True)


##################################################################################################################
def abortRoutine():
    "This is the abort routine"
    # Kill scan routine process
    pvscan.printMsg('Killing process %d...' % (pid))
    os.kill(pid, signal.SIGKILL)
    # Stop the wrapper script
    pvscan.printMsg('Stopping wrapper script')
    runFlagPv.put(0)
    # Stop move(s)
    pvscan.printMsg('Stopping scan')
    try:
        for pv in exp.scanpvs:
示例#2
0
# For printing status messages to PV
msgPv = PV(pvPrefix + ':MSG')
msgPv.put('Initializing...')
print 'Initializing...'

# Import pvScan module
sys.path.append('/afs/slac/g/testfac/extras/scripts/pvScan/prod/modules/')
import pvscan

#--- Experiment ---------------------------------------
# Create Experiment object.  Sets default filepath and gets experiment name from PV.
# First argument (optional) is an experiment name, leave blank to get from pvScan IOC.
# Second arg (optional) is a filepath, leave blank to get from pvScan IOC.
# Third arg (optional) is a scan name, leave blank to get from pvScan IOC.
exp1 = pvscan.Experiment()
exp1.targetname = PV(pvPrefix + ':SCAN:TARGETNAME').get()
if ' ' in exp1.targetname: exp1.targetname = exp1.targetname.replace(' ', '_')

#--- Log file ------------------------------
# Create log file object.  Writes to stdout and to a log file.
# First arg (optional) is a filename, leave blank to get from pvScan IOC.
logFile1 = pvscan.Tee()

#--- Scan PVs ------------------------------------------
# Create ScanPv objects, one for each PV you are scanning.
# First argument (required) is the scan PV, leave as empty string to get from pvScan IOC.
# Second arg (required) is an index which should be unique.
# Third arg (optional) is an RBV pv name.
scanPv1 = pvscan.ScanPv('', 1)
scanPv2 = pvscan.ScanPv('', 2)
示例#3
0
msgPv = PV(pvPrefix + ':MSG')
msgPv.put('Initializing scan...')
print('Initializing scan...')

# Import pvScan module
sys.path.append('/afs/slac/g/testfac/extras/scripts/pvScan/dev/modules/')
import pvscan

# Configure logging
pvscan.loggingConfig()

# For thread-safe printing
print_lock = threading.Lock()

# Set up a scan with 2 Scan PVs, 3 shutters
exp = pvscan.Experiment(npvs=2, nshutters=3, mutex=print_lock)

# Add extra monitor PVs here.  Yuo can also add them to the "Monitor PV list" in the GUI.
# For example:
# exp.dataLog.pvlist += [PV('ASTA:AO:BK05:V0079'), PV('ASTA:AO:BK05:V0080')]
#print([pv.pvname for pv in exp.dataLog.pvlist])


### Define scan routine #####################################################
def scanRoutine():
    "This is the scan routine"
    # Print scan info
    pvscan.printScanInfo(exp, exp.scanpvs)
    pvscan.printMsg('Starting')
    sleep(0.5)  # Collect some initial data first
    # Scan delay stage and grab images...