Coder Social home page Coder Social logo

lvdgraaff / instrumentkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from instrumentkit/instrumentkit

0.0 0.0 0.0 5.13 MB

Python package for interacting with laboratory equipment over various buses.

Python 99.77% MATLAB 0.09% Jupyter Notebook 0.14%

instrumentkit's Introduction

InstrumentKit

Github Actions build status

Codecov 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)
  • Raw USB (open_usb)

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 [email protected]:instrumentkit/InstrumentKit.git
$ cd InstrumentKit
$ python setup.py install

From Github using pip:

$ pip install -e git+https://www.github.com/instrumentkit/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(f"Value: {reading.magnitude}, units: {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 3.7, 3.8, 3.9, 3.10, and 3.11 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. The easiest way to accomplish this is to use the tool pyenv.

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

$ pip install tox
$ tox

Pre-commit

A variety of static code checks are managed and executed via the tool pre-commit. This only needs to be setup once and then it'll manage everything for you.

$ pip install pre-commit
$ pre-commit install

Afterwards, when you go to make a git commit, all the plugins (as specified by the configuration file .pre-commit-config.yaml) will be executed against the files that have changed. If any plugins make changes to the files, the commit will abort, allowing you to add those changes to your changeset and try to commit again. This tool will gate CI, so be sure to let them run and pass!

You can also run all the hooks against all the files by directly calling pre-commit, or though the tox environment:

$ pre-commit run --all

or

$ tox -e precommit

See the pre-commit documentation for more information.

License

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

instrumentkit's People

Contributors

scasagrande avatar cgranade avatar catherineh avatar trappitsch avatar taalexander avatar pre-commit-ci[bot] avatar wil-langford avatar ihincks avatar dijkstrw avatar macjohnny avatar benediktburger avatar silverchris avatar gracecr avatar bilderbuchi avatar dschick avatar virtualsatai avatar xavieraudier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.