Пример #1
0
 def _close(self):
     if self._backend == 'pyVISA':
         del self._port
     elif self._backend == 'linux-gpib':
         gpib.close(self._port)
     elif self._backend == 'pySerial':
         self._port.close()
     elif self._backend == 'pyDAQmx':
         pass
     elif self._backend in ['usbtmc', 'usbtmcWR']:
         self._port.close()
     elif self._backend == 'vxi11':
         self._port.close()
     elif self._backend == 'modbus':
         self._port.close()
Пример #2
0
 def close(self):
     gpib.close(self.handle)
Пример #3
0
    vals = []
    timestamp = time.time()
    now = datetime.fromtimestamp(timestamp)

    for imeas in range(nmeas):
        gpib.write(picoam, "READ?")
        time.sleep(1)
        val = gpib.read(picoam, 100)
        val = val[0:val.find('A')]
        val = float(val) * microampere
        vals.append(str(val))

    filename = '%s/current%d_%04d_%02d_%02d.txt' % (path, index, now.year,
                                                    now.month, now.day)
    with open(filename, mode='a') as f:
        f.write(str(timestamp))
        for imeas in range(nmeas):
            f.write(' ' + vals[imeas])
        f.write('\n')
    if icycle < ncycle - 1:
        print('waiting %d second...' % interval)
        time.sleep(interval)
print('finished!')

#turn off HV
gpib.write(picoam, "SOUR:VOLT:STAT OFF")
gpib.write(picoam, "SOUR:VOLT 0")

#close connection
gpib.close(picoam)
 def __del__(self):
     if self.started:
         for i in self.devices:
             gpib.close(i.communicator.id)
         self.reset_usb()
Пример #5
0
 def close(self):
     if self._own:
         gpib.close(self.id)
         self._own = False
Пример #6
0
 def __del__(self):
     if self._own:
         gpib.close(self.id)
Пример #7
0
 def close(self):
     if self._handle is not None:
         gpib.close(self._handle)
         self._handle = None
Пример #8
0
 def close(self):
     """ closes connection to remote device """
     gpib.close(self.device)
Пример #9
0
 def close(self):
     gpib.close(self.fun_gen)
Пример #10
0
 def close(self):
     gpib.close(self.handle)
     print "GPIB::%d is closed" % self.port
Пример #11
0
import gpib
import time

def query(handle, command, numbytes=100):
    gpib.write(handle, command)
    time.sleep(0.1)
    response = gpib.read(handle, numbytes)
    return response

awg = gpib.find('awg520')
try:
    identity = query(awg, '*IDN?')
    print(identity.decode('utf-8'))

    answer = query(awg, "SOURce:VOLTage:AMPLitude?")
    print(float(answer))

    answer = gpib.write(awg, "DISPLAY:BRIGHTNESS 0.1")
    print((answer))

    gpib.close(awg)
except:
    print('oops')
    gpib.close(awg)
Пример #12
0
 def close(self):
     gpib.close(self.handle)
     print "GPIB::%d is closed" % self.port    
Пример #13
0
 def shutdown(self):
     time.sleep(1)
     self.set_power(False)
     gpib.clear(self.dev)
     gpib.close(self.dev)
Пример #14
0
 def __del__(self):
     """automatically close descriptor when instance is deleted"""
     if self._own:
         gpib.close(self.id)
Пример #15
0
 def shutdown(self):
     time.sleep(1)
     self.set_power(False)
     gpib.clear(self.dev)
     gpib.close(self.dev)
	def __del__(self):
		if self.started:
			for i in self.devices:
				gpib.close(i.communicator.id)
			self.reset_usb()
Пример #17
0
 def __del__(self):
     if self._own:
         gpib.close(self.id)
Пример #18
0
 def __del__(self):
     print('smiq disconnected')
     gpib.write(self.smiq, '*RST')
     gpib.close(self.smiq)
Пример #19
0
 def close(self):
     gpib.close(self.handle)
Пример #20
0
 def disconnect(self):
     gpib.write(self.smiq, '*RST')
     gpib.close(self.smiq)
     print('smiq disconnected')
Пример #21
0
    return


def show_devid(handle):  # Show device ID
    print query(handle, "*IDN?")
    return


print gpib.version()  # Show package version
ud = gpib.dev(board, device)  # Open the device
gpib.config(board, gpib.IbcAUTOPOLL, 1)  # Enable automatic serial polling
gpib.config(ud, gpib.IbcTMO, gpib.T30s)  # Set timeout to 30 seconds
show_devid(ud)
initialise_device(ud)
gpib.write(handle, "*TST;*OPC")  # Selftest and request OPC event
# Wait for Timeout or Request Service on device
sta = gpib.wait(ud, gpib.TIMO | gpib.RQS)
if (sta & gpib.TIMO) != 0:
    print "Timed out"
else:
    print "Device asserted RQS"
    stb = gpib.serial_poll(ud)  # Read status byte
    print "stb = %#x" % (stb)
    if (stb & gpib.IbStbESB) != 0:  # Check for Event Status bit
        esr = int(query(ud, "ESR?"))  # Read Event Status Register
        if (esr & 1) != 0:  # Check for operation completed
            print "Device Operation Completed"

# done
gpib.close(ud)
Пример #22
0
def query(handle, command, numbytes=100):
    gpib.write(handle, command)
    time.sleep(0.1)
    response = gpib.read(handle, numbytes)
    return response


print "Connected to,"
print query(rfAmp, "*IDN?")
print query(sigGen, "*IDN?")

print "RF Forward Power", query(rfAmp, "RDPOD")
print "RF Reverse Power", query(rfAmp, "RDPRD")

print "Read Gain", query(rfAmp, "RDA")
#print "Set Gain", query(rfAmp, "SA 10")

print "Set Signal Generator Frequency", query(sigGen, "FREQ 12 GHz")
print "Set Signal Generator Power", query(sigGen, "POW -10 dBm")
print "Set Signal Generator Output"
resp = query(sigGen, "OUTP ON; *OPC?")
if resp != 1:
    sys.exit(0)
else:
    print "Returning to local mode..bye!!"
    gpib.ibloc(rfAmp)
    gpib.ibloc(sigGen)
    gpib.close(rfAmp)
    gpib.close(sigGen)
Пример #23
0

    print('switching on microwave')
    gpib.write(smiq, ':OUTP:STATE 1')
    gpib.write(smiq, ':LIST:LEARN')
    gpib.write(smiq, ':FREQ:MODE LIST')
    gpib.write(smiq, '*WAI')
    time.sleep(1)
    # hier ab und zu fragen ob er die liste gelernt hat - erst wenn fertig und auf FREQ?

    gpib.write(smiq, ':TRIG:LIST')  # startet


except:
    test = 1
    print('oops - something went wrong')
    gpib.write(smiq, '*RST')
    gpib.close(smiq)

if test == 1:
    gpib.write(smiq, '*RST')
    gpib.close(smiq)

time.sleep(5)
counter.write(b'd')  #ReadTriggeredCountingData
time.sleep(0.1)
data = counter.read(res*3*2)  #2=two apds, res=numbins, 3=? - why not 4?
print(data)
# disable triggered counting
counter.write(b'r')  #DisableTriggeredCounting
counter.close()
Пример #24
0
 def __del__(self):
     gpib.write(self.awg, '*RST')
     gpib.close(self.awg)