Startup
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
for i in range (100):
|
||||
print "------------------------------------------------------------------------------------"
|
||||
print i
|
||||
run("test/TestAlignmentScan")
|
||||
+63
-14
@@ -1,25 +1,74 @@
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
prefix = "SARCL02-DWSC270"
|
||||
sel = WireScan.W1X
|
||||
else:
|
||||
|
||||
is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before callin "run"
|
||||
run("Devices/Elements")
|
||||
run("Devices/WireScanner")
|
||||
|
||||
if is_panel:
|
||||
prefix = args[0]
|
||||
sel = args[1]
|
||||
start = args[2]
|
||||
end = args[3]
|
||||
cycles = args[4]
|
||||
velocity = args[5]
|
||||
bpm3 = args[6]
|
||||
else:
|
||||
prefix = "SINDI01-DWSC090" #"SARCL02-DWSC270"
|
||||
sel = WireScanner.W1X
|
||||
start = -200
|
||||
end = 200
|
||||
cycles = 5
|
||||
velocity = 200
|
||||
bpm3 = None
|
||||
|
||||
run("Devices/Elements")
|
||||
run("Devices/WireScan")
|
||||
#Creating WireScanner object
|
||||
if prefix not in get_wire_scans():
|
||||
raise Exception("Invalid wire scan: " + prefix)
|
||||
scanner = WireScanner(prefix, sel, start, end, cycles, velocity, True)
|
||||
|
||||
print get_wire_scans()
|
||||
#Stream channels
|
||||
bs_position = scanner.motor_bs_readback.get_name()
|
||||
bpms = get_wire_scans_bpms(prefix)
|
||||
if bpms is None:
|
||||
raise Exception("Cannot determine wire scan bpms: " + prefix)
|
||||
channels = [("w_pos", bs_position)]
|
||||
if bpm3 is not None:
|
||||
bpms.append(bpm3)
|
||||
|
||||
for i in range (len(bpms)):
|
||||
channels.append (("bpm" + str(i+1) + "_x", bpms[i] + ":X1"))
|
||||
channels.append (("bpm" + str(i) + "_y", bpms[i] + ":Y1"))
|
||||
channels.append (("bpm" + str(i) + "_q", bpms[i] + ":Q1"))
|
||||
|
||||
wire_scan = WireScan(prefix, sel)
|
||||
#Stream creation
|
||||
st = Stream("pulse_id", dispatcher)
|
||||
for c in channels:
|
||||
st.addScalar(c[0], c[1], 10, 0)
|
||||
st.initialize()
|
||||
st.start()
|
||||
|
||||
scanner.scan()
|
||||
scanner.waitState(State.Busy, 60000)
|
||||
|
||||
print wire_scan.start.read()
|
||||
print wire_scan.end.read()
|
||||
time.sleep(1.0)
|
||||
print wire_scan.current_cycle
|
||||
|
||||
wire_scan.close()
|
||||
#Scan
|
||||
def check_end_scan(record, scan):
|
||||
if scanner.isReady():
|
||||
print "Abort Scan"
|
||||
scan.abort()
|
||||
|
||||
try:
|
||||
#tscan (st.getReadables(), int(scanner.get_total_time() * 2.0 / 0.1), 0.1, after_read =check_end_scan)
|
||||
#bscan (st, int(scanner.get_total_time() * 2.0 / 0.1), after_read =check_end_scan) #Sampling 10 elements
|
||||
mscan (st, st.getReadables() +[scanner.curr_cycl] , -1, scanner.get_total_time() * 2.0, after_read =check_end_scan) # *2.0 to account for accelerations an dother delays
|
||||
|
||||
except:
|
||||
if not scanner.isReady():
|
||||
print "Aborting Wire Scan"
|
||||
scanner.abort()
|
||||
raise
|
||||
finally:
|
||||
print "Closing"
|
||||
scanner.close()
|
||||
st.close()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user