def clearDevice(self): handle = self.getHandle() handle.timeout = 1 cnt = 0 handle.write("*CLS") while True: try: if cnt>100: return False if int(vpp43.read_stb(handle.vi)) & 128: return True time.sleep(0.1) except visa.VisaIOError: cnt+=1 return False
def waitFullSweep(self): self.write("*CLS;HLD;TRS;WFS;") handle = self.getHandle() handle.timeout = 1 cnt = 0 while True: try: if cnt>100: return False time.sleep(1) status = vpp43.read_stb(handle.vi) if int(status) & 128: return True except visa.VisaIOError: cnt+=1 print sys.exc_info() return False
def read_stb(self): stb = vpp43.read_stb(self.f.vi) return stb
def STB(self): '''Return the instrument status byte (via a low level operation instead of regular query)''' from pyvisa import vpp43 return vpp43.read_stb(self.Instrument.vi)