keithley2600
Copyright (c) 2009- keithley2600 Project Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Submodules
Package Contents
Classes
Class that holds measurement data. All data is stored internally as a numpy array |
|
Class to handle, store and load transfer and output characteristic data of FETs. |
- class keithley2600.ResultTable(column_titles: List[str] | None = None, units: List[str] | None = None, data: Sequence[float] | None = None, params: Dict[str, Any] | None = None)
Class that holds measurement data. All data is stored internally as a numpy array with the first index designating rows and the second index designating columns.
Columns must have titles and can have units. It is possible to access the data in a column by its title in a dictionary type notation.
- Parameters:
column_titles (list) – List of column titles.
units (list) – List of column units.
data – Numpy array holding the data with the first index designating rows and the second index designating columns. If
data
isNone
, an empty array with the required number of columns is created.params – Dictionary of measurement parameters.
- Examples:
Create a
ResultTable
to hold current-vs-time data:>>> import time >>> import numpy as np >>> from keithley2600 import ResultTable >>> # create dictionary of relevant measurement parameters >>> pars = {'recorded': time.asctime(), 'sweep_type': 'iv'} >>> # create ResultTable with two columns >>> rt = ResultTable(['Voltage', 'Current'], ['V', 'A'], params=pars) >>> # create a live plot of the data >>> fig = rt.plot(live=True)
Create a
Keithley2600
instance and record some data:>>> from keithley2600 import Keithley2600 >>> k = Keithley2600('TCPIP0::192.168.2.121::INSTR') >>> for v in range(11): # measure IV characteristics from 0 to 10 V ... k.apply_voltage(k.smua, 10) ... i = k.smua.measure.i() ... rt.append_row([v, i]) ... time.sleep(1)
Print a preview of data to the console:
>>> print(rt) Voltage [V] Current [A] 0.0000e+00 1.0232e-04 1.0000e+00 2.2147e-04 2.0000e+00 3.6077e-04 3.0000e+00 5.2074e-04 4.0000e+00 6.9927e-04
Save the recorded data to a tab-delimited text file:
>>> rt.save('~/Desktop/stress_test.txt')
- has_unit(col: int | str) bool
Returns
True
column units have been set andFalse
otherwise.- Parameters:
col – Column index or name.
- Returns:
True
if column_units have been set,False
otherwise.
- get_unit(col: int | str) str
Get unit of column
col
.- Parameters:
col – Column index or name.
- Returns:
Unit of column.
- set_unit(col: int | str, unit: str) None
Set unit of column
col
.- Parameters:
col – Column index or name.
unit – Unit string.
- append_row(data: Sequence[float]) None
Appends a single row to the data array.
- Parameters:
data – Sequence with the same number of elements as columns in the data array.
- append_rows(data: Sequence[float]) None
Appends multiple rows to the data array.
- Parameters:
data – List of lists or numpy array with dimensions matching the data array.
- append_column(data: Sequence[float], name: str, unit: str | None = None) None
Appends a single column to the data array.
- Parameters:
data – Sequence with the same number of elements as rows in the data array.
name – Name of new column.
unit – Unit of values in new column.
- append_columns(data: Sequence[float], column_titles: List[str], units: List[str] | None = None) None
Appends multiple columns to data array.
- Parameters:
data – List of columns to append.
column_titles – List of column titles (strings).
units – List of units for new columns (strings).
- get_row(i: int) numpy.ndarray
- Parameters:
i – Index of row.
- Returns:
Numpy array with data from row
i
.
- get_column(i: int) numpy.ndarray
- Parameters:
i – Index of column.
- Returns:
Numpy array with data from column
i
.
- save(filename: str, ext: str = '.txt') None
Saves the result table to a text file. The file format is:
The _header contains all measurement parameters as comments.
Column titles contain column_names and column_units of measured quantity.
Delimited columns contain the data.
Files are saved with the specified extension (default: ‘.txt’). The classes default delimiters are used to separate columns and rows.
- Parameters:
filename – Path of file to save. Relative paths are interpreted with respect to the current working directory.
ext – File extension. Defaults to ‘.txt’.
- save_csv(filename: str) None
Saves the result table to a csv file. The file format is:
The _header contains all measurement parameters as comments.
Column titles contain column_names and column_units of measured quantity.
Comma delimited columns contain the data.
Files are saved with the extension ‘.csv’ and other extensions are overwritten.
- Parameters:
filename – Path of file to save. Relative paths are interpreted with respect to the current working directory.
- load(filename: str) None
Loads data from csv or tab delimited tex file. The _header is searched for measurement parameters.
- Parameters:
filename – Absolute or relative path of file to load.
- plot(x_clmn: int = 0, y_clmns: List[str] | None = None, func: Callable = lambda x: ..., live: bool = False, **kwargs) ResultTablePlot
Plots the data. This method should not be called from a thread. The column containing the x-axis data is specified (defaults to first column), all other data is plotted on the y-axis. This method requires Matplotlib to be installed and accepts, in addition to the arguments documented here, the same keyword arguments as
matplotlib.pyplot.plot()
.Column titles are taken as legend labels.
plot()
tries to determine a common y-axis unit and name from all given labels.- Parameters:
x_clmn (int or str) – Integer or name of column containing the x-axis data.
y_clmns – List of column numbers or column names for y-axis data. If not given, all columns will be plotted against the x-axis column.
func – Function to apply to y-data before plotting.
live – If
True
, update the plot when new data is added. Plotting will be carried out in the main (GUI) thread, therefore take care not to block the thread. This can be achieved for instance by adding data in a background thread which carries out the measurement, or by calling matplotlib.pyplot.pause after adding data to give the GUI time to update.
- Returns:
ResultTablePlot
instance with Matplotlib figure.- Raises:
ImportError – If import of matplotlib fails.
- __getitem__(key: str) numpy.ndarray
Gets values in column with name
key
.- Parameters:
key – Column name.
- Returns:
Column content as numpy array.
- class keithley2600.FETResultTable(column_titles: List[str] | None = None, units: List[str] | None = None, data: Sequence[float] | None = None, params: Dict[str, Any] | None = None)
Bases:
ResultTable
Class to handle, store and load transfer and output characteristic data of FETs.
TransistorSweepData
inherits fromResultTable
and overrides the plot method.- plot(*args, **kwargs) ResultTablePlot
Plots the transfer or output curves. Overrides
ResultTable.plot()
. Absolute values are plotted, on a linear scale for output characteristics and a logarithmic scale for transfer characteristics. Takes the same arguments asResultTable.plot()
.- Returns:
ResultTablePlot
instance with Matplotlib figure.- Raises:
ImportError – If import of matplotlib fails.
- has_unit(col: int | str) bool
Returns
True
column units have been set andFalse
otherwise.- Parameters:
col – Column index or name.
- Returns:
True
if column_units have been set,False
otherwise.
- get_unit(col: int | str) str
Get unit of column
col
.- Parameters:
col – Column index or name.
- Returns:
Unit of column.
- set_unit(col: int | str, unit: str) None
Set unit of column
col
.- Parameters:
col – Column index or name.
unit – Unit string.
- append_row(data: Sequence[float]) None
Appends a single row to the data array.
- Parameters:
data – Sequence with the same number of elements as columns in the data array.
- append_rows(data: Sequence[float]) None
Appends multiple rows to the data array.
- Parameters:
data – List of lists or numpy array with dimensions matching the data array.
- append_column(data: Sequence[float], name: str, unit: str | None = None) None
Appends a single column to the data array.
- Parameters:
data – Sequence with the same number of elements as rows in the data array.
name – Name of new column.
unit – Unit of values in new column.
- append_columns(data: Sequence[float], column_titles: List[str], units: List[str] | None = None) None
Appends multiple columns to data array.
- Parameters:
data – List of columns to append.
column_titles – List of column titles (strings).
units – List of units for new columns (strings).
- get_row(i: int) numpy.ndarray
- Parameters:
i – Index of row.
- Returns:
Numpy array with data from row
i
.
- get_column(i: int) numpy.ndarray
- Parameters:
i – Index of column.
- Returns:
Numpy array with data from column
i
.
- save(filename: str, ext: str = '.txt') None
Saves the result table to a text file. The file format is:
The _header contains all measurement parameters as comments.
Column titles contain column_names and column_units of measured quantity.
Delimited columns contain the data.
Files are saved with the specified extension (default: ‘.txt’). The classes default delimiters are used to separate columns and rows.
- Parameters:
filename – Path of file to save. Relative paths are interpreted with respect to the current working directory.
ext – File extension. Defaults to ‘.txt’.
- save_csv(filename: str) None
Saves the result table to a csv file. The file format is:
The _header contains all measurement parameters as comments.
Column titles contain column_names and column_units of measured quantity.
Comma delimited columns contain the data.
Files are saved with the extension ‘.csv’ and other extensions are overwritten.
- Parameters:
filename – Path of file to save. Relative paths are interpreted with respect to the current working directory.
- load(filename: str) None
Loads data from csv or tab delimited tex file. The _header is searched for measurement parameters.
- Parameters:
filename – Absolute or relative path of file to load.
- __getitem__(key: str) numpy.ndarray
Gets values in column with name
key
.- Parameters:
key – Column name.
- Returns:
Column content as numpy array.
- exception keithley2600.KeithleyIOError
Bases:
Exception
Raised when no Keithley instrument is connected.
- class __cause__
exception cause
- class __context__
exception context
- __delattr__()
Implement delattr(self, name).
- __dir__()
Default dir() implementation.
- __eq__()
Return self==value.
- __format__()
Default object formatter.
Return str(self) if format_spec is empty. Raise TypeError otherwise.
- __ge__()
Return self>=value.
- __getattribute__()
Return getattr(self, name).
- __getstate__()
Helper for pickle.
- __gt__()
Return self>value.
- __hash__()
Return hash(self).
- __le__()
Return self<=value.
- __lt__()
Return self<value.
- __ne__()
Return self!=value.
- __reduce__()
Helper for pickle.
- __reduce_ex__()
Helper for pickle.
- __repr__()
Return repr(self).
- __setattr__()
Implement setattr(self, name, value).
- __sizeof__()
Size of object in memory, in bytes.
- __str__()
Return str(self).
- __subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- add_note()
Exception.add_note(note) – add a note to the exception
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.