Package: instrbuilder
instrbuilderis 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).instrbuilderis 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 PapersL. Koerner "Instrbuilder: A Python package for electrical instrument control" The Journal of Open Source Software:doiL. Koerner, T. Caswell, D. Allan, and S. Campbell "A Python instrument control and data acquisition suite for reproducible research" IEEE Transactions on Instrumentation and MeasurementdoiDocumentationhttps://lucask07.github.io/instrbuilder/build/html/Installation StepsInstall 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.Installinstrbuilderusing pip.username$ python -m pip install instrbuilderGetting StartedCommand 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:importinstrbuilderinit_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 theexample YAMLon GitHub.Try an example in the source code atinstrbuilder/examples/. A Keysight and Rigol Oscilloscope is demonstrated in:oscilloscope.py.Locate the example directory using the following python commands:importinstrbuilderinit_file_loc=instrbuilder.__file__examples=init_file_loc.replace('__init__.py','examples/')print('Examples are at:{}'.format(examples))Create Your YAMLInitialize a YAML (specify the first parameter, the other 3 should always be default):frominstrbuilderimportinstrument_openinginstrument_opening.init_yaml(csv_dir='where/your/commands_csv/files/are')Toadd instrumentsto the YAML function use the script found ininstrbuilder/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 hereon GitHub.Extra Installation Steps if Using the Bluesky Suite from NSLS-IIIf using the Bluesky suite uninstall ophyd and re-install from a git fork:username$ python -m pip uninstall ophydusername$ python -m pip install git+https://github.com/lucask07/ophyd@master#egg=ophydTo check if the correctophydfork was installed try:fromophyd.ee_instrumentsimportgenerate_ophyd_objThis 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...isOK. A module import error is not.A basic Bluesky demo is atinstrbuilder/bluesky_demo/fg_oscilloscope_basics.py