You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this python library that we can make our system working again after an unfortunate dying of the old computer and hence the old program did not work on the newer Windows system. However, during the implementation of the library, we found two issues:
When using plotgen(), the graph did not show the plot each point, but only showed once the scan finished. The issue has been resolved by inserting
ax[0].figure.canvas.flush_events()
after
ax[0].figure.canvas.draw()
plotgen() function in live_plot.py
The scan is slow. Probably this is caused by the plotgen() function. So write my own plot and scan function. The original plotgen() function gives about 1.5 sec/point, and the modified scan function gives 1.2 sec/point. The improvement is significant when doing fine scan in a large wavelength range (e.g. save about 3 min. for a scan from 330 to 700, step wavelength = 0.2 nm).
Here is the code:
def fastscan(w_start,w_stop,dw):
if w_start>=300 and w_start<=1200 and w_stop>=300 and w_stop<=1200 and w_stop > w_start:
cal_flg = 0
while not cal_flg:
cur_wl = input("Please calibrate the current wavelength!\n")
if cur_wl>=300 and cur_wl<=1200:
cal_flg = 1
spex.calibrate(cur_wl)
fig, ax = plt.subplots()
line, = ax.plot(np.arange(w_start,w_stop,dw))
plt.show(block=False)
fig.canvas.draw()
i = 0
xwl = np.arange(w_start,w_stop,dw)
ydata = deque([0]*len(xwl))
plt.ylim([0,10])
spex.set_wl(w_start)
ymin = 0;
ymax = 1e-8;
for i in range(len(xwl)):
data = li.get_x()
if data < ymin:
ymin = data;
plt.ylim([ymin,ymax])
if data > ymax:
ymax = data;
plt.ylim([ymin,ymax])
ydata.append(data)
plt.xlim([w_start,xwl[i]])
del ydata[0]
line.set_ydata(ydata)
line.set_xdata(xwl)
ax.draw_artist(ax.patch)
ax.draw_artist(line)
fig.canvas.update()
fig.canvas.flush_events()
spex.rel_move(dw)
print xwl[i], ":", data
i = i + 1
result = np.array([xwl,ydata])
result = result.T
np.savetxt("D:\\data_temp.txt",result,fmt=['%f','%f'])
else:
print "wavelength must be 300 ~ 1200 nm!"
The text was updated successfully, but these errors were encountered:
Thanks for this python library that we can make our system working again after an unfortunate dying of the old computer and hence the old program did not work on the newer Windows system. However, during the implementation of the library, we found two issues:
after
plotgen() function in live_plot.py
Here is the code:
def fastscan(w_start,w_stop,dw):
if w_start>=300 and w_start<=1200 and w_stop>=300 and w_stop<=1200 and w_stop > w_start:
cal_flg = 0
while not cal_flg:
cur_wl = input("Please calibrate the current wavelength!\n")
if cur_wl>=300 and cur_wl<=1200:
cal_flg = 1
The text was updated successfully, but these errors were encountered: