Ejemplo n.º 1
0
 def __init__(self,
              name='gpib0',
              pad=None,
              sad=0,
              timeout=gpib.T10s,
              send_eoi=1,
              eos_mode=0,
              eot=True):
     self._own = False
     self.name = None
     if isinstance(name, basestring):
         self.id = gpib.find(name)
         self.name = name
         self._own = True
     elif pad is None:
         self.id = name
     else:
         self.id = gpib.dev(name, pad, sad, timeout, send_eoi, eos_mode)
         self._own = True
     if eot:
         self.eot = True
     else:
         self.eot = False
     if self._own:
         self.get_status()
Ejemplo n.º 2
0
 def start(self):
     #print("initializing")
     self.pm2812 = gpib.find("pm2812")
     self.hp6633a = gpib.find("6633a")
     #select channel 1 and enable
     self.port = parallel.ParallelPort(address=0x0378)
     gpib.write(self.pm2812,"INST:NSEL 1")
     gpib.write(self.pm2812,"OUTP ON")
     gpib.write(self.pm2812,"VOLT 0")
     #select channel 2 and enable
     gpib.write(self.pm2812,"INST:NSEL 2")
     gpib.write(self.pm2812,"OUTP ON")
     gpib.write(self.pm2812,"VOLT 0")
     #select 6633a
     gpib.write(self.hp6633a,"CLR")
     gpib.write(self.hp6633a ,"VSET 0")
     gpib.write(self.hp6633a,"OUTP ON")
     self.enable = True
     self.syncDio()
Ejemplo n.º 3
0
	def __init__(self):
		# Flag for peak search
		self.peak_searched = False;

		# Try to find the gpib device.
		self.dev = gpib.find(self.gpib_lib_name);
		# Reset dev
		self.reset();
		# Set to single sweep mode
		self.set_singlesweep();
Ejemplo n.º 4
0
	def __init__(self, name = 'gpib0', pad = None, sad = 0, timeout = 13, send_eoi = 1, eos_mode = 0):
		self._own = False
		if isinstance(name, basestring):
			self.id = gpib.find(name)
			self._own = True
		elif pad is None:
			self.id = name
		else:
			self.id = gpib.dev(name, pad, sad, timeout, send_eoi, eos_mode)
			self._own = True
Ejemplo n.º 5
0
 def __init__(self, name='gpib0', pad=None, sad=0, timeout=13, send_eoi=1, eos_mode=0):
     self._own = False
     try:
         if isinstance(name, basestring):
             self.id = gpib.find(name)
             self._own = True
         elif pad is None:
             self.id = name
         else:
             self.id = gpib.dev(name, pad, sad, timeout, send_eoi, eos_mode)
             self._own = True
     except gpib.GpibError as msg:
         print("error: could not open device ({name})".format(name=name))
         print("libgpib: {msg}".format(msg=msg))
         sys.exit(1)
Ejemplo n.º 6
0
 def __init__(self,
              name='gpib0',
              pad=None,
              sad=0,
              timeout=13,
              send_eoi=1,
              eos_mode=0):
     self._own = False
     if isinstance(name, basestring):
         self.id = gpib.find(name)
         self._own = True
     elif pad is None:
         self.id = name
     else:
         self.id = gpib.dev(name, pad, sad, timeout, send_eoi, eos_mode)
         self._own = True
