Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gpib_instrument
- import numpy as np
- import pylab as plt
- from scipy.optimize import curve_fit
- scope = gpib_instrument.Gpib_Instrument(pad=3)
- def ask(s):
- scope.write(s)
- r = ""
- while '\x00' not in r:
- r+=scope.read()
- return r[:r.find('\x00')]
- def getxinfo():
- r = ask("WFMP?")
- r2=r.split(",",10000)
- d={c.split(":")[0]:c.split(":")[1] for c in r2}
- xincr = float(d["XINCR"])
- ymult = float(d["YMULT"])
- return xincr, ymult
- def askcurv():
- d = ask("CURV?")
- d2=d.split(",",1000000)
- d3 = [int(q) for q in d2 if q.isdigit()]
- xincr,ymult = getxinfo()
- return np.arange(len(d3))*xincr, np.array(d3)*ymult
- def model(x,p):
- # model the turn on as an exponential
- p[0]+p[1]*np.exp((x-p[2])/p[3])*np.greater(x,p[2])
- t,y = askcurv()
- useind = np.arange(100)
- plt.plot(t,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement