Skip to content

Commit

Permalink
Merge branch 'develop' into feature-extended-yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
cgranade committed Apr 13, 2017
2 parents e991639 + d7a9b89 commit de20242
Show file tree
Hide file tree
Showing 52 changed files with 4,410 additions and 402 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Expand Up @@ -16,3 +16,10 @@ script:
- pylint instruments/
after_success:
- coveralls
deploy:
provider: pypi
user: ${PYPI_USERNAME}
password: ${PYPI_PASSWORD}
distributions: "sdist bdist_wheel"
on:
tags: true
123 changes: 0 additions & 123 deletions README.md

This file was deleted.

150 changes: 150 additions & 0 deletions README.rst
@@ -0,0 +1,150 @@
InstrumentKit
=============

.. image:: https://img.shields.io/travis/Galvant/InstrumentKit.svg?maxAge=2592000
:target: https://travis-ci.org/Galvant/InstrumentKit
:alt: Travis-CI build status

.. image:: https://img.shields.io/coveralls/Galvant/InstrumentKit/dev.svg?maxAge=2592000
:target: https://coveralls.io/r/Galvant/InstrumentKit?branch=dev
:alt: Coveralls code coverage

.. image:: https://readthedocs.org/projects/instrumentkit/badge/?version=latest
:target: https://readthedocs.org/projects/instrumentkit/?badge=latest
:alt: Documentation

.. image:: https://img.shields.io/pypi/v/instrumentkit.svg?maxAge=86400
:target: https://pypi.python.org/pypi/instrumentkit
:alt: PyPI version

.. image:: https://img.shields.io/pypi/pyversions/instrumentkit.svg?maxAge=2592000
:alt: 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:

.. code-block:: console
$ git clone git@github.com:Galvant/InstrumentKit.git
$ cd InstrumentKit
$ python setup.py install
From Github using pip:

.. code-block:: console
$ pip install -e git+https://www.github.com/Galvant/InstrumentKit.git#egg=instrumentkit
From pypi using pip:

.. code-block:: console
$ pip install instrumentkit
Usage Example
-------------

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

.. code-block:: python
>>> 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:

.. code-block:: python
>>> 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:

.. code-block:: python
>>> 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:

.. code-block:: python
>>> 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.3, 3.4, and 3.5 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.3-dev``, etc).

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

.. code-block:: console
$ 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.
16 changes: 5 additions & 11 deletions doc/examples/ex_qubitekk_gui.py
Expand Up @@ -12,8 +12,7 @@
from sys import platform as _platform

import instruments as ik

import Tkinter as tk
import tkinter as tk
import re


Expand Down Expand Up @@ -85,13 +84,8 @@ def reset(*args):
gate_enabled.set(cc.gate_enable)

if __name__ == "__main__":
# open connection to coincidence counter. If you are using Windows, this will be a com port. On linux, it will show
# up in /dev/ttyusb
if _platform == "linux" or _platform == "linux2":
cc = ik.qubitekk.CC1.open_serial('/dev/ttyUSB0', 19200, timeout=1)
else:
cc = ik.qubitekk.CC1.open_serial('COM8', 19200, timeout=1)
print cc.firmware
cc = ik.qubitekk.CC1.open_serial(vid=1027, pid=24577, baud=19200, timeout=10)
print(cc.firmware)
# i is used to keep track of time
i = 0
# read counts every 0.5 seconds
Expand Down Expand Up @@ -191,8 +185,8 @@ def reset(*args):
tk.Button(mainframe, text="Clear Counts", font="Verdana 24", command=clear_counts).grid(column=2, row=10,
sticky=tk.W)

tk.Label(mainframe, text="Firmware Version: " + cc.firmware, font="Verdana 20").grid(column=1, row=11,
columnspan=2, sticky=tk.W)
tk.Label(mainframe, text="Firmware Version: " + str(cc.firmware),
font="Verdana 20").grid(column=1, row=11, columnspan=2, sticky=tk.W)

for child in mainframe.winfo_children():
child.grid_configure(padx=5, pady=5)
Expand Down
5 changes: 1 addition & 4 deletions doc/examples/ex_qubitekkcc.py
Expand Up @@ -6,10 +6,7 @@


def main():
if _platform == "linux" or _platform == "linux2":
cc1 = ik.qubitekk.CC1v2001.open_serial('/dev/ttyUSB0', 19200, timeout=1)
else:
cc1 = ik.qubitekk.CC1v2001.open_serial('COM8', 19200, timeout=1)
cc = ik.qubitekk.CC1.open_serial(vid=1027, pid=24577, baud=19200, timeout=10)
cc1.dwell_time = 1.0 * second
print cc1.dwell_time
cc1.delay = 0.0 * nanosecond
Expand Down
7 changes: 5 additions & 2 deletions doc/examples/ex_topticatopmode.py
Expand Up @@ -8,10 +8,12 @@
import quantities as pq
from platform import system
if system() == 'Windows':
tm = ik.toptica.TopMode.open_serial('COM14', 115200)
tm = ik.toptica.TopMode.open_serial('COM17', 115200)
else:
tm = ik.toptica.TopMode.open_serial('/dev/ttyACM0', 115200)

print("The top mode's firmware is: ", tm.firmware)
print("The top mode's serial number is: ", tm.serial_number)

print("The current lock state is: ", tm.locked)
print("The current interlock state is: ", tm.interlock)
Expand All @@ -33,14 +35,15 @@
print("The laser1's tec state is: ", tm.laser[0].tec_status)
print("The laser1's intensity is: ", tm.laser[0].intensity)
print("The laser1's mode hop state is: ", tm.laser[0].mode_hop)
print("The laser1's correction status is: ", tm.laser[0].correction_status)
print("The laser1's lock start time is: ", tm.laser[0].lock_start)
print("The laser1's first mode hop time is: ", tm.laser[0].first_mode_hop_time)
print("The laser1's latest mode hop time is: ",
tm.laser[0].latest_mode_hop_time)
print("The current emission state is: ", tm.enable)

tm.laser[0].enable = True
print("The laser1's correction status is: ", tm.laser[0].correction_status)




Expand Down

0 comments on commit de20242

Please sign in to comment.