用于测量计算daq设备的通用库python api

uldaq的Python项目详细描述


InfoContains a Python API for interacting with Measurement Computing’s Universal Library for Linux.
AuthorMeasurement Computing

关于

uldaqpython包包含一个api(应用程序编程接口) 用于与测量计算数据采集设备交互。包已实现 作为使用ctypespython库的ul for linux c api的面向对象包装器。

uldaq支持python 2.7、3.4+

先决条件

运行uldaqpython api需要UL for Linux C API

安装uldaqpython api需要Python以及pipsetuptoolswheel包。

  • 有关安装python的更多信息,请转到python.org
  • 有关使用pip安装python包的更多信息,请参见 Installing Packagespython.org上的教程。

安装

使用以下命令安装uldaqpython api:

$ pip install uldaq
Note: Installation may need to be run with sudo.

示例

源tarball中包含了一组完整的示例。 要获取并运行示例,请执行以下步骤:

  1. 转到pypi.org/project/uldaq

  2. 导航下单击Download files链接。

  3. 单击uldaq-1.1.1.tar.gz链接下载文件。

  4. 将文件从默认下载位置复制到所需位置。

  5. 导航到文件位置并运行:

    $ tar -xvf uldaq-1.1.1.tar.gz
    
  6. python示例位于examples文件夹中。运行以下命令以执行模拟输入示例:

    $ cd uldaq-1.1.1/examples
    $ ./a_in.py
    
Note: For best results, run examples in a terminal window.

用法

下面是一个简单的示例,用于从中的每个通道读取单个电压值 测量计算数据采集装置的模拟输入子系统。

fromuldaqimport(get_daq_device_inventory,DaqDevice,InterfaceType,AiInputMode,Range,AInFlag)try:# Get a list of available DAQ devicesdevices=get_daq_device_inventory(InterfaceType.USB)# Create a DaqDevice Object and connect to the devicedaq_device=DaqDevice(devices[0])daq_device.connect()# Get AiDevice and AiInfo objects for the analog input subsystemai_device=daq_device.get_ai_device()ai_info=ai_device.get_info()# Read and display voltage values for all analog input channelsforchannelinrange(ai_info.get_num_chans()):data=ai_device.a_in(channel,AiInputMode.SINGLE_ENDED,Range.BIP10VOLTS,AInFlag.DEFAULT)print('Channel',channel,'Data:',data)daq_device.disconnect()daq_device.release()exceptULExceptionase:print('\n',e)# Display any error messages

使用with块的相同示例:

fromuldaqimport(get_daq_device_inventory,DaqDevice,InterfaceType,AiInputMode,Range,AInFlag)try:# Get a list of available devicesdevices=get_daq_device_inventory(InterfaceType.USB)# Create a DaqDevice Object and connect to the devicewithDaqDevice(devices[0])asdaq_device:# Get AiDevice and AiInfo objects for the analog input subsystemai_device=daq_device.get_ai_device()ai_info=ai_device.get_info()# Read and display voltage values for all analog input channelsforchannelinrange(ai_info.get_num_chans()):data=ai_device.a_in(channel,AiInputMode.SINGLE_ENDED,Range.BIP10VOLTS,AInFlag.DEFAULT)print('Channel',channel,'Data:',data)exceptULExceptionase:print('\n',e)# Display any error messages

支持/反馈

mcc支持uldaq包。有关uldaq支持,请联系技术支持 通过mccdaq.com/Support.aspx。请包括python的版本信息, 使用的uldaq c api和uldaq python api包以及有关如何复制 问题。

文档

文档可在mccdaq.com获得。

许可证

uldaq在麻省理工学院风格的许可下获得许可。其他注册项目可根据 不同的许可证。所有许可证均允许非商业和商业用途。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何获取所有链接并使用SeleniumWebDriver逐个单击这些链接   java中数组列表的arraylist移位元素   java如何存储具有不同类型参数的元素   java不能使用List<Future<?>>当从不同位置调用时,在方法参数中   java我应该如何修复代码以避免测试代码出错?   安卓 PreferenceFragment java。lang.RuntimeException   java在运行emulator时发现错误   java取消多个AsyncTask回调的有效方法是什么?如果中途满足条件,这些回调将在将来返回?   有没有办法在运行时将方法动态分配给Java类?   java如何将propertyfile与GlassFish一起使用   如何在PHP中使用bcrypt对密码进行哈希处理?   Java和UDP web服务器   java JPA允许EntityListeners执行JPA操作吗?   java执行do while语句时不会产生错误   java无法在edittext中显示数据库中的数据   java Tomcat中活动会话的数量   java在何处使用@SuppressWarnings(“requestfactory”)   netty连接中的java HornetQ异常