Welcome to Slave¶
This is the documentation of the Slave library, a micro framework designed to simplify instrument communication and control. It is divided into three parts, a quick overview, the user guide and of course the api reference.
Slave provides an intuitive way of creating instrument api’s, inspired by object relational mappers.
from slave.iec60488 import IEC60488, PowerOn from slave.driver import Command from slave.types import Integer, Enum class Device(IEC60488, PowerOn): """An iec60488 conforming device api with additional commands.""" def __init__(self, transport): super(Device, self).__init__(transport) # A custom command self.my_command = Command( 'QRY?', # query message header 'WRT', # command message header # response and command data type [Integer, Enum('first', 'second')] )
Commands mimic instance attributes. Read access queries the device, parses and converts the response and finally returns it. Write access parses and converts the arguments and sends them to the device. This leads to very intuitive interfaces.
Several device drivers are already implemented, and many more are under development. A short usage example is given below
#!/usr/bin/env python import time from slave.srs import SR830 from slave.transport import Visa lockin = SR830(Visa('GPIB::08')) lockin.frequency = 22.08 lockin.amplitude = 5.0 lockin.reserve = 'high' for i in range(60): print lockin.x time.sleep(1)
For a complete list of built-in device drivers, see Built-in Device Drivers.
- Installing Slave
- Basic Concepts
- Built-in Device Drivers
- Usage Examples
- slave Changelog
This part of the documentation covers the complete api of the slave library.