Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python3
import pyvisa as visa
def main():
# Connect to the device
rm = visa.ResourceManager()
instrument = rm.open_resource("TCPIP0::192.168.10.94::inst0::INSTR") # replace with IP address of your device
instrument.timeout = 200000
device_id = instrument.query("*IDN?")
print(device_id)
import pyvisa as visa
def main():
ip = "192.168.10.13"
device = visa.ResourceManager().open_resource(f"TCPIP0::{ip}::INSTR")
device_id = device.query("*IDN?")
print(f"Device ID: {device_id}")
date = device.query(":SYST:DATE?")
print("Date:", date)
time = device.query(":SYST:TIME?")
@steveway
steveway / siglent_sdm.py
Created January 24, 2025 08:07
Reading speed test for Siglent Multimeters
#! /usr/bin/env python3
import pyvisa as visa
from serial.serialutil import SerialException
import time
def main():
# Get list of connected devices
rm = visa.ResourceManager()
device_list = {}
@steveway
steveway / siglent_spd.py
Created December 20, 2024 14:20
Example for Siglent SPD4000 devices
#! /usr/bin/env python3
import pyvisa as visa
from serial.serialutil import SerialException
def main():
# Get list of connected devices
rm = visa.ResourceManager()
device_list = {}
for device_name in rm.list_resources():
@steveway
steveway / rigol_dho_waveform.py
Created November 22, 2024 14:53
This should get the Waveform Data from the new Rigol DHO devices and formats it to be identical to saved .csv files from the device itself.
#! /usr/bin/env python3
import pyvisa as visa
from serial.serialutil import SerialException
from decimal import Decimal, getcontext
def main():
# Get list of connected devices
rm = visa.ResourceManager()
device_list = {}
for device_name in rm.list_resources():
@steveway
steveway / waveformconvert.py
Last active February 16, 2023 12:39
Converts saved CSV files from Siglent Oscilloscopes to be opened with EasyWaveX
import argparse
import csv
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="Input file", required=True)
parser.add_argument("-o", "--output", help="Output file", required=True)
args = parser.parse_args()
data_length = 0
@steveway
steveway / siglent_pnsu.py
Created November 28, 2022 11:25
Receives the configuration of a Siglent Oscilloscope using the PNSU command.
#! /usr/bin/env python3
import pyvisa as visa
from serial.serialutil import SerialException
def main():
# Get list of connected Siglent devices
rm = visa.ResourceManager()
device_list = {}
for device_name in rm.list_resources():
@steveway
steveway / change_csv.py
Created June 14, 2022 09:45
This changes a SDM3000X saved .csv file so it can be opened via EasyDMM
import csv
import argparse
# this function will remove the first row and first column from the csv file
def remove_first_row_and_first_column(input_file):
temp_csv = []
with open(input_file, 'r') as f:
reader = csv.reader(f)
# remove the first row
@steveway
steveway / rigol_screenshot.py
Created October 16, 2019 14:38
This should currently be able to take a screenshot Rigol DS1000E devices. (Tested with 2 DS1102E connected)
#! /usr/bin/env python3
import visa
def main():
# Get list of connected Rigol devices
rm = visa.ResourceManager()
device_list = {}
for device_name in rm.list_resources():
device_id = ""
@steveway
steveway / papagayo_import.py
Last active September 6, 2021 11:08
A simple script that creates Greasepencil Layers and frames based on a .pg2 project. (Unfinished)
bl_info = {
"name": "Papagayo-NG 2D Importer",
"author": "Stefan Murawski",
"version": (0, 0, 1),
"blender": (2, 80, 0),
"location": "3D window > Tool Shelf",
"description": "Create GreasePencil Object with Layers and Keyframes from Papagayo-NG .pg2 files.",
"warning": "",
"wiki_url": ""
"Scripts/Import-Export/Papagayo 2D Importer",