Ejemplo n.º 7
0
 def __init__(self, parent=None):
     super(MinionAwg520, self).__init__(parent)
     self.awg = gpib.find('awg520')
     gpib.write(self.awg, '*RST')
     gpib.write(self.awg, 'DISPLAY:BRIGHTNESS 0.1')
     gpib.write(self.awg, ':ROSCILLATOR:SOURCE EXTERNAL')
     gpib.write(self.awg, 'SOURCE1:MARKER1:DELAY 0')
     gpib.write(self.awg, 'SOURCE1:MARKER1:VOLTAGE:LOW 0')
     gpib.write(self.awg, 'SOURCE1:MARKER1:VOLTAGE:HIGH 1')
     gpib.write(self.awg, 'SOURCE1:MARKER2:DELAY 0')
     gpib.write(self.awg, 'SOURCE1:MARKER2:VOLTAGE:LOW 0')
     gpib.write(self.awg, 'SOURCE1:MARKER2:VOLTAGE:HIGH 2')
     gpib.write(self.awg, 'SOURCE2:MARKER1:DELAY 0')
     gpib.write(self.awg, 'SOURCE2:MARKER1:VOLTAGE:LOW 0')
     gpib.write(self.awg, 'SOURCE2:MARKER1:VOLTAGE:HIGH 1')
     gpib.write(self.awg, 'SOURCE2:MARKER2:DELAY 0')
     gpib.write(self.awg, 'SOURCE2:MARKER2:VOLTAGE:LOW 0')
     gpib.write(self.awg, 'SOURCE2:MARKER2:VOLTAGE:HIGH 2')
Ejemplo n.º 8
0
    def __init__(self, port='/dev/ttyUSB0', baudrate=1200,
                 calib=[-0.49125, 1.0613], Tident='LSCI,MODEL321', mode=0):
        """
        initialize device connections and set up variables and constants
        mode (0 = no change to DMM, 1 = update in torr, 2 = update in dens)
        """
        # for the baratron reading and updating display
        self.dmm = gpib.find('3478a')
        self.__bytes__ = 32
        # so that DMM knows to put something in the output buffer
        gpib.read(self.dmm, self.__bytes__)
        
        # for the temperature reading, many values hardcoded for
        # Lakeshore 321 cryogenic temperature sensor
        self.Tsensor = serial.Serial(port=port, baudrate=baudrate,
                                     bytesize = 7, parity = 'O')
        self.Tsensor.setTimeout(1)
        self.Tsensor.flushInput()
        self.Tsensor.write('*IDN?\n')
        answer = self.Tsensor.readline()

        if (re.match(Tident, answer) == None):
            raise Exception, "LS321 ident string not matched"
                
        # calibration factors consist of two numbers: voltage reading
        # at vacuum, and voltage reading at 1 atm.
        self.calib = calib
        self.mode = mode
        
        # some constants; declared here so that improved versions
        # of front-ends could modify them.
        self.atm = 760.0
        self.unit='TORR'
        self.pascalPerTorr = 133.322
        self.boltzmann = 1.38065e-23
        self.BGUnit='HE'
Ejemplo n.º 9
0
 def setup(self):
     self.dev = gpib.find('keithley')
     #self.write('*RST')
     self.write('DISP:CHAN 1')
     self.write('SENS1:NPLC 1')
     self.write('SENS1:AVER 3')
Ejemplo n.º 10
0
 def __init__(self):
     # defined in /etc/gpib.conf
     self.fun_gen = gpib.find("hp33120A")
     self.k230 = gpib.find("k230")
     self.k236 = gpib.find("k236")
Ejemplo n.º 11
0
 def setup(self):
     self.dev = gpib.find('keithley')
     #self.write('*RST')
     self.write('DISP:CHAN 1')
     self.write('SENS1:NPLC 1')
     self.write('SENS1:AVER 3')
Ejemplo n.º 12
0
	def __init__(self, name):
		self.device = gpib.find(name)
		self.read_length = self.DEFAULT_READ_LENGTH
Ejemplo n.º 13
0
commands = []

# EXCLUDE ALL COMMENTED LINES
for line in cflines:
    if line == '':
        continue
    elif line[0] == '#':
        continue
    else:
        commands.append(line)

# IMPORT NEEDED MODULES
import gpib

# OPENING GPIB DEVICE (LASER)
herring = gpib.find("laser")

# SENDING COMMANDS TO DEVICE
for comm in commands:
    gpib.write(herring, comm)

