UNKNOWN
Project description
PyUniversalLibrary is a Python wrapper for Measurement Computing’s Universal Library for data acquisition on Microsoft Windows operating systems.
This document is both the webpage for PyUniversalLibrary and the README.txt file (distributed with the source code of PyUniversalLibrary). It is in reStructuredText format.
Work in Progress
Currently PyUniversalLibrary is incomplete. I have so far wrapped analog I/O, digital I/O, and temperature functions. Some of these I have not personally needed, so please be aware of potential bugs. If you need more functionality, you will hopefully find that the start I have made in wrapping this library useful. I welcome your changes and additions. I will include them with the next release with appropriate credit.
Release 20061020
Current version
Rewrote as a pure-Python implementation, which uses ctypes and numpy (new requirements). There is no longer a requirement on Numeric, and this should work with any reasonably backwards-compatible future versions of Python, ctypes, and numpy. The analog output examples were changed to work on USB PMD-1208FS devices.
Release 20050624
Lots of Universal Library is now covered, including all analog I/O, digital I/O, and temperature input functions.
Release 20050623
First public release.
Also of interest
Various Python wrappers for data acquisition are available. Here are a few I know of:
National Instruments NI-DAQ: http://sourceforge.net/projects/uncpythontools/
Data Translation: Martin Spacek has indicated (personal commication) he has drivers
Comedi apparently comes with Python wrappers: http://www.comedi.org/
Dr. Warren Jasper’s Measurement Computing USB drivers for Linux (Andrew Straw has written Python wrappers for these - contact him for further information)
Installation and Download
You must download and install InstaCal from Measurement Computing. This contains the various libraries needed to access your hardware.
You must have Python installed.
You must have ctypes installed (this is included with Python 2.5), but can be downloaded for older versions of Python.
You must have numpy installed.
Download PyUniversalLibrary: Grab a binary installer or the source code from the download directory.
To get the examples, download the source code. You can still install the binaries.
Optional
If you intend make significant use of PyUniversalLibrary, I suggest you buy Universal Library C API. It costs $50 and includes extensive documentation and example code.
Examples
Here is ulai01.py from the example directory. It is a direct translation of the essentials of ulai01.c, included with Universal Library. Error checking occurs automatically through Python exceptions.
import UniversalLibrary as UL BoardNum = 0 Gain = UL.BIP5VOLTS Chan = 0 while 1: DataValue = UL.cbAIn(BoardNum, Chan, Gain) EngUnits = UL.cbToEngUnits(BoardNum, Gain, DataValue) print DataValue, EngUnits
Further examples are included, including a simple wxPython/matplotlib based oscilloscope.
Usage notes
Naming conventions
‘PyUL’ is used here to mean the UniversalLibray Python module. Because UniversalLibrary is cumbersome to type, the example programs actually use “import UniversalLibrary as UL”.
PyUniversalLibrary endeavors to keep function signatures identical to the C API. These sometimes result in non-Pythonic quirks: some arguments to a function have no effect on that function because in C they are output variables. In these cases, they are returned as outputs from the function.
Error handling
The PyUL checks for errors upon every call and raises a UniversalLibraryError if an error was encountered. Instances of UniversalLibraryError have an errno attribute which can be converted to a string with a call to _get_error_message(errno).
Initialization
The short story is that importing PyUL (“import UniversalLibrary”) will do all initialization necessary.
The long story is that C programs call the cbDeclareRevision() and cbErrHandling() functions upon initialization. PyUL calls cbDeclareRevision() automatically, and calling cbErrHandling() is not needed because the default state DONTPRINT, DONTSTOP, which is exactly what PyUL expects, because PyUL checks all the error codes anyhow.
License
BSD license. See the file LICENSE.txt distributed with the source code.
Owner: California Institute of Technology Author: Andrew Straw
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 PyUniversalLibrary-20061020.zip
.
File metadata
- Download URL: PyUniversalLibrary-20061020.zip
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5053cadb396faa9d7cf7b1bf6ba04463036a52769f6781c0cc31734eba94a559 |
|
MD5 | 30825002ca14730e23c5e468c0fa2122 |
|
BLAKE2b-256 | df916fbdda3a795c71ca22f9ad471db58343101d7bbd7c079ff87445abbc2cdc |
File details
Details for the file PyUniversalLibrary-20061020.win32.exe
.
File metadata
- Download URL: PyUniversalLibrary-20061020.win32.exe
- Upload date:
- Size: 75.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 632a9d4fd181e74bec9c8b2d3fede33d701df7f38be7869377edf55f72d9751f |
|
MD5 | 9a339e5912322c3125f634b798e31682 |
|
BLAKE2b-256 | a4a6789b44f2c753c331b127dc21e4a02255d433b1e6e204913c786b57a615fe |