一个轻量级的python包,用于简化与多个科学仪器的通信。
slave的Python项目详细描述
Slave是一个微型框架,旨在简化仪器通信和 控件,并附带各种随时可用的设备驱动程序。
概述
slave提供了一种直观的方法来创建工具api,灵感来自 对象关系映射器。
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')] )
命令模拟实例属性。read access查询设备,解析和 转换响应并最终返回它。写访问解析和转换 参数并将它们发送到设备。这导致了非常直观的 接口。
已经实现了几个设备驱动程序,还有更多的设备驱动程序在 发展。下面给出了一个简短的用法示例:
import time from slave.transport import Visa from slave.srs import SR830 lockin = SR830(Visa('GPIB::08')) # configure the lockin amplifier lockin.reserve = 'high' lockin.time_constant = 3 # take 60 measurements and print the result for i in range(60): print lockin.x time.sleep(1)
要求
- Python 2.6 or higher
- Sphinx (optional, to build the documentation)
- sphinx_bootstrap_theme(optional, default theme used for the documentation)
- distribute (Python 3.x)
安装
要安装从机,只需键入
python setup.py install
文档
奴隶被完全记录在案。最新的stable和develop 文件可在线获取。手动生成文档,例如 html文档,导航到/doc/子文件夹并执行 制作HTML。要获得更漂亮的主题,请先安装sphinx_boostrap_theme (pip install sphinx_bootstrap_theme)。
许可
你应该收到一份GNU General Public License的副本 从机;参见文件复制。