# DISPLAY SETTINGS
print('========================')
print('      NEW SETTINGS      ')
print('========================')
for comm in commands:
    gpib.write(herring, comm.split()[0] + ' ' + comm.split()[1])
    print(
        str(gpib.read(herring, 1024)).replace('b\'', '').replace('\\r\'', ''))
print('========================')
Ejemplo n.º 14
0
#! /usr/bin/env python
#monitor current

import gpib, time, sys
from datetime import datetime

path = '.'
ncycle = 100000
nmeas = 10
interval = 60  #secondo
microampere = 1.e6
index = 0

#connect to picoammeter
picoam = gpib.find("picoammeter")

#initialize
print('initialize picoammeter')
gpib.write(picoam, "*RST")  #reset settings
gpib.write(picoam, "SYST:ZCH ON")  #zero check
gpib.write(picoam, "RANGE 2e-2")  #set current range. -0.021-0.021 A
gpib.write(picoam, "RANGE:AUTO OFF")  #change current range manually
gpib.write(picoam, "INIT")  #read value of zero correction
gpib.write(picoam, "SYST:ZCOR:ACQ")  #acquire value of zero correction
gpib.write(picoam, "SYST:ZCOR ON")  #zero correction
gpib.write(picoam, "SYST:ZCOR OFF")
gpib.write(picoam, "SYST:ZCH OFF")

#turn on HV
gpib.write(picoam,
           "SOUR:VOLT:RANG 500")  #set voltage range. (only 10, 50, 500 V)
Ejemplo n.º 15
0
# -*- coding: utf-8 -*-
"""
author: ashish
license: GPL v3.0
brief: Interfacing of Amplifier Research 200T8G18A 250W Microwave amplifier and 
       R&S RF and Microwave Signal Generator using GPIB.
pre: python gpib packge must be installed first. Download it from:
     http://sourceforge.net/projects/linux-gpib/files/
     Ref: http://cdn.rohde-schwarz.com/pws/dl_downloads/dl_application/application_notes/1gp79/1GP79_1E_SCPI_Programming_Guide_SigGens.pdf  
"""

import gpib
import time
rfAmp = gpib.find("fCtr")  # define in /etc/gpib.conf
sigGen = gpib.find("pMtr")


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")
Ejemplo n.º 16
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)
Ejemplo n.º 17
0
print(powerliststring)
# print(freqlistreversedstring)
print(':FREQ '+str(np.mean(freqlist)))
print(':POW '+str(np.mean(powerlist))+'dBm')

#connect fpga and smiq
counter = serial.Serial('/dev/ttyUSB3', baudrate=4000000, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1)
fpgaclock = 80*10**6  # in Hz
counttime_bytes = (int(0.005*fpgaclock)).to_bytes(4, byteorder='little')
counter.write(b'T'+counttime_bytes)  # set counttime at fpga
counter.write(b't')  # check counttime
check_counttime = int.from_bytes(counter.read(4), byteorder='little')/fpgaclock
print('\t fpga counttime:', check_counttime)
print('\t counter connected')

smiq = gpib.find('smiq06b')

# enable triggered counting
counterbins = res.to_bytes(2, byteorder='little')
counter.write(b'B'+counterbins)  #SetNumberOfTriggeredCountingBins

triggermask = 8
triggerinvertmask = 8
counter.write(b'M'+(8).to_bytes(1, byteorder='little'))  #SetTriggerMask
counter.write(b'Q'+(8).to_bytes(1, byteorder='little'))  #SetTriggerinvertedMask

counter.write(b'K'+(1).to_bytes(4, byteorder='little'))  #SetTriggeredCountingBinRepetitions

counter.write(b'0')  #ResetTriggeredCountingData
counter.write(b'R')  #EnableTriggeredCounting
Ejemplo n.º 18
0
 def __init__(self, name='gpib0', eot=True):
     self.id = gpib.find(name)
     if eot:
         self.eot = True
     else:
         self.eot = False
Ejemplo n.º 19
0
 def connect(self):
     self.smiq = gpib.find('smiq06b')
     gpib.write(self.smiq, '*RST')
     print('smiq connected')