In [47]:
import pyvisa
from os import path, listdir
import numpy as np
from time import sleep
import plotly.plotly as py
from plotly.graph_objs import *
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
init_notebook_mode()
0501215A-E8
In [2]:
rm = pyvisa.ResourceManager();
sim = rm.get_instrument("GPIB0::19::INSTR")
sim.ask("*IDN?")
Out[2]:
In [91]:
vmax = .2
points = 21
voltages1 = np.linspace(0, vmax, points)
voltages2 = np.linspace(vmax, -vmax, 2*points)
voltages3 = np.linspace(-vmax, 0, points)
voltages = np.append(np.append(voltages1, voltages2), voltages3)
i = []
v = []
data = Scatter(x=[],y=[])
fig = Figure(data=[data])
# iplot(fig)
for volt in voltages:
sim.write('SNDT 1,"VOLT {}"'.format(volt))
sleep(.25)
sim.write('SNDT 4,"VOLT? 1"')
itemp = sim.query('GETN? 4,12')
# print(itemp)
i.append(float(itemp.split('\n')[1]))
sleep(.25)
sim.write('SNDT 4,"VOLT? 3"')
vtemp = sim.query('GETN? 4,12')
# print(vtemp)
v.append(float(vtemp.split('\n')[1]))
sleep(1)
data = Scatter(
x=v,
y=i
)
fig.data = [data]
iplot(fig)
In [ ]: