42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
REGIONS = [("R1",(1.0, 2.0, 0.1)), ("R2",(2.0, 8.0, 0.5)), ("R3",(8.0, 9.0, 0.2)), ]
|
|
PASSES = 2
|
|
|
|
|
|
class AnalogOutput(RegisterBase):
|
|
def doRead(self):
|
|
return self.val if hasattr(self, 'val') else 0.0
|
|
|
|
def doWrite(self, val):
|
|
self.val = val
|
|
|
|
|
|
add_device(AnalogOutput("ao1"), True)
|
|
|
|
scanning=False
|
|
current_index=-1
|
|
def scan(region):
|
|
name, pars=REGIONS[region]
|
|
def before_pass(pass_num, scan):
|
|
global scanning, current_index
|
|
while (current_index != (region-1)) or scanning:
|
|
time.sleep(0.1)
|
|
scanning = True
|
|
#time.sleep(0.1)
|
|
current_index = current_index+1
|
|
App.getInstance().mainFrame.setScanDisplays(scan, None)
|
|
|
|
def after_pass(pass_num):
|
|
global scanning, current_index
|
|
if current_index>=(len(REGIONS)-1):
|
|
current_index=-1
|
|
scanning = False
|
|
|
|
lscan(ao1, [ai1, ai2], pars[0], pars[1], pars[2], 0.1, tag=name, passes=PASSES,
|
|
before_pass = before_pass, after_pass=after_pass, restore_position=False)
|
|
|
|
scans = [[scan,[i,]] for i in range(len(REGIONS))]
|
|
parallelize(*scans)
|
|
|
|
|
|
|