electrical instrument control
Project description
instrbuilder is an open-source Python package for control of electrical instruments. This package eases the development of high-level "drivers" to interface with oscilloscopes, power supplies, function generators, multimeters, or any instrument that uses ASCII textual string communication (such as SCPI). instrbuilder is particularly suited for prototying and automating experiments in research laboratory setups within an IPython terminal. Our goals are to accelerate the development of automated data collection and improve the reproducibility of laboratory experiments.
Related Journal Papers
- L. Koerner "Instrbuilder: A Python package for electrical instrument control" The Journal of Open Source Software: doi
- L. Koerner, T. Caswell, D. Allan, and S. Campbell "A Python instrument control and data acquisition suite for reproducible research" IEEE Transactions on Instrumentation and Measurement doi
Documentation
https://lucask07.github.io/instrbuilder/build/html/
Installation Steps
- Install a VISA driver (National Instruments provides free downloads). The PyVISA documentation page is an excellent resource to locate a VISA driver for your system:
- NI-VISA downloads: links to downloads separated by OS.
- PyVISA backends: an explanation of what is needed.
- Install instrbuilder using pip.
username$ python -m pip install instrbuilder
Getting Started
- Command lists for Keysight oscilloscopes, function generator, DMM; Rigol DC Power Supply (commands.csv) are included in the package at: instrbuilder/instruments/.
Locate the instrument command files using the following python commands:
import instrbuilder
init_file_loc = instrbuilder.__file__
instrument_cmds = init_file_loc.replace('__init__.py', 'instruments/')
print('Instrument commmands (csv files) are at: {}'.format(instrument_cmds))
Note that you can move the command csv files (and probably should). The location of these needs to be specified in the YAML configuration file.
-
A YAML file is used to track your specific system configurations and instrument addresses (e.g. USB0::0x0957::0x0407::MY44060286::INSTR). Create your system YAML file using the steps below. This will be generated at ~/.instrbuilder/ (where ~ indicates your home directory). See the example YAML on GitHub.
-
Try an example in the source code at instrbuilder/examples/. A Keysight and Rigol Oscilloscope is demonstrated in: oscilloscope.py.
Locate the example directory using the following python commands:
import instrbuilder
init_file_loc = instrbuilder.__file__
examples = init_file_loc.replace('__init__.py', 'examples/')
print('Examples are at: {}'.format(examples))
Create Your YAML
- Initialize a YAML (specify the first parameter, the other 3 should always be default):
from instrbuilder import instrument_opening
instrument_opening.init_yaml(csv_dir = 'where/your/commands_csv/files/are')
-
To add instruments to the YAML function use the script found in instrbuilder/examples/add_instruments_to_config.py. This will prompt the user for information. Note that it may be helpful to have only one instrument connected/powered at a time so that there is no ambiguity:
-
An example YAML is available here on GitHub.
Extra Installation Steps if Using the Bluesky Suite from NSLS-II
- If using the Bluesky suite uninstall ophyd and re-install from a git fork:
username$ python -m pip uninstall ophyd
username$ python -m pip install git+https://github.com/lucask07/ophyd@master#egg=ophyd
To check if the correct ophyd fork was installed try:
from ophyd.ee_instruments import generate_ophyd_obj
This warning:
Error: <class 'ImportError'>
IC (integrated circuit imports failed)
The aardvark.so or dll must be in the cwd or an importable path
Continuing anyways, since many may not use this portion...
is OK. A module import error is not.
A basic Bluesky demo is at instrbuilder/bluesky_demo/fg_oscilloscope_basics.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file instrbuilder-0.1.14.tar.gz
.
File metadata
- Download URL: instrbuilder-0.1.14.tar.gz
- Upload date:
- Size: 73.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e04cf4de6d9ea8590d41e01f61a93bc56f79949b2a29d322c75982da7f0ec8d6 |
|
MD5 | cee15ba40f405b4db2b6cdc12c8b552a |
|
BLAKE2b-256 | c90cede1f0dbcb01b68fb96b46077f1bbcb21b5427f488ae49407a5f21f32ac0 |
File details
Details for the file instrbuilder-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: instrbuilder-0.1.14-py3-none-any.whl
- Upload date:
- Size: 106.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dedebef5b09a3cd0012b6b70ea270c1d3bf9ecf8c2ba8ab053ffedb8db1d60a |
|
MD5 | a9445c718d52d6ae349e236b1edb713f |
|
BLAKE2b-256 | 153c6660c16c48948da589debe82cfac62313af41a4d112d91bc5d18ee48cec2 |