Files
sf-op/script/test/TestTimestamp.py
root 7da4e32097
2018-06-04 11:02:16 +02:00

51 lines
1.4 KiB
Python

import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
import ch.psi.pshell.bs.Scalar as Scalar
import ch.psi.pshell.epics.DiscretePositioner as DiscretePositioner
#Arguments
SAMPLES = 5
BLMS = ["SINDI02-DBLM025"]
RANGE = [0.5, 1.1]
STEP_SIZE = 0.10
SETTLING_TIME = 0.1
SIMULATION = True
do_elog = True
pos = DummyPositioner("gain")
#Channel-based
blm1 = ChannelDouble("blm1", "SINDI02-DBLM025:B1_LOSS"); blm1.setMonitored(True); blm1.initialize()
blm2 = ChannelDouble("blm2", "SINDI02-DBLM085:B1_LOSS", -1, True); blm2.setMonitored(True); blm2.initialize()
#Stream creation
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 10, 0)
av = create_averager(blm, SAMPLES, interval = -1)
av.setMonitored(i>0)
sensors.append(av)
sensors.append(av.stdev)
sensors.append(av.samples)
line_plots.append(av.samples)
st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
#Metadata
#set_exec_pars(save = False)
try:
r=lscan(pos, sensors, RANGE[0], RANGE[1],STEP_SIZE, latency = SETTLING_TIME) #PC timestamp
r=bscan(st, 10) #BS Timestamp
mscan(st, sensors, 10, -1) #BS Timestamp
mscan(blm1, blm1, 10, -1) #PC timestamp
mscan(blm2, blm2, 10, -1) #IOC timestamp (blm2 constructed with timestampChannel Flag)
finally:
st.close()