Package: keithley2600
keithley2600A full Python driver for the Keithley 2600B series of source measurement units. An
accompanying GUI is provided by the sister projectkeithleygui. Documentation is available athttps://keithley2600.readthedocs.io.AboutThis driver provides access to base commands and higher level functions such as IV
measurements, transfer and output curves, etc. Base commands replicate the functionality
and syntax from the Keithley's internal TSP Lua functions. This is possible because the
Lua programming language has a very limited syntax which can be represented by a subset
of Python syntax.All Keithley commands are dynamically queried from the Keithley itself after a
successful connection. This means that essentially all Keithley instruments which use
TSP scripting are supported and any commands introduced in the future will be recognised
automatically (barring changes to the Lua syntax itself). Please refer to the respective
reference manuals for a list of commands available on a particular model, for instance theKeithley 2600B reference manual.This dynamic approach however means that most attributes will only be defined after
connecting to an instrument. Several higher level functions for current-voltage sweeps
are defined by the driver itself and may use functionality which is not available on
some  models. They have been tested with a Keithley 2612B.Warning: There are currently no checks for allowed arguments by the driver itself.
Passing invalid arguments to a Keithley command will fail silently in Python but will
display an error message on the Keithley itself. To enable command checking, set the
keyword argumentraise_keithley_errors = Truein the constructor. When set, most
Keithley errors will be raised as Python errors. This is done by reading the Keithley's
error queue after every command and will therefore result in some communication
overhead.InstallationInstall the stable version from PyPi by running$pipinstallkeithley2600or the latest development version from GitHub:$pipinstallgit+https://github.com/OE-FET/keithley2600UsageConnect to the Keithley 2600 and perform some base commands:fromkeithley2600importKeithley2600k=Keithley2600('TCPIP0::192.168.2.121::INSTR')k.smua.source.output=k.smua.OUTPUT_ON# turn on SMUAk.smua.source.levelv=-40# sets SMUA source level to -40Vv=k.smua.measure.v()# measures and returns the SMUA voltagei=k.smua.measure.i()# measures current at smuAk.smua.measure.v(k.smua.nvbuffer1)# measures the voltage, stores the result in bufferk.smua.nvbuffer1.clear()# clears nvbuffer1 of SMUAHigher level commands defined in the driver:data=k.read_buffer(k.smua.nvbuffer1)# reads all entries from nvbuffer1 of SMUAerrs=k.read_error_queue()# gets all entries from error queuek.set_integration_time(k.smua,0.001)# sets integration time in seck.apply_voltage(k.smua,10)# turns on and applies 10V to SMUAk.apply_current(k.smub,0.1)# sources 0.1A from SMUBk.ramp_to_voltage(k.smua,10,delay=0.1,stepSize=1)# ramps SMUA to 10V in steps of 1V# sweep commandsk.voltage_sweep_single_smu(k.smua,range(0,61),t_int=0.1,delay=-1,pulsed=False)k.voltage_sweep_dual_smu(smu1=k.smua,smu2=k.smub,smu1_sweeplist=range(0,61),smu2_sweeplist=range(0,61),t_int=0.1,delay=-1,pulsed=False,)k.transfer_measurement(...)k.output_measurement(...)Singleton behaviour:Once a Keithley2600 instance with a visa address'address'has been created, repeated
calls toKeithley2600('address')will return the existing instance instead of creating
a new one. This prevents the user from opening multiple connections to the same
instrument simultaneously and allows easy access to a Keithley2600 instance from
different parts of a program. For example:>>>fromkeithley2600importKeithley2600>>>k1=Keithley2600('TCPIP0::192.168.2.121::INSTR')>>>k2=Keithley2600('TCPIP0::192.168.2.121::INSTR')>>>print(k1isk2)TrueData structures:The methodsvoltage_sweep_single_smuandvoltage_sweep_dual_smureturn lists with
the measured voltages and currents. The higher level commandstransfer_measurementandoutput_measurementreturnResultTableobjects which are somewhat similar to pandas
dataframes but include support for column units.ResultTablestores the measurement
data internally as a numpy array and provides information about column titles and units.
It also provides a dictionary-like interface to access columns by name, methods to load
and save the data to text files, and live plotting of the data (requires matplotlib).For example:importtimefromkeithley2600importKeithley2600,ResultTablek=Keithley2600('TCPIP0::192.168.2.121::INSTR')# create ResultTable with two columnsrt=ResultTable(column_titles=['Voltage','Current'],units=['V','A'],params={'recorded':time.asctime(),'sweep_type':'iv'},)# create live plot which updates as data is addedrt.plot(live=True)# measure some currentsforvinrange(0,20):k.apply_voltage(k.smua,10)i=k.smua.measure.i()rt.append_row([v,i])# save the datart.save('~/iv_curve.txt')See thedocumentationfor all available methods.Backend selectionkeithley2600 usesPyVISAto connect to instruments.
PyVISA supports both proprietray IVI libraries such as NI-VISA, Keysight VISA, R&S VISA,
tekVISA etc. and the purely Python backendPyVISA-py.
You can select a specific backend by giving its path to theKeithley2600constructor
in thevisa_libraryargument. For example:fromkeithley2600importKeithley2600k=Keithley2600('TCPIP0::192.168.2.121::INSTR',visa_library='/usr/lib/libvisa.so.7')keithley2600 defaults to using the PyVISA-py backend, selected byvisa_library='@py',
since this is only a pip-install away. If you pass an empty string, keithley2600 will
use an installed IVI library if it can find one in standard locations or fall back to
PyVISA-py otherwise.You can find more information about selecting the backend in thePyVISA docs.System requirementsPython 3.6 or higherDocumentationAPI documentation of keithley2600:https://keithley2600.readthedocs.io/en/latest/Keithley 2600 reference manual with all commands:https://www.tek.com/keithley-source-measure-units/smu-2600b-series-sourcemeter-manual-8