In [12]:
import instrument
import matplotlib.pyplot as plt
In [2]:
inst = instrument.TekScope1000("/dev/usbtmc0")
In [23]:
import ipywidgets as widgets
from IPython.display import display
button = widgets.Button(description="top scope")
display(button)
def on_button_clicked(b):
"""TODO: pass in an instrument, so it can be re-used?
TODO: Handle variables without globals?
"""
global ch1, ch2, xdata
# print("Get!")
# add smart parsing of available waveforms.
ch1 = inst.get_data("CH1")
ch2 = inst.get_data("CH2")
xdata = inst.get_xdata()
#ch1 = [1,2,3]
#xdata = inst.get_xdata()
return [xdata,ch1,ch2]
button.on_click(on_button_clicked)
In [22]:
plt.plot(xdata,ch2)
Out[22]:
In [ ]: