Figure 1. The programmatic interface (PI) stack shows the flow of information between a host controller and instrument.
What is the tm_devices Package? tm_devices is a device management package developed by Tektronix that includes a multitude of commands and functions to help users easily automate tests on Tektronix and Keithley products using the programming language Python. It can be used in the most popular IDEs for Python and supports code-completion aids. This package makes coding and test automation simple and easy for engineers with software skills of any level. Installation is also simple and uses pip, Python’s package-management system. Setting up your Environment This section will guide you through the prerequisites and installations to prepare you to do development work with tm_devices. It also includes instructions that support virtual environments in Python (venvs) to make your projects easier to manage and maintain, especially if you are just trying this package out before committing to its usage. Note: If you have an environment without direct access to the internet you will have to modify your steps using the commands in the appendix. If you are having problems feel free to post in the github discussions for assistance. Installation and Prerequisites Overview Install Python Python ≥ 3.8 PyCharm – PyCharm Installation, Starting a project, and tm_devices installation VSCode – VSCode Installation, Starting a project, and tm_devices installation PyCharm Community (free) edition PyCharm is a is a popular Python IDE used by software developers across all industries. PyCharm has an integrated unit tester which allows users to run tests by file, class, method, or all tests within a folder. Like most modern IDE’s it has a form of code completion that speeds up your development tremendously over a basic text editor. We will walk through the installation PyCharm community edition (free), followed by installing tm_devices in the IDE and setting up a virtual environment to develop in. 1. Go to https://www.jetbrains.com/pycharm/ 2. Scroll past PyCharm Professional to PyCharm Community Edition, click download
3. You should be able to proceed with just the default installation steps. We do not require anything unique.
4. Welcome to PyCharm!
5. Now you will need to create a new project and make sure to set up a virtual environment. Click “New Project” 6. Confirm path for project, make sure “Virtualenv” is selected
7. Open a terminal. If your view does not include the labeled button at the bottom look for this:
8. Confirm virtual environment is set up by checking for (venv) before the prompt in your terminal
9. Install driver from the terminal Type: pip install tm_devices Python.exe -m pip install -upgrade pip
10. Your terminal should be error free! Happy hacking! Visual Studio Code Visual Studio Code is another popular free IDE that software developers across all industries use. It is great for most languages and has extensions for most languages that make coding in this IDE very convenient and efficient. Visual Studio Code provides IntelliSense which is an extremely useful tool when developing as it aids in code completion, parameter information, and other information regarding objects and classes. Conveniently, tm_devices supports code completion that describes the command tree of the objects and classes. We have an excellent guide on the installation of both Python and Visual Studio Code, including information on virtual environment setup here. Example Code In this section we will step through pieces of a simple code example and highlight some necessary components to use tm_devices effectively. Imports from tm_devices import DeviceManager from tm_devices.drivers import MSO5B
These two lines are critical to the effective usage of tm_devices. In the first line we import the DeviceManager. This will handle the boilerplate connecting and disconnecting of multiple device classes. In the second line we import a specific driver, in this case the MSO5B. We setup a context manager with the DeviceManager: with DeviceManager (verbose=True) as device_manager:
And then when we use the device manager and driver together: scope :MSO5B= device_manager.add_scope ("192.168.1.1")
We can instantiate an instrument with a specific command set that matches its model. Just input your instrument’s IP address (other VISA addresses work as well). With these four lines complete, we are able to start writing meaningful and specific automation for the MSO5B! Code Snippets Let’s take a look at a few simple actions - Setting the Trigger type to Edge # Setting Trigger A to Edge scope.commands.trigger.a.type.write ("EDGE")
Here’s how you would add and query a peak-to-peak measurement on CH1: # Specifying source as Channel 1 scope.commands.display.select.source.write("CH1") # Identifying pk2pk as the measurement we would like to make scope.commands.measurement.addmeas.write('PK2Pk' ) # Make sure the operation is complete using the opc command scope.commands.opc.query() # Store the value locally before we print chipk2pk = float(scope.commands.measurement.meas[1].results.allacqs.mean.query()) # Printing the value onto the console print(f 'Channel 1 pk2pk: {ch1pk2pk}')
If you wanted to take an amplitude measurement on CH2: # Specifying source as channel 2 scope.commands.display.select.source.write("CH2") # Identifying amplitude as the measurement we would like to make scope.commands.measurement.addmeas.write('AMPLITUDE') # Make sure the operation is complete using the opc command scope.commands.opc.query() # Store the value locally before we print champ = float(scope.commands.measurement.meas[2].results.allacqs.mean.query()) # Print the value onto the console print(f' amplitude: {ch2amp}')
Using IntelliSense/Code Completion IntelliSense – Microsoft’s name for Code Completion is a very powerful feature of IDE’s we have tried to exploit as much as possible. One of the core barriers to automation with test and measurement devices is the SCPI command set. It is a dated structure with syntax not widely supported in the development community. What we have done with tm_devices is create a set of Python commands for each SCPI command. This allowed us to generate Python code from existing command syntax to avoid manual development of the drivers, as well as create a structure that is familiar to existing SCPI users. It also maps to the lower-level code that might require intentional debugging during your program creation. The structure of the Python commands mimics the SCPI (or in some Keithley cases TSP) commands structure so if you are familiar with SCPI you will be familiar with these. This is an example of how IntelliSense shows all the commands available with the previously typed command: In the scrollable list that appears after the dot on scope we can see an alphabetical list of scope command categories:
Choosing afg we are able to then see a list of AFG categories:
Final command written with the help of IntelliSense: scope.commands.afg.amplitude.write(10e6)
Docstring Help As you code, or as you are reading someone else’s code, you can hover over different parts of the syntax to get that level’s specific help documentation. The closer you are to the full command syntax the more specific it will get.
Depending on your IDE conditions you can display both IntelliSense and docstring help at the same time.
With this guide you have seen some of the benefits of Tek’s python driver package tm_devices and can start your automation journey. With the easy setup, code completion, and built-in help you will be able to learn without leaving your IDE, speed up your development time, and code with higher confidence. There are contribution guidelines in the Github repo if you wish to improve the package. There are plenty of more advanced examples highlighted in the documentation and within the package contents in the Examples folder. Extra Resources tm_devices · PyPI – Package driver download and information tm_devices Github - Source code, issue tracking, contribution tm_devices Github - Online Documentation Troubleshooting Upgrading pip is usually a good first step to troubleshooting: In your terminal type: Python.exe -m pip install -upgrade pip Error: whl looks like a filename, but file does not exist OR .whl is not a supported wheel on this platform.
Solution: Pip installing wheel so that it recognizes the file format. In your terminal type: pip install wheel If you are needing to install wheel offline you can follow similar instructions as Appendix A, but it requires the tar.gz download instead of the .whl file. Appendix A – Offline Installation of tm_devices 1. On a computer with internet, download the package along with all dependencies to the specified path location using: pip download --dest wheel setuptools tm_devices 2. Copy the files to your computer that does not have internet access 3. Then, follow the instructions from the main guide for whichever IDE you are using but swap the install command for the following: pip install --no-index --find-links tm_devices Find more valuable resources at TEK.COM dev.tek.com is our growing hub of resources for test and measurement automation—whether you're just getting started or searching for something specific, you'll find drivers, command sets, Python libraries, and more to help you automate Tektronix oscilloscopes, SMUs, and other test equipment. Get technical assistance. Request help or tell us what resources you’d like to see. © 2025 Tektronix, Inc. Privacy Terms and Conditions Terms of Use Feedback Tek.com
智能索引记录
-
2026-02-28 23:14:26
图片素材
成功
标题:围巾的作文250字 描写围巾的作文 关于围巾的作文-作文网
简介:作文网精选关于围巾的250字作文,包含围巾的作文素材,关于围巾的作文题目,以围巾为话题的250字作文大全,作文网原创名师
-
2026-03-01 19:38:12
教育培训
成功
标题:真正的幸福作文600字8篇
简介:在日常的学习、工作、生活中,大家都经常看到作文的身影吧,作文要求篇章结构完整,一定要避免无结尾作文的出现。怎么写作文才能
-
2026-03-02 10:11:08
综合导航
成功
标题:我的梦想英语作文6篇
简介:在我们平凡的日常里,大家都经常看到作文的身影吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、自己能明白的语言
-
2026-03-01 19:29:19
综合导航
成功
标题:Western Solitaire - Play The Free Mobile Game Online
简介:Western Solitaire - click to play online. Western has a cool
-
2026-03-01 17:22:12
综合导航
成功
标题:四年级动物作文三篇
简介:在学习、工作、生活中,大家都经常看到作文的身影吧,作文是一种言语活动,具有高度的综合性和创造性。怎么写作文才能避免踩雷呢
-
2026-03-02 09:54:58
图片素材
成功
标题:段扩写的作文2000字 描写段扩写的作文 关于段扩写的作文-作文网
简介:作文网精选关于段扩写的2000字作文,包含段扩写的作文素材,关于段扩写的作文题目,以段扩写为话题的2000字作文大全,作
-
2026-03-01 00:55:02
图片素材
成功
标题:彼此的作文2000字 描写彼此的作文 关于彼此的作文-作文网
简介:作文网精选关于彼此的2000字作文,包含彼此的作文素材,关于彼此的作文题目,以彼此为话题的2000字作文大全,作文网原创
-
2026-03-01 01:19:57
综合导航
成功
标题:IONOS » Hosting Provider Websites. Domains. Server.
简介:IONOS, your digital partner for cloud solutions and web host
-
2026-03-01 18:58:04
综合导航
成功
标题:奔跑作文600字集合(4篇)
简介:在日复一日的学习、工作或生活中,大家都不可避免地会接触到作文吧,作文是一种言语活动,具有高度的综合性和创造性。一篇什么样
-
2026-02-28 23:23:56
综合导航
成功
标题:驱动人生官网-显卡驱动_打印机驱动_网卡驱动_声卡驱动等驱动程序下载及检测平台
简介:驱动人生是一款提供电脑驱动下载和安装自动化的软件,通过驱动人生可一键安装显卡驱动、网卡驱动、声卡驱动、打印机驱动、万能网
-
2026-03-01 17:28:46
综合导航
成功
标题:小学五年级作文
简介:在平时的学习、工作或生活中,大家或多或少都会接触过作文吧,作文是一种言语活动,具有高度的综合性和创造性。还是对作文一筹莫
-
2026-03-01 21:53:07
教育培训
成功
标题:精选学校的一件事作文三篇
简介:在日复一日的学习、工作或生活中,大家总少不了接触作文吧,作文可分为小学作文、中学作文、大学作文(论文)。相信许多人会觉得
-
2026-03-02 10:02:43
综合导航
成功
标题:【必备】想象的世界的作文300字3篇
简介:在平平淡淡的日常中,大家都不可避免地会接触到作文吧,借助作文人们可以实现文化交流的目的。作文的注意事项有许多,你确定会写
-
2026-03-01 19:44:48
综合导航
成功
标题:Blockchain Game Weekly Azra Games Completes $42 Million Series A Financing, Led by Pantera Capital; APE Weekly Increas Bee Network
简介:Original Odaily Planet Daily ( @OdailyChina ) Author As
-
2026-02-28 09:17:24
综合导航
成功
标题:태광글로벌
简介:광주전광판 제작및 설치 .미세먼지전광판. 동영상전광판 ,현수막전광판
-
2026-03-01 01:01:27
综合导航
成功
标题:Fantasy Football: Breaking down every free agent NFL QB
简介:PFF
-
2026-02-28 14:57:23
综合导航
成功
标题:PlayStation Universe - PS5, PS4, PSVR, PS Vita News and Reviews
简介:PS5 News, PS4 News, PSVR and PS Vita News, Reviews, Themes,
-
2026-02-28 23:30:13
综合导航
成功
标题:qq空间感人说说-励志一生
简介:qq空间感人说说_ qq空间感人说说 1、有时候,不小心知道了一些事,才发现自己所在乎的事是那么可笑。 2、很多人
-
2026-03-01 13:40:18
综合导航
成功
标题:Word Search Explorer - Nyt Strands Daily Challenge
简介:Word Search is a casual, easy-to-play, free word puzzle game
-
2026-03-01 00:59:16
图片素材
成功
标题:蛇的作文650字 描写蛇的作文 关于蛇的作文-作文网
简介:作文网精选关于蛇的650字作文,包含蛇的作文素材,关于蛇的作文题目,以蛇为话题的650字作文大全,作文网原创名师点评,欢
-
2026-02-28 08:27:56
综合导航
成功
标题:property writableHighWaterMark Node.js zlib module Bun
简介:Return the value of `highWaterMark` passed when creating thi
-
2026-02-28 08:10:25
综合导航
成功
标题:Special Election Results Update— - Classic Hits 100.7 KLOG
简介:100.7 KLOG - Classic Hits, Local News and Sports
-
2026-02-28 07:57:29
综合导航
成功
标题:Tech Innovation Archives - Making Sense of the Infinite
简介:Tech Innovation Archives - Making Sense of the Infinite
-
2026-03-01 19:30:31
综合导航
成功
标题:难忘的一件事的作文
简介:在平平淡淡的日常中,许多人都有过写作文的经历,对作文都不陌生吧,作文是由文字组成,经过人的思想考虑,通过语言组织来表达一
-
2026-03-01 13:45:27
综合导航
成功
标题:AI智能索引 - AI智能索引
简介:AI智能索引 - 提供全网公开链接智能索引服务,快速访问目标内容,支持分类筛选和智能导航
-
2026-03-01 01:10:12
综合导航
成功
标题:渡航先で電話を受ける Galaxy S24 FE オンラインマニュアル(取扱説明書) au
简介:auのスマートフォン「Galaxy S24 FE(ギャラクシー エストゥエンティフォー エフイー)」Android15版
-
2026-03-01 13:03:25
综合导航
成功
标题:IOSG Ventures: Insights and thoughts on the consumer application track Bee Network
简介:Original author: MaxWong@IOSG TL;DR Infrastructure is sa
-
2026-02-28 14:09:50
综合导航
成功
标题:心率失常会死吗 - 云大夫
简介:大多数心律失常是不会引起生命危险的。但有些心律失常还是很危险的,如室颤。室颤是死亡前出现的一种非常严重的心律失常,这需要
-
2026-03-02 10:11:36
图片素材
成功
标题:登场的作文 描写登场的作文 关于登场的作文 素材-作文网
简介:作文网精选关于登场的作文,包含登场的作文素材,关于登场的作文题目,以登场为话题的作文大全,作文网原创名师点评,欢迎投稿!
-
2026-03-01 19:22:28
教育培训
成功
标题:礼物的作文300字[大全10篇]
简介:在学习、工作、生活中,大家一定都接触过作文吧,借助作文可以提高我们的语言组织能力。一篇什么样的作文才能称之为优秀作文呢?