Skip to main content

Test and measurement communication library

Project description

Travis-CI build status Coveralls code coverage Documentation PyPI version Python versions

InstrumentKit is an open source Python library designed to help the end-user get straight into communicating with their equipment via a PC. InstrumentKit aims to accomplish this by providing a connection- and vendor-agnostic API. Users can freely swap between a variety of connection types (ethernet, gpib, serial, usb) without impacting their code. Since the API is consistent across similar instruments, a user can, for example, upgrade from their 1980’s multimeter using GPIB to a modern Keysight 34461a using ethernet with only a single line change.

Supported means of communication are:

  • Galvant Industries GPIBUSB adapter (open_gpibusb)

  • Serial (open_serial)

  • Sockets (open_tcpip)

  • VISA (open_visa)

  • Read/write from unix files (open_file)

  • USBTMC (open_usbtmc)

  • VXI11 over Ethernet (open_vxi11)

There is planned support for HiSLIP someday, but a good Python HiSLIP library will be needed first.

If you have any problems or have code you wish to contribute back to the project please feel free to open an issue or a pull request!

Installation

The instruments package can be installed from this repository by the following means:

From Git:

$ git clone git@github.com:Galvant/InstrumentKit.git
$ cd InstrumentKit
$ python setup.py install

From Github using pip:

$ pip install -e git+https://www.github.com/Galvant/InstrumentKit.git#egg=instrumentkit

From pypi using pip:

$ pip install instrumentkit

Usage Example

To open a connection to a generic SCPI-compatible multimeter using a Galvant Industries’ GPIBUSB adapter:

>>> import instruments as ik
>>> inst = ik.generic_scpi.SCPIMultimeter.open_gpibusb("/dev/ttyUSB0", 1)

From there, various built-in properties and functions can be called. For example, the instrument’s identification information can be retrieved by calling the name property:

>>> print(inst.name)

Or, since in the demo we connected to an SCPIMultimeter, we can preform multimeter-specific tasks, such as switching functions, and taking a measurement reading:

>>> reading = inst.measure(inst.Mode.voltage_dc)
>>> print("Value: {}, units: {}".format(reading.magnitude, reading.units))

Due to the sheer number of commands most instruments support, not every single one is included in InstrumentKit. If there is a specific command you wish to send, one can use the following functions to do so:

>>> inst.sendcmd("DATA") # Send command with no response
>>> resp = inst.query("*IDN?") # Send command and retrieve response

Python Version Compatibility

At this time, Python 2.7, 3.4, 3.5, 3.6, and 3.7 are supported. Should you encounter any problems with this library that occur in one version or another, please do not hesitate to let us know.

Documentation

You can find the project documentation at our ReadTheDocs pages located at http://instrumentkit.readthedocs.org/en/latest/index.html

Contributing

The InstrumentKit team always welcome additional contributions to the project. However, we ask that you please review our contributing developer guidelines which can be found in the documentation. We also suggest that you look at existing classes which are similar to your work to learn more about the structure of this project.

To run the tests against all supported version of Python, you will need to have the binary for each installed, as well as any requirements needed to install numpy under each Python version. On Debian/Ubuntu systems this means you will need to install the python-dev package for each version of Python supported (python2.7-dev, python3.4-dev, etc).

With the required system packages installed, all tests can be run with tox:

$ pip install tox
$ tox

License

All code in this repository is released under the AGPL-v3 license. Please see the license folder for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instrumentkit-0.4.3.tar.gz (170.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

instrumentkit-0.4.3-py2.py3-none-any.whl (259.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file instrumentkit-0.4.3.tar.gz.

File metadata

  • Download URL: instrumentkit-0.4.3.tar.gz
  • Upload date:
  • Size: 170.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for instrumentkit-0.4.3.tar.gz
Algorithm Hash digest
SHA256 dbd0ef1c6050a627804d31326bd905bf4b9efb993de1aaaf6e47664a003ad60a
MD5 8cd1745b9081f3795d7a64c146c4ec53
BLAKE2b-256 299c62782f10b96c712647ae3417e27847e8f102fc48053647c30e7a0b131bff

See more details on using hashes here.

File details

Details for the file instrumentkit-0.4.3-py2.py3-none-any.whl.

File metadata

  • Download URL: instrumentkit-0.4.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 259.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for instrumentkit-0.4.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1b825ef621700a9224a89e4a6e0db025e4665bcf922f4d443cec024bc750f741
MD5 108e34225d797c1df4600b21237bf48b
BLAKE2b-256 41e17631ddccad96767653481d83c10d25a2fb8c26a035b9c26007fa379542a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page