DS1000C Rigol Waveform Examples
Scott Prahl
Mar 2021
This notebook illustrates shows how to extract signals from a .wfm
file created by a the Rigol DS1202CA scope.
If RigolWFM is not installed, uncomment the following cell (i.e., delete the #) and run (shift-enter)
[1]:
#!pip install --user RigolWFM
[2]:
import numpy as np
import matplotlib.pyplot as plt
try:
import RigolWFM.wfm as rigol
except ModuleNotFoundError:
print('RigolWFM not installed. To install, uncomment and run the cell above.')
print('Once installation is successful, rerun this cell again.')
repo = "https://github.com/scottprahl/RigolWFM/raw/master/wfm/"
A list of Rigol scopes in the DS1000C family is:
[3]:
print(rigol.DS1000C_scopes[:])
['C', '1000C', 'DS1000C', 'DS1000CD', 'DS1000C', 'DS1000MD', 'DS1000M', 'DS1302CA', 'DS1202CA', 'DS1102CA', 'DS1062CA']
DS1202CA
We will start with a .wfm
file from a Rigol DS1202CA scope.
Now for the .wfm
data
First a textual description.
[4]:
# raw=true is needed because this is a binary file
wfm_url = "https://github.com/scottprahl/RigolWFM/raw/master/wfm/DS1202CA-A.wfm" + "?raw=true"
w = rigol.Wfm.from_url(wfm_url, '1000C')
description = w.describe()
print(description)
downloading 'https://github.com/scottprahl/RigolWFM/raw/master/wfm/DS1202CA-A.wfm?raw=true'
General:
File Model = wfm1000c
User Model = 1000C
Parser Model = wfm1000c
Firmware = unknown
Filename = DS1202CA-A.wfm
Channels = [1, 2]
Channel 1:
Coupling = unknown
Scale = 200.00 mV/div
Offset = -608.00 mV
Probe = 1X
Inverted = False
Time Base = 10.000 ms/div
Offset = -1.600 ms
Delta = 100.000 µs/point
Points = 5120
Count = [ 1, 2, 3 ... 5119, 5120]
Raw = [ 198, 198, 198 ... 192, 192]
Times = [-257.600 ms,-257.500 ms,-257.400 ms ... 254.300 ms,254.400 ms]
Volts = [ 40.00 mV, 40.00 mV, 40.00 mV ... 88.00 mV, 88.00 mV]
Channel 2:
Coupling = unknown
Scale = 500.00 mV/div
Offset = 0.00 V
Probe = 1X
Inverted = False
Time Base = 10.000 ms/div
Offset = -1.600 ms
Delta = 100.000 µs/point
Points = 5120
Count = [ 1, 2, 3 ... 5119, 5120]
Raw = [ 92, 92, 92 ... 77, 77]
Times = [-257.600 ms,-257.500 ms,-257.400 ms ... 254.300 ms,254.400 ms]
Volts = [700.00 mV,700.00 mV,700.00 mV ... 1.00 V, 1.00 V]
[5]:
ch = w.channels[0]
plt.subplot(211)
plt.plot(ch.times, ch.volts, color='green')
plt.title("DS1202CA-A from .wfm file")
plt.ylabel("Volts (V)")
#plt.xlim(-0.6,0.6)
plt.xticks([])
ch = w.channels[1]
plt.subplot(212)
plt.plot(ch.times, ch.volts, color='red')
plt.xlabel("Time (s)")
plt.ylabel("Volts (V)")
#plt.xlim(-0.6,0.6)
plt.show()
DS1042C
First the .csv
data
Let’s look at what the accompanying .csv
data looks like.
[6]:
filename = "DS1042C-A.csv"
csv_data = np.genfromtxt(repo+filename, delimiter=',', skip_header=2).T
plt.plot(csv_data[0]*1e6,csv_data[1], color='green')
plt.title(filename)
plt.ylabel("Volts (V)")
plt.show()
[7]:
ch = w.channels[0]
plt.plot(csv_data[0]*1e6,csv_data[1], color='green')
plt.title(filename)
plt.ylabel("Volts (V)")
plt.xlabel("Time (µs)")
plt.xlim(0,10)
plt.show()
Now for the .wfm
data
First a textual description.
[8]:
# raw=true is needed because this is a binary file
wfm_url = "https://github.com/scottprahl/RigolWFM/raw/master/wfm/DS1042C-A.wfm" + "?raw=true"
w = rigol.Wfm.from_url(wfm_url, '1000C')
description = w.describe()
print(description)
downloading 'https://github.com/scottprahl/RigolWFM/raw/master/wfm/DS1042C-A.wfm?raw=true'
General:
File Model = wfm1000c
User Model = 1000C
Parser Model = wfm1000c
Firmware = unknown
Filename = DS1042C-A.wfm
Channels = [1]
Channel 1:
Coupling = unknown
Scale = 500.00 mV/div
Offset = -1.82 V
Probe = 10X
Inverted = False
Time Base = 1.000 ms/div
Offset = 8.000 ms
Delta = 50.000 ns/point
Points = 524288
Count = [ 1, 2, 3 ... 524287, 524288]
Raw = [ 215, 215, 215 ... 217, 216]
Times = [-5.107 ms,-5.107 ms,-5.107 ms ... 21.107 ms,21.107 ms]
Volts = [ 60.00 mV, 60.00 mV, 60.00 mV ... 20.00 mV, 40.00 mV]
[9]:
ch = w.channels[0]
plt.plot(ch.times, ch.volts, color='green')
plt.title("DS1042C-A from .wfm file")
plt.ylabel("Volts (V)")
plt.xlabel("Time (s)")
plt.show()
[10]:
ch = w.channels[0]
plt.plot(ch.times*1e6, ch.volts, color='green')
plt.title("DS1042C-A from .wfm file")
plt.ylabel("Volts (V)")
plt.xlabel("Time (µs)")
plt.xlim(0,10)
plt.show()
[ ]: