Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes to make project work with the Rigol DS1052E oscilloscope #1

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
7 changes: 4 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ matplotlib

Setup USB permissions for udev
------------------------------
echo 'ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1ab1", SYSFS{idProduct}=="0588", GROUP:="adm"' > tmpfile
echo 'ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0588", GROUP="adm"' > tmpfile
sudo chown root:root tmpfile
sudo chmod 644 tmpfile
sudo mv tmpfile /etc/udev/rules.d/10-rigol.rules
sudo udevadm control --reload-rules

Expand All @@ -40,6 +41,6 @@ On my DS1102E the WAVE:POINT:MODE options seem to have no effect. Maybe the fir
udev can add more symlinks with SYMLINK+="usbtmc-newname"

new udev rules
ACTION=="add", BUS=="usb", SYSFS{idVendor}=="164e", SYSFS{idProduct}=="0fa2", GROUP:="adm", SYMLINK+="usbtmc-bnc645"
ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1ab1", SYSFS{idProduct}=="0588", GROUP:="adm", SYMLINK+="usbtmc-rigol"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="164e", ATTRS{idProduct}=="0fa2", GROUP:="adm", SYMLINK+="usbtmc-bnc645"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0588", GROUP:="adm", SYMLINK+="usbtmc-rigol"

3 changes: 2 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from oscope import *
from rigol import RigolScope
from waverunner import Waverunner
from utils import *
from utils import *

4 changes: 2 additions & 2 deletions rigol.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
RAW_DATA_LENGTH = 9000

class RigolScope(Scope):
'''Class to control a Rigol DS1000 series oscilloscope''
'''Class to control a Rigol DS1000 series oscilloscope'''
def __init__(self, device):
'''Initialize Hardware'''
try:
Expand Down Expand Up @@ -188,7 +188,7 @@ def forceTrigger(self):

if __name__ == "__main__":
print "# RigolScope Test #"
scope = RigolScope("/dev/usbtmc-rigol")
scope = RigolScope("/dev/usbtmc0")
scope.grabData()
scope.writeWaveformToFile("out.dat")
scope.close()
Expand Down
10 changes: 4 additions & 6 deletions tests/display_rigol.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
from matplotlib import pyplot
import sys
import os
sys.path.append(os.path.expanduser('~/Source'))
sys.path.append(os.path.expanduser('~/src'))
sys.path.append('/var/local/src')
from pyoscope import RigolScope
sys.path.append(os.path.expanduser('.'))
from rigol import RigolScope

# Initialize our scope
scope = RigolScope("/dev/usbtmc-rigol")
scope = RigolScope("/dev/usbtmc0")
scope.grabData()
data1 = scope.getScaledWaveform(1)
data2 = scope.getScaledWaveform(2)
Expand All @@ -37,7 +35,7 @@
else:
tUnit = "S"

# close interface
scope.unlock()
scope.close()

# Plot the data
Expand Down
6 changes: 2 additions & 4 deletions tests/display_wr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
from matplotlib import pyplot
import sys
import os
sys.path.append(os.path.expanduser('~/Source'))
sys.path.append(os.path.expanduser('~/src'))
sys.path.append('/var/local/src')
from pyoscope import Waverunner
sys.path.append(os.path.expanduser('.'))
from waverunner import Waverunner

""" Example program to plot the Y-T data from one scope channel
derived from capture_channel_1.py but using new interface methods """
Expand Down
17 changes: 8 additions & 9 deletions tests/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
import sys
import os
from matplotlib import pyplot
sys.path.append(os.path.expanduser('~/Source'))
sys.path.append(os.path.expanduser('~/src'))
sys.path.append('/var/local/src')
from pyoscope import RigolScope
from pyoscope import Waverunner
from pyoscope import makeDataFilePath
sys.path.append(os.path.expanduser('.'))
from rigol import RigolScope
from waverunner import Waverunner
from utils import makeDataFilePath
""" Capture data from Rigol oscilloscope and write to a file
usage: python save_channel.py <filename>
usage: python get_data.py <filename>
if filename is not given STDOUT will be used"""

SCOPE_ADDRESS = 'nigpib1'
Expand All @@ -31,9 +29,10 @@
sys.exit(1)

print filename
#scope = RigolScope("/dev/usbtmc0")
scope = Waverunner(SCOPE_ADDRESS)
scope = RigolScope("/dev/usbtmc0")
#scope = Waverunner(SCOPE_ADDRESS)
scope.grabData()
scope.writeWaveformToFile(filename)
scope.unlock()
scope.close()

5 changes: 4 additions & 1 deletion tests/realtime_plot_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
'''
import numpy
from matplotlib import pyplot
from pyusbtmc import RigolScope
import sys
import os
sys.path.append(os.path.expanduser('.'))
from rigol import RigolScope
import time

# Initialize our scope
Expand Down