Python仪器驱动程序 [英] Python instrument drivers

查看:145
本文介绍了Python仪器驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名实验物理学家,并且是 Python 的狂热爱好者.

I am an experimental physicist and am a big enthusiast of Python.

我发现它非常适合数据分析和脚本编写,实际上,我还使用它来连接实验室仪器(网络分析仪,示波器,信号分析仪和信号发生器...). 我认为Python在我的领域将是 MATLAB 的非常重要的竞争对手包含仪器驱动程序的库.

I find it great for data analysis and scripting, and I actualy also use it to interface laboratory instruments (network analyzer, scopes, signal analyzers, and signal generators...). I think Python would be a very serious competitor for MATLAB in my field if there would exist a nice library incorporating instrument drivers.

到目前为止,我一直在使用几种策略直接从我的 IPython 进行接口会话:

Up to now, I have been using several strategies to interface them directly from my IPython session:

  • 使用pyVisa库,该库很好,适用于大多数设备,但是有点底层,并且需要额外的编程层才能向用户提供有用的功能.

  • Using the library pyVisa, which is nice, working for the large majority of devices, but a little bit low-level, and requires an extra layer of programming to expose useful functions to the user.

我最近能够使用pythondotnet使用IVI-COM或.NET驱动程序(不是 IronPython ,缺少 NumPy /

I have been able recently to use IVI-COM or .NET drivers using pythondotnet (not IronPython, which lacks NumPy/Matplotlib... libraries). This solution is obviously the most satisfying one because the IVI drivers are already quite high level, and they are usually provided by the vendors and instruments from different vendors are then interchangeable.

我的第一个问题是一个比较技术性的问题: 我到处都读到 COM 对象已集成到.NET框架中,并且可以使用COM对象在.NET中直接就我而言,我可以通过导入comtypes模块来使用COM对象(请参见

My first question is a rather technical one: I read everywhere that COM objects are integrated in the .NET framework and that you can use COM objets diretly in .NET. In my case, I'm able to use COM objects by importing the comtypes module (see http://code.activestate.com/recipes/578089-using-iviscope-instrument-driver-with-python/) and dotnet with clr from pythondotnet, but I simply don't understand how to access those COM objects with the clr module. Can someone explain the link between COM and .NET?

此外,我总是有些困惑,我怎么知道,当我有一个DLL文件时,是否包含.NET模块,以及是否可以使用.NET 4.0版打开它(我是这些框架问题的完整入门者,并且可以很好地链接到相应的文档)?

Also, I am always a little bit confused, how do I know, when I have a DLL file, if this is containing a .NET module or not, and if I can open it with version 4.0 of .NET (I am a complete beginner in these framework issues and a link to the proper documentation would be perfectly fine)?

第二个问题是,更笼统地说,是否有一个模块已经以统一的方式收集了用于不同仪器的大量驱动程序?在我看来,我们必须有成千上万的人致力于同一问题.

The second question is, more generally, is there not a module that would already gather a larger number of drivers for different instruments in a unified manner? It seems to me like we must be thousands of people working on the same issues.

我最近发现模块lantz http://lantz.glugcen.dc.uba.ar/. 不幸的是,这是在Python 3.0中,而我仍在使用Python 2.7(适用于Windows的pythonxy发行版).此外,我对该项目没有尝试实施IVI建议感到恐惧,这将是一个很好的起点.

I recently fell on the module lantz http://lantz.glugcen.dc.uba.ar/. Unfortunately, this is in Python 3.0, while I am still using Python 2.7 (with the pythonxy distribution for Windows). Moreover, I am a bit afraid by the fact that this project is not trying to implement the IVI recommendations, which would be a good starting point.

任何评论或链接到相关信息源都将受到欢迎.

Any comment or link to a relevant source of information would be more than welcome.

推荐答案

我无法说出您的第一个问题,但是我一直在这里进行IVI标准的Python解释:

I cannot speak to the first question of yours, but I have been working on a Python interpretation of the IVI standard here: https://github.com/python-ivi/python-ivi. Unfortunately, it's also Python 3, but it's pure Python (no importing of external DLL files, COM or .NET objects), so it may not be exactly what you're looking for. However, the advantage is that means it's cross-platform and should work in both Windows and Linux.

Python IVI(以及仪器接口python-vxi11和python-usbtmc)已更新为无缝支持Python 2和Python3.它仍然是纯Python,因此没有外部二进制依赖项(DLL文件,COM或). NET对象),并且可以在Windows,Linux和Mac OS X上运行.它甚至已经在 Raspberry Pi 上运行.此外,Python IVI可以使用PyVISA来访问 National Instruments 兼容的硬件.

Python IVI (and the instrument interfaces python-vxi11 and python-usbtmc) has been updated to seamlessly support both Python 2 and Python 3. It's still pure Python, so there are no external binary dependencies (DLL files, COM or .NET objects) and it works on Windows, Linux, and Mac OS X. It has even been run on a Raspberry Pi. Also, Python IVI can use PyVISA to access National Instruments compatible hardware.

我之所以称其为解释而不是实现,是因为它不能完全按照字母的说明进行操作,仅因为它是Python.我试图尽可能严格地遵循该规范,但是我也尝试将其保持为pythonic.不过,它还不到一岁,而且我是目前唯一从事此工作的人,我的仪器种类繁多.如果那里有人想帮忙,我会很乐意接受捐款.

I am calling this an interpretation and not an implementation, because it cannot follow the specification to the letter simply because it's Python. I have tried to follow the specification as closely as possible, but I have also tried to keep it as pythonic as possible. It's less than a year old, though, and I'm currently the only one working on it, with my meager assortment of instruments. I would be more than happy to accept contributions, if there are people out there who want to help out.

开箱即用,python-ivi通过python-vxi11模块支持LAN上的VXI-11协议(我相信,与大多数LXI仪器兼容)(python-vxi11也是纯Python,因此跨平台兼容) ),带有pySerial(跨平台)的串行仪器支持和带有linux-gpib(仅Linux)的GPIB支持.我计划还包装PyVISA,以便python-ivi能够使用PyVISA支持的所有接口.

Out of the box, python-ivi supports the VXI-11 protocol over LAN (compatible, I believe, with most LXI instruments) through the python-vxi11 module (python-vxi11 is also pure Python and thus cross-platform compatible), serial instrument support with pySerial (cross-platform), and GPIB support with linux-gpib (Linux only). I plan on also wrapping PyVISA so that python-ivi will be able to use all of the interfaces supported by PyVISA.

这篇关于Python仪器驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