def buffering(self, value): check = util.expect(self.proc, ["C1"]) count3 = PV('in_counts_3') low3 = PV('low_limit_3') trig_buffer = PV('trig_buffer', auto_monitor=False) int_time = PV('analog_out_period') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data = [] #camonitor('trig_buffer') def getCount1(pvname, value, **kw): data.append(value) util.put_check(low3, 0.0) util.put_check(trig_buffer, value) util.put_fuzzy('analog_out_period', 10e-5, 0.05) print "set value " + str(value) print "buffer value " + str(trig_buffer.get()) #time.sleep(5) #print "buffer value " + str(trig_buffer.get()) count3.add_callback(getCount1) init.put(1) poll(evt=1.e-5, iot=0.01) t0 = time.time() while time.time() - t0 < 5: poll(evt=1.e-5, iot=0.01) run1 = len(data) return run1
def buffering(self): poll(evt=1.9, iot=0.01) status = PV('status') poll(evt=1.9, iot=0.01) start_time = time.time() while status.get() not in (0, 3): print str(status.get()) + "not connected yet" print status.info print status connected = status.get() in (0, 3) poll(evt=1.0, iot=0.51) if time.time() - start_time >= 60: connected = False print "timed out" break print util.expect(self.proc, ["C1"]) count3 = PV('in_counts_3') count4 = PV('in_counts_4') low_3 = PV('low_limit_3') low_4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data3 = [] data4 = [] def getCount3(pvname, value, **kw): data3.append(value) def getCount4(pvname, value, **kw): data4.append(value) if util.put_check( low_3, 0.0) and util.put_check(low_4, 0.0) and util.put_check( trig_buffer, 1000) and util.put_fuzzy( 'analog_out_period', 10e-5, 0.05): pass else: print "setting not taking place" return False, False t0 = time.time() time.sleep(1) count3.add_callback(getCount3) count4.add_callback(getCount4) poll(evt=1.e-5, iot=0.01) init.put(1) poll(evt=1.e-5, iot=0.01) while time.time() - t0 < 3: poll(evt=1.e-5, iot=0.01) # end = self.proc.expect( # ['Announce\(\) success', pexpect.TIMEOUT, pexpect.EOF], timeout=3) return len(data3), len(data4)
def monitor_only(self): status = PV('status') start_time = time.time() while status.get() not in (0, 3): print str(status.get()) + "not connected yet" connected = status.get() in (0, 3) poll(evt=1.0, iot=0.51) if time.time() - start_time >= 60: connected = False print "timed out" break check = util.expect(self.proc, ["C1"]) count3 = PV('in_counts_3') count4 = PV('in_counts_4') trig_mode = PV('trig_mode') low_3 = PV('low_limit_3') low_4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data3 = [] data4 = [] util.put_check(trig_mode, 1) util.put_check(low_3, 0.0) util.put_check(low_4, 0.0) util.put_check(trig_buffer, 1000) util.put_fuzzy('analog_out_period', 10e-5, 0.01) def getCount3(pvname, value, **kw): data3.append(value) def getCount4(pvname, value, **kw): data4.append(value) count3.add_callback(getCount3) count4.add_callback(getCount4) init.put(1) time.sleep(3) return len(data3), len(data4)
def buffering(self): if not self.connected: print "Device not connected" return False count3 = PV('in_counts_3') count4 = PV('in_counts_4') low3 = PV('low_limit_3') low4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') int_time = PV('analog_out_period') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data1 = [] data2 = [] def getCount1(pvname, value, **kw): data1.append(value) def getCount2(pvname, value, **kw): data2.append(value) if util.put_check( low3, 0.0) and util.put_check(low4, 0.0) and util.put_check( trig_buffer, 1000) and util.put_fuzzy( 'analog_out_period', 10e-5, 0.05): pass else: print "setting not taking place" return False, False time.sleep(1) count3.add_callback(getCount1) init.put(1) t0 = time.time() while time.time() - t0 < 3: poll(evt=1.e-5, iot=0.01) run1 = len(data1) count3.remove_callback(1) count3.add_callback(getCount2) if util.put_check(trig_buffer, 500): pass else: print "setting 2nd time not taking place" return False, False init.put(1) t1 = time.time() while time.time() - t1 < 3: poll(evt=1.e-5, iot=0.01) run2 = len(data2) return run1, run2
def monitor_only(self): status = PV('status') if not util.check_device('C1', self.proc) and status.get() in range(0,3): print "device not connected" return False count3 = PV('in_counts_3') count4 = PV('in_counts_4') trig_mode = PV('trig_mode') low_3 = PV('low_limit_3') low_4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data3 = [] data4 = [] util.put_check(trig_mode, 1) util.put_check(low_3, 0.0) util.put_check(low_4, 0.0) util.put_check(trig_buffer, 1000) util.put_fuzzy('analog_out_period', 10e-5, 0.01) def getCount3(pvname, value, **kw): data3.append(value) def getCount4(pvname, value, **kw): data4.append(value) count3.add_callback(getCount3) count4.add_callback(getCount4) init.put(1) time.sleep(3) return len(data3), len(data4)
def buffering_low(self): status = PV('status') start_time = time.time() while status.get() not in (0, 3): print str(status.get()) + "not connected yet" connected = status.get() in (0, 3) poll(evt=1.0, iot=0.51) if time.time() - start_time >= 60: connected = False print "timed out" break check = util.expect(self.proc, ["C1"]) count3 = PV('in_counts_3') low_3 = PV('low_limit_3') low_4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data3 = [] def getCount3(pvname, value, **kw): data3.append(value) if util.put_check( low_3, 0.0) and util.put_check(low_4, 0.0) and util.put_check( trig_buffer, 1000) and util.put_fuzzy( 'analog_out_period', 10e-5, 0.05): pass else: print "setting not taking place" return False, False count3.add_callback(getCount3) init.put(1) t0 = time.time() while time.time() - t0 < 3: poll(evt=1.e-5, iot=0.01) time.sleep(2) return len(data3)
def buffering(self): status = PV('status') if not util.check_device('C1', self.proc) and status.get() in range(0,3): print "device not connected" return False count3 = PV('in_counts_3') count4 = PV('in_counts_4') low_3 = PV('low_limit_3') low_4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data3 = [] data4 = [] def getCount3(pvname, value, **kw): data3.append(value) def getCount4(pvname, value, **kw): data4.append(value) if util.put_check(low_3, 0.0) and util.put_check(low_4, 0.0) and util.put_check(trig_buffer, 1000) and util.put_fuzzy('analog_out_period', 10e-5, 0.05): pass else: print "setting not taking place" return False, False t0 = time.time() # while caget('trig_buffer')!=1000 and caget('trig_mode')!=1: # if time.time() - t0 > 20: # return "buffer or mode never set" # else: # pass #util.put_check('initiate', 1) time.sleep(1) count3.add_callback(getCount3) count4.add_callback(getCount4) init.put(1) while time.time() - t0 < 3: poll(evt=1.e-5, iot=0.01) # time.sleep(2) end = self.proc.expect( ['Announce\(\) success', pexpect.TIMEOUT, pexpect.EOF], timeout=3) #print proc.before return len(data3), len(data4)
def buffering_low(self): status = PV('status') if not util.check_device('C1', self.proc) and status.get() in range(0,3): print "device not connected" return False count3 = PV('in_counts_3') low_3 = PV('low_limit_3') low_4 = PV('low_limit_4') trig_buffer = PV('trig_buffer') init = PV('initiate') poll(evt=1.e-5, iot=0.01) data3 = [] def getCount3(pvname, value, **kw): data3.append(value) if util.put_check(low_3, 0.0) and util.put_check(low_4, 0.0) and util.put_check(trig_buffer, 1000) and util.put_fuzzy('analog_out_period', 10e-5, 0.05): pass else: print "setting not taking place" return False, False count3.add_callback(getCount3) init.put(1) t0 = time.time() while time.time() - t0 < 3: poll(evt=1.e-5, iot=0.01) time.sleep(2) return len(data3)