70 lines
2.2 KiB
Python
Executable File
70 lines
2.2 KiB
Python
Executable File
IN_POSITION_BAND = 10.0
|
|
|
|
|
|
#cam_server.start("SAROP21-PSRD103_sp", True)
|
|
#cam_server.start("SAROP21-PPRM102_sp", True)
|
|
#cam_server.start("SAROP21-PSRD103_sp", True)
|
|
#cam_server.start("SAROP11-PSCR106_sp", True)
|
|
#cam_server.start("SAROP11-PPRM122_sp", True)
|
|
#cam_server.start("SATOP21-PSCR162_sp", True)
|
|
#cam_server.stream.waitCacheChange(-1)
|
|
#i = cam_server.stream.getChild("intensity")
|
|
#iavg = create_averager(i, 20, interval = -1)
|
|
|
|
#ycent = cam_server.stream.getChild("y_center_of_mass")
|
|
#ycentavg = create_averager(ycent, 20, interval = -1)
|
|
#xcent = cam_server.stream.getChild("x_center_of_mass")
|
|
#xcentavg = create_averager(xcent, 20, interval = -1)
|
|
|
|
|
|
#iode = Channel("SLAAR21-LSCP-DRS1FNS:CH2:BOXCAR.VALP")
|
|
#iavg = create_averager(diode, 30, interval = -1)
|
|
|
|
Keithley = Channel("SATOP31-CSSU-PCEL1381:READOUT")
|
|
K_avg = create_averager(Keithley, 10, interval = -1)
|
|
|
|
def beam_ok():
|
|
return "Yes"
|
|
I0 = caget ("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG")
|
|
|
|
if I0 > 100:
|
|
return "Yes"
|
|
else :
|
|
return "No"
|
|
|
|
|
|
def before_sampling(rec):
|
|
while beam_ok() == "No":
|
|
time.sleep(0.1)
|
|
print(".")
|
|
|
|
def after_sampling(rec):
|
|
if beam_ok() == "No":
|
|
rec.invalidate()
|
|
|
|
|
|
i0 = Channel("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG")
|
|
|
|
class DCM(RegisterBase):
|
|
def doWrite(self, value):
|
|
caput ("SAROP11-ARAMIS:ENERGY_SP", value)
|
|
time.sleep(0.5)
|
|
cawait('SAROP11-ODCM105:MOVING', 0, timeout = 20.0, type = 'i')
|
|
#cawait('SAROP11-ODCM105:DMOV', 1, timeout = 20.0, type = 'i')
|
|
#cawait('SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK', 1, timeout = 10.0, type = 'i')
|
|
if abs(value - self.read()) > IN_POSITION_BAND :
|
|
raise Exception("Cannot set mono")
|
|
def doRead(self):
|
|
return caget("SAROP11-ARAMIS:ENERGY")
|
|
|
|
alvra = DCM()
|
|
alvra.initialize()
|
|
i0 = Channel("SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US")
|
|
#acc = Channel("SARCL02-MBND100:P-READ")
|
|
#k = Channel("SARUN-UIND-MOT:KALL.VAL")
|
|
Theta=Channel("SAROP11-ODCM105:RX12.RBV")
|
|
Gap =Channel("SAROP11-ODCM105:T2.RBV")
|
|
|
|
#lscan( alvra, [Theta,Gap], 10000.0, 10001.0 ,0.002,0.2,setpoints=True)
|
|
lscan( alvra, [Theta,Gap], 2500.0, 3000.0 ,10.0 ,2 ,setpoints=True, passes=2,zigzag=True)
|