Files
sf-op/script/test/bs4.py
2016-12-21 11:52:56 +01:00

47 lines
1.8 KiB
Python

###################################################################################################
# Scans with beam synchronous streams
###################################################################################################
#Creating a stream, assuming a provided named "dispatcher".
st1 = Stream("st1", dispatcher)
#Adding channels to that stream
s1=st1.addScalar("SINEG01-DICT210:GUN_CHARGE", "SINEG01-DICT210:GUN_CHARGE", 10, 0)
s2=st1.addScalar("SINEG01-DICT215:B1_CHARGE", "SINEG01-DICT215:B1_CHARGE", 10, 0)
s3=st1.addScalar("S10DI01-DICT025:B1_CHARGE", "S10DI01-DICT025:B1_CHARGE", 10, 0)
#s4=st1.addScalar("S10DI01-DICT025:B1_CHARGES", "S10DI01-DICT025:B1_CHARGES", 10, 0)
st1.setFilter("SINEG01-DICT210:GUN_CHARGE < 0.0")
st1.initialize()
#st1.start(True)
#Filter
try:
while(True):
#The stream can be used on any conventional scan. The next stream value is sampled.
#Readable values belong to same pulse id.
print "Running tscan"
tscan (st1.getReadables(), 10 , 0.1)
#The bscan command performs samples every stream element
#Readable values belong to same pulse id.
print "Running bscan"
bscan (st1, 10) #Sampling 10 elements
#An individual stream channel can be used in a conventional scan, but in this case the stream
#must be explicitly started, and there is no guarantee the values belong to the same PulseID
#(likely they are since as only cached values are taken).
#st1.start(True)
#tscan ([s1,s2], 10 , 0.1)
#If waveform individual stream channel is used, and no size is provided in constructor/config,
#then it must be read previously to the scan to update the size value.
#tscan ([s1,s2,s3], 10 , 0.1)
finally:
st1.close()