39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
CAMERA = "SARBD01-DSCR110"
|
|
GAP = "SARUN15-UIND030"
|
|
SAMPLES = 20
|
|
TOLERANCE = 0.01
|
|
TIMEOUT = 10.0
|
|
|
|
#shared stream - make sure the camera is running on a screenpanel on the same console!
|
|
cam_server.start(CAMERA + "_sp1", True)
|
|
|
|
intensity = cam_server.stream.getChild("intensity")
|
|
|
|
gap = Channel(GAP + ":K_SET", alias = "gap")
|
|
#readout = Channel(GAP + ":GAP")
|
|
|
|
av = create_averager(intensity, SAMPLES, interval = -1, name = None)
|
|
|
|
def before(position, scan):
|
|
caput(GAP + ":GO", 1)
|
|
start = time.time()
|
|
# while abs(readout.read() - gap.read()) > TOLERANCE:
|
|
time.sleep(0.1)
|
|
# if time.time() - start > TIMEOUT:
|
|
# raise Exception ("Timeout waiting gap change")
|
|
|
|
ret = lscan (gap, av, 1.195, 1.205, 21, latency=1.0, before_read=before)
|
|
|
|
|
|
#run("CPython/wrapper")
|
|
#xdata = ret.getPositions(0)
|
|
#ydata = ret.getReadable(0)
|
|
#(fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(ydata , xdata)
|
|
#print fit_amplitude, fit_phase_deg, fit_offset
|
|
#plt = get_plots()[0]
|
|
#if plt is not None:
|
|
# plt.addSeries(LinePlotErrorSeries("fit"))
|
|
# plt.getSeries(1).setData(fit_x, fit_y)
|
|
# plt.getSeries(1).setPointsVisible(False)
|
|
# plt.setLegendVisible(True)
|