Files
sf-op/script/Photonics/PhaseShifterScanGas.py
root 1bcb32c8f2
2018-03-06 08:21:09 +01:00

37 lines
1.2 KiB
Python

GAP = "SARUN03-UPHS060"
SAMPLES = 10
TOLERANCE = 0.01
TIMEOUT = 10.0
#intensity = Channel("SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US", alias = "gas det")
#gap = Channel(GAP + ":GAP_SP", alias = "gap")
readout = Channel(GAP + ":GAP")
av = create_averager("ca://SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US",
SAMPLES, interval =0.1, name = "gas det")
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 ("ca://" + GAP + ":GAP_SP?name=gap", av, 14, 16, 20,
latency=20.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)