pyvisa通过python控制hp/agilent/keysight mso-x/dso-x 3000a示波器

msox3000的Python项目详细描述


msox3000系列

通过控制HP/Agilent/Keylight MSO-X/DSO-X 3000A示波器 python via pyvisa

以我以前在dcps方面的工作为指导,本文旨在 控制各种示波器的通用软件包。然而,它是 预期很少示波器共享相同的命令,因此启动 作为专门用于mso-x/dso-x 3000a的python类关闭 示波器。所以我们会开始瞄准示波器家族 使用一个普通的scpi.py类。如果对其他人有用 示波器,然后将创建一个新的项目,但至少这一个 会从这个开始的。

它也可以在mso-x/dso-x 2000a示波器上工作,但我没有 调查了不同之处,但不能确定。试试看,让我 知道

与dcps一样,这将使用brilliant pyvisa python包和 pyvisa py访问模式消除了对 要在您的计算机上安装的visa库。

安装

您需要安装pyvisa和pyvisa py包

要安装msox3000软件包,请运行以下命令:

python setup.py install

或者,可以将此包的路径添加到环境中 变量pythonpath,甚至在 python脚本。使用您喜爱的web搜索引擎查找更多 细节。

更好的是,msox3000在pypi上。所以你可以简单地使用 而且所需的依赖项应该为您安装:

pip install msox3000

要求

使用pyvisa py,不必安装 仪器NIVA驱动器。

使用量

代码是控制和访问 支持的示波器。

如果运行嵌入在各个包源文件中的示例, 确保编辑资源字符串或visa描述符 特殊装置。对于msox3000.py,还可以设置环境 变量,msox3000_在运行 代码

# Lookup environment variable MSOX3000_IP and use it as the resource# name or use the TCPIP0 string if the environment variable does# not existfrommsox3000importMSOX3000fromosimportenvironresource=environ.get('MSOX3000_IP','TCPIP0::172.16.2.13::INSTR')# create your visa instrumentinstr=MSOX3000(resource)instr.open()# set to channel 1## NOTE: can pass channel to each method or just set it# once and it becomes the default for all following calls. If pass the# channel to a Class method call, it will become the default for# following method calls.instr.channel=1# Enable output of channel, if it is not already enabledifnotinstr.isOutputOn():instr.outputOn()# Install measurements to display in statistics display and also# return their current values hereprint('Ch. {} Settings: {:6.4e} V  PW {:6.4e} s\n'.format(instr.channel,instr.measureVoltAverage(install=True),instr.measurePosPulseWidth(install=True)))# Add an annotation to the screen before hardcopyinstr._instWrite("DISPlay:ANN ON")instr._instWrite('DISPlay:ANN:TEXT "{}\\n{} {}"'.format('Example of Annotation','for Channel',instr.channel))instr._instWrite("DISPlay:ANN:COLor CH{}".format(instr.channel))# Change label of the channel to "MySig"instr._instWrite('CHAN{}:LABel "MySig"'.format(instr.channel))instr._instWrite('DISPlay:LABel ON')# Make sure the statistics display is showinginstr._instWrite("SYSTem:MENU MEASure")instr._instWrite("MEASure:STATistics:DISPlay ON")## Save a hardcopy of the screen to file 'outfile.png'instr.hardcopy('outfile.png')# Change label back to the defaultinstr._instWrite('CHAN{}:LABel "{}"'.format(instr.channel,instr.channel))instr._instWrite('DISPlay:LABel OFF')# Turn off the annotationinstr._instWrite("DISPlay:ANN OFF")# turn off the channelinstr.outputOff()# return to LOCAL modeinstr.setLocal()instr.close()

更进一步

这实现了可用命令的一小部分。

有关HP/Agilent/Keysight的可能功能的信息 mso-x/dso-x 3000a,请参见Keysight InfiniiVision 3000 X-Series Oscilloscopes Programming Guide

对于符合ieee标准的通用仪器来说 488 scpi规范,如mso-x 3000a,请参见SCPI 1999 SpecificationSCPI Wikipedia 进入

接触

请将错误报告或反馈发送给Stephen Goadhouse

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

推荐PyPI第三方库


热门话题
java将Scanner对象作为构造函数参数传递给UserInterface类   spring未能启动bean“subtocolWebSocketHandler”;嵌套的例外是java。lang.IllegalArgumentException:没有处理程序   Java EE应用程序中后台服务的多线程Java线程(设置守护进程和优先级)?   java Pull to refresh返回列表的第一个位置   无法将comparator类转换为java。可比的   java将json从servlet传递到dojo   JavaHibernate:将子类实例转换为超类实例   java警告调用servlet类时非法反射访问   java静态变量值   java@Entity和@embeddeble之间有什么区别   java将作业配置导入公共作业配置类(注释配置)   sql公共表表达式(以values语句开头)在java中给出错误   java在ImageJ中使用ImageProcessor   java PostgreSQL executeBatch()会随着时间的推移而变慢   java在安卓中以表格形式排列sqllite表数据?   java中SVG的swing定制呈现   java删除与另一个实体映射的实体   java何时/如何添加ListView适配器,使用back按钮恢复它?(片段)   java为什么IBinder和Binder之间的类型转换不是非法的?   java在方法参数列表中使用ArrayList或List