This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
I_TARGET_mA=0
|
||||
V_TARGET_V=600
|
||||
T_WAIT_ms=5000
|
||||
|
||||
EPSILON=0.1
|
||||
if abs(fil.read()) > EPSILON:
|
||||
raise Exception("Filament not at 0.0 - Set it to zero using: fil.write(0.)")
|
||||
if abs(bv.read()) > EPSILON:
|
||||
raise Exception("Bombardment voltage not at 0.0 - Set it to zero using: bv.write(0.)")
|
||||
|
||||
fil.write(I_TARGET_mA)
|
||||
time.sleep(float(3500)/1000)
|
||||
bv.write(V_TARGET_V)
|
||||
|
||||
time.sleep(float(T_WAIT_ms)/1000)
|
||||
|
||||
bv.write(0.0)
|
||||
time.sleep(float(500)/1000)
|
||||
fil.write(0.0)
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ class LEEM2000(TcpDevice):
|
||||
ret = []
|
||||
for i in range(self.NUMBER_MNEMONICS):
|
||||
mne = self.get_name(i, timeout, retries)
|
||||
if mne not in [None, '', 'disabled', 'invalid']:
|
||||
if mne not in [None, '', 'disabled', 'invalid', 'Manip. X', 'Manip. Y']:
|
||||
ret.append(mne)
|
||||
return ret
|
||||
|
||||
@@ -280,14 +280,16 @@ add_device (microscope.get_manip_motor(11, 0, "manip_x"), True)
|
||||
add_device (microscope.get_manip_motor(10, 1, "manip_y"), True)
|
||||
add_device (microscope.get_tilt('L','R', "tilt_h"), True)
|
||||
add_device (microscope.get_tilt('D','U', "tilt_v"), True)
|
||||
#add_device (microscope.get_positioner("MOBJ","objective"), True)
|
||||
#add_device (microscope.get_positioner("OSTIGA","obj_stig_a"), True)
|
||||
#add_device (microscope.get_positioner("OSTIGB","obj_stig_b"), True)
|
||||
add_device (microscope.get_child("MOBJ","objective"), True)
|
||||
add_device (microscope.get_child("OSTIGA","obj_stig_a"), True)
|
||||
add_device (microscope.get_child("OSTIGB","obj_stig_b"), True)
|
||||
add_device (microscope.get_child("MDRIVE","azimuth_rot"), True)
|
||||
add_device (microscope.get_child("BOMBV","bv"), True)
|
||||
add_device (microscope.get_child("FIL","fil"), True)
|
||||
add_device (microscope.get_child("STV","start_voltage"), True)
|
||||
add_device (microscope.get_child("OBJDX","obj_align_x"), True)
|
||||
add_device (microscope.get_child("OBJDY","obj_align_y"), True)
|
||||
add_device (microscope.get_child("HMOTSLIT","slitttt"), True)
|
||||
|
||||
microscope.setPolling(5000)
|
||||
|
||||
@@ -335,6 +337,8 @@ tilt_horizontal.polling=500
|
||||
manip_x.polling=500
|
||||
manip_y.polling=500
|
||||
fov.polling=5000
|
||||
bv.polling=1000
|
||||
fil.polling=1000
|
||||
|
||||
|
||||
|
||||
|
||||
Executable → Regular
+25
-3
@@ -13,7 +13,7 @@ diag_channels_names = { \
|
||||
"girder z": "X11MA-HG:Z1", \
|
||||
"girder pitch": "X11MA-HG:PITCH1", \
|
||||
"girder yaw": "X11MA-HG:YAW1", \
|
||||
"girder roll set": "X11MA-HG:ROLL_SET", \
|
||||
"girder roll": "X11MA-HG:ROLL1", \
|
||||
"CMU ox": "X11MA-OP-CM:ox", \
|
||||
"CMU oy": "X11MA-OP-CM:oy", \
|
||||
"CMU oz": "X11MA-OP-CM:oz", \
|
||||
@@ -21,6 +21,12 @@ diag_channels_names = { \
|
||||
"CMU oRy": "X11MA-OP-CM:oRy", \
|
||||
"CMU oRz": "X11MA-OP-CM:oRz", \
|
||||
"CMU TRB": "X11MA-OP2-CM:TRB.RBV", \
|
||||
"RMU ox": "X11MA-OP-RMU:ox", \
|
||||
"RMU oy": "X11MA-OP-RMU:oy", \
|
||||
"RMU oz": "X11MA-OP-RMU:oz", \
|
||||
"RMU oRx": "X11MA-OP-RMU:oRx", \
|
||||
"RMU oRy": "X11MA-OP-RMU:oRy", \
|
||||
"RMU oRz": "X11MA-OP-RMU:oRz", \
|
||||
#"mode": "X11PHS-E:OPT", \
|
||||
#"id1 mode": "X11MA-ID1:MODE", \
|
||||
#"id1 offset": "X11MA-ID1:ENERGY-OFFS", \
|
||||
@@ -40,8 +46,16 @@ diag_channels_names = { \
|
||||
"PEEM leakage current": "X11MA-ES1-PEEM:IMON", \
|
||||
"Pressure in PEEM": "X11MA-ES1-MAIN:PRESSURE", \
|
||||
"Pressure in Column": "X11MA-ES1-COLU:PRESSURE", \
|
||||
"Sample temperature": "X11MA-PC-SW:Pt100-K", \
|
||||
"Pt100 resistance": "X11MA-PC-SW:Pt100-R", \
|
||||
"SW Pt100 sample temperature": "X11MA-PC-SW:Pt100-K", \
|
||||
"SW Pt100 resistance": "X11MA-PC-SW:Pt100-R", \
|
||||
"SW E-field value voltage": "X11MA-PC-SW:E-Field-V", \
|
||||
"SW E-field value current": "X11MA-PC-SW:E-Field-I", \
|
||||
"SW Resistence value resistence": "X11MA-PC-SW:Resistance", \
|
||||
"Cooling He flow meas": "X11MA-PC-BRONKHORST:PEEM-GET-MEASURE", \
|
||||
"Cooling He flow set": "X11MA-PC-BRONKHORST:PEEM-SET-SETPOINT", \
|
||||
"Cooling Needle Valve": "X11MA-ES1-AO4:V", \
|
||||
"FMU Ry": "X11MA-OP2-FM:TRY1.RBV", \
|
||||
"FMU TrZ": "X11MA-OP2-FM:TRY4.RBV", \
|
||||
}
|
||||
|
||||
eiger_diag_channels_names = { \
|
||||
@@ -134,6 +148,14 @@ def get_diags():
|
||||
if microscope.initialized and microscope.client.isConnected():
|
||||
for k,v in get_microscope_diags().items():
|
||||
ret["Microscope " + k] = str(v)
|
||||
try:
|
||||
ret["Microscope Manip. X"] = str(manip_x.readback.read())
|
||||
except:
|
||||
ret["Microscope Manip. X"] = "Error: " + str(sys.exc_info()[1])
|
||||
try:
|
||||
ret["Microscope Manip. Y"] = str(manip_y.readback.read())
|
||||
except:
|
||||
ret["Microscope Manip. Y"] = "Error: " + str(sys.exc_info()[1])
|
||||
|
||||
return OrderedDict(sorted(ret.items(), key=lambda i: i[0].lower()))
|
||||
|
||||
|
||||
Executable → Regular
+3
-3
@@ -180,9 +180,9 @@ class EnOptDesc(ReadonlyRegisterBase):
|
||||
def doRead(self):
|
||||
opt = energy_opt.read()
|
||||
if opt == "PGM": return "PGM"
|
||||
if opt == "PGM+ID1": return "ID1"
|
||||
if opt == "PGM+ID2": return "ID2"
|
||||
if opt == "PGM+ID1+ID2": return "ID1_ID2"
|
||||
if opt == "PGM+ID1": return "PGM_ID1"
|
||||
if opt == "PGM+ID2": return "PGM_ID2"
|
||||
if opt == "PGM+ID1+ID2": return "PGM_ID1_ID2"
|
||||
return ""
|
||||
|
||||
def getName(self):
|
||||
|
||||
+60
-20
@@ -37,6 +37,7 @@ VG12_SET = "X11MA-EPS-VG12:SET"
|
||||
VG12_GET = "X11MA-OP-VG12:OPEN"
|
||||
VG13_SET = "X11MA-EPS-VG13:SET"
|
||||
VG13_GET = "X11MA-OP-VG13:OPEN"
|
||||
FAST_SHTR= "X11MA-VME-ES1:FAST-SHTR"
|
||||
|
||||
"""
|
||||
|
||||
@@ -383,7 +384,8 @@ def write_metadata():
|
||||
setting = get_setting("authors")
|
||||
set_attribute("/", "authors", setting.split("|") if setting is not None else [""])
|
||||
|
||||
|
||||
def beamline_auto(value):
|
||||
caput("X11MA:AUTO-ONOFF",value)
|
||||
|
||||
|
||||
###################################################################################################
|
||||
@@ -697,19 +699,20 @@ def play_sound(name):
|
||||
#Beamline setup
|
||||
###################################################################################################
|
||||
|
||||
def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None):
|
||||
print "Seting Beamline: ", en,pol1,alp1,har1,off1,pol2,alp2,har2,off2
|
||||
def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None,grat=None,order=None,Cff=None):
|
||||
print "Setting Beamline: ", en,pol1,alp1,har1,off1,pol2,alp2,har2,off2,grat,order,Cff
|
||||
|
||||
if get_dry_run():
|
||||
return
|
||||
|
||||
if id=='ID1':
|
||||
if id=='PGM_ID1':
|
||||
caput('X11PHS-E:OPT',1)
|
||||
elif id=='ID2':
|
||||
elif id=='PGM_ID2':
|
||||
caput('X11PHS-E:OPT',2)
|
||||
elif id =='ID1_ID2':
|
||||
elif id =='PGM_ID1_ID2':
|
||||
caput('X11PHS-E:OPT',3)
|
||||
|
||||
if id == "ID1":
|
||||
if id == "PGM_ID1":
|
||||
#current_pol=POL_IDS[pol1] #get_id_pol(1)
|
||||
if pol1 is not None:
|
||||
put_id_pol(1,pol1, alp1 if (pol1=="Lin") else None )
|
||||
@@ -719,7 +722,7 @@ def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2
|
||||
if off1 is not None:
|
||||
put_id_offset(1, float(off1)) #offset on ID1
|
||||
|
||||
elif id == "ID2":
|
||||
elif id == "PGM_ID2":
|
||||
#current_pol=POL_IDS[pol2]#get_id_pol(2)
|
||||
if pol2 is not None:
|
||||
put_id_pol(2,pol2, alp2 if (pol2=="Lin") else None )
|
||||
@@ -729,7 +732,7 @@ def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2
|
||||
if off2 is not None:
|
||||
put_id_offset(2, float(off2)) #offset on ID2
|
||||
|
||||
elif id == "ID1_ID2":
|
||||
elif id == "PGM_ID1_ID2":
|
||||
#polID1=POL_IDS[pol1]
|
||||
#polID2=POL_IDS[pol2]
|
||||
if pol1 is not None:
|
||||
@@ -745,6 +748,19 @@ def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2
|
||||
put_id_offset(1, float(off1)) #offset on ID1
|
||||
if off2 is not None:
|
||||
put_id_offset(2, float(off2)) #offset on ID2
|
||||
|
||||
# Monochromator part
|
||||
if grat is not None:
|
||||
if grat=='G1_300':
|
||||
Grating.write(0)
|
||||
elif grat=='G2_1200':
|
||||
Grating.write(1)
|
||||
elif grat =='G3_600':
|
||||
Grating.write(2)
|
||||
if order is not None:
|
||||
DiffOrd.write(order)
|
||||
if Cff is not None:
|
||||
caput("X11MA-PGM:cff.A",Cff)
|
||||
|
||||
#wait_channel("X11PHS:alldone", 1)
|
||||
if en is not None:
|
||||
@@ -770,7 +786,7 @@ def change_offset(id, offset):
|
||||
wait_channel("X11PHS:alldone", 1)
|
||||
|
||||
|
||||
def set_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None):
|
||||
def set_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None,grat=None,order=None,Cff=None):
|
||||
set_setting("ID", id)
|
||||
set_setting("ENERGY", en)
|
||||
set_setting("POL_ID_1", pol1)
|
||||
@@ -781,7 +797,10 @@ def set_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=N
|
||||
set_setting("ALPHA_ID_2", alp2)
|
||||
set_setting("HARMONIC_ID_2", har2)
|
||||
set_setting("OFFSET_ID_2", off2)
|
||||
apply_beamline_setup(id,en,pol1,alp1,har1,off1,pol2,alp2,har2,off2)
|
||||
set_setting("GRATING", grat)
|
||||
set_setting("DIFF_ORD", order)
|
||||
set_setting("CFF", Cff)
|
||||
apply_beamline_setup(id,en,pol1,alp1,har1,off1,pol2,alp2,har2,off2,grat,order,Cff)
|
||||
|
||||
#Restore beamline initial config
|
||||
def restore_beamline_setup():
|
||||
@@ -794,31 +813,52 @@ def restore_beamline_setup():
|
||||
POL_ID_2 = get_setting("POL_ID_2")
|
||||
ALPHA_ID_2 = float(get_setting("ALPHA_ID_2"))
|
||||
HARMONIC_ID_2 = get_setting("HARMONIC_ID_2")
|
||||
OFFSET_ID_2 = float(get_setting("OFFSET_ID_2"))
|
||||
apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2)
|
||||
OFFSET_ID_2 = float(get_setting("OFFSET_ID_2"))
|
||||
GRATING = get_setting("GRATING")
|
||||
DIFF_ORD = float(get_setting("DIFF_ORD"))
|
||||
CFF =float(get_setting("CFF"))
|
||||
apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2,GRATING,DIFF_ORD,CFF)
|
||||
|
||||
# peem default setups
|
||||
def peem_optics_default_15kV():
|
||||
# read and save the values
|
||||
objective.write(1475)
|
||||
obj_stig_a.write(0)
|
||||
obj_stig_b.write(0)
|
||||
obj_align_x.write(0)
|
||||
obj_align_y.write(0)
|
||||
start_voltage.write(0)
|
||||
# fov.write(100)
|
||||
|
||||
def peem_optics_default_10kV():
|
||||
objective.write(1220)
|
||||
obj_stig_a.write(0)
|
||||
obj_stig_b.write(0)
|
||||
obj_align_x.write(0)
|
||||
obj_align_y.write(0)
|
||||
start_voltage.write(0)
|
||||
|
||||
# x-rays default setup
|
||||
def xrays_default():
|
||||
exit_slit.write(0)
|
||||
caput ('X11MA-FE-DSAPER', 0) # close FE-slits
|
||||
exit_slit.write(300.0)
|
||||
caput ('X11MA-FE-DSAPER', 0) # close FE-slits
|
||||
set_beamline_setup(id ="ID2", en=800, pol2="Lin_Hor", grat="G3_600", order=1, Cff=2.25)
|
||||
|
||||
def neutralize_position():
|
||||
manip_x.write(0)
|
||||
manip_y.write(0)
|
||||
time.sleep(1)
|
||||
def neutralize_position(retries = 3):
|
||||
for i in range(retries):
|
||||
try:
|
||||
if abs(manip_x.readback.read()) > 50:
|
||||
manip_x.write(0.0)
|
||||
if abs(manip_y.readback.read()) > 50:
|
||||
manip_y.write(0.0)
|
||||
break
|
||||
except:
|
||||
if i>=(retries-1):
|
||||
raise
|
||||
log("neutralize_position error - retrying: " + sys.exc_info()[1])
|
||||
time.sleep(1)
|
||||
microscope.home_tilt('H')
|
||||
microscope.home_tilt('V')
|
||||
microscope.home_tilt('V')
|
||||
###################################################################################################
|
||||
#Maths
|
||||
###################################################################################################
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fil.write(I)
|
||||
bv.write(V)
|
||||
time.sleep(0.1)
|
||||
bv.write(0.0)
|
||||
fil.write(0.0)
|
||||
@@ -20,6 +20,8 @@ set_focus_scan_roi(ROI, RENDERER)
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
former_exposure = None
|
||||
try:
|
||||
@@ -48,7 +50,9 @@ finally:
|
||||
# if (former_exposure is not None) and (former_exposure!=EXPOSURE):
|
||||
# set_exposure_time(former_exposure)
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
|
||||
final_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
|
||||
|
||||
@@ -76,6 +76,9 @@ def getLEEM():
|
||||
#Initialize vartiables
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
#rbkEnergy=energy_rbk.read()
|
||||
if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")):
|
||||
@@ -237,6 +240,8 @@ finally:
|
||||
finally:
|
||||
for i in range(max_index):
|
||||
get_context().incrementDaySequentialNumber()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
@@ -76,6 +76,9 @@ def getLEEM():
|
||||
#Initialize vartiables
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
#rbkEnergy=energy_rbk.read()
|
||||
if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")):
|
||||
@@ -233,6 +236,8 @@ finally:
|
||||
finally:
|
||||
for i in range(max_index):
|
||||
get_context().incrementDaySequentialNumber()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
@@ -76,6 +76,9 @@ def getLEEM():
|
||||
#Initialize vartiables
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
#rbkEnergy=energy_rbk.read()
|
||||
if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")):
|
||||
@@ -227,6 +230,8 @@ finally:
|
||||
finally:
|
||||
for i in range(max_index):
|
||||
get_context().incrementDaySequentialNumber()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
Executable → Regular
+5
-1
@@ -85,6 +85,8 @@ sensors.append(averager) #sensors.append(eiger.getDataMatrix())
|
||||
#Initialize vartiables
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
#put_id_offset(1, OFFSET_ID_1) #offset on ID1
|
||||
#put_id_offset(2, OFFSET_ID_2) #offset on ID2
|
||||
@@ -122,6 +124,8 @@ finally:
|
||||
for i in range(len(rois)):
|
||||
rois[i].parent.monitored = False # Remove listeners on the image
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
print "Running time: " + str(time.time() - start)
|
||||
@@ -79,6 +79,8 @@ scan_completed = False
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
try:
|
||||
if EXPOSURE != eiger.getExposure():
|
||||
@@ -125,7 +127,9 @@ except:
|
||||
raise
|
||||
finally:
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
|
||||
after_sample() #To call check_id_error()
|
||||
Executable → Regular
+5
-1
@@ -27,12 +27,16 @@ sensors = [variation]
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
init_eiger(EXPOSURE_TIME)
|
||||
try:
|
||||
lscan(objective, sensors, SCAN_RANGE[0], SCAN_RANGE[1], float(STEP_SIZE), latency=SETTLING_TIME, before_read=trigger_eiger, keep=False)
|
||||
finally:
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
restore_eiger()
|
||||
print "Running time: " + str(time.time() - start)
|
||||
Executable → Regular
+6
-3
@@ -1,6 +1,6 @@
|
||||
#If running from editor
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
ID = "ID2" #"ID1_ID2"
|
||||
ID = "PGM_ID2" #"PGM_ID1_ID2"
|
||||
ENERGY = 805
|
||||
POL_ID_1 = "Circ_Plus"
|
||||
ALPHA_ID_1 = 0.0
|
||||
@@ -9,6 +9,9 @@ if get_exec_pars().source == CommandSource.ui:
|
||||
POL_ID_2 = "Circ_Minus"
|
||||
ALPHA_ID_2 = 0.0
|
||||
HARMONIC_ID_2 = 1
|
||||
OFFSET_ID_2 = 0.0
|
||||
OFFSET_ID_2 = 0.0
|
||||
GRATING = "G2 1200"
|
||||
DIFF_ORDER = 1
|
||||
CFF = 2.250
|
||||
|
||||
set_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2)
|
||||
set_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2, GRATING, DIFF_ORDER, CFF)
|
||||
|
||||
@@ -13,7 +13,7 @@ diag_channels = { \
|
||||
"girder z": "X11MA-HG:Z1", \
|
||||
"girder pitch": "X11MA-HG:PITCH1", \
|
||||
"girder yaw": "X11MA-HG:YAW1", \
|
||||
"girder roll set": "X11MA-HG:ROLL_SET", \
|
||||
"girder roll": "X11MA-HG:ROLL1", \
|
||||
"CMU ox": "X11MA-OP-CM:ox", \
|
||||
"CMU oy": "X11MA-OP-CM:oy", \
|
||||
"CMU oz": "X11MA-OP-CM:oz", \
|
||||
@@ -69,12 +69,12 @@ def get_diags():
|
||||
try:
|
||||
ret[k]=str(v.read())
|
||||
except:
|
||||
ret[k]="Error: " + sys.exc_info()[1]
|
||||
ret[k]="Error: " + str(sys.exc_info()[1])
|
||||
for k,v in diag_channels.items():
|
||||
try:
|
||||
ret[k]=caget(v,'s')
|
||||
except:
|
||||
ret[k]="Error: " + sys.exc_info()[1]
|
||||
ret[k]="Error: " + str(sys.exc_info()[1])
|
||||
ret["exposure time"] = str(eiger.getExposure())
|
||||
return OrderedDict(sorted(ret.items(), key=lambda i: i[0].lower()))
|
||||
|
||||
|
||||
Executable → Regular
+5
-2
@@ -85,7 +85,8 @@ def assert_status_ok():
|
||||
#Initialize vartiables
|
||||
if not DRY_RUN and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
active_id = 1
|
||||
current_pol=None
|
||||
@@ -259,6 +260,8 @@ try:
|
||||
save_image_file(av, -1, i)
|
||||
finally:
|
||||
if not DRY_RUN and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
#restore_eiger()
|
||||
print "Running time: " + str(time.time() - start)
|
||||
Executable → Regular
+5
-1
@@ -85,6 +85,8 @@ sensors.append(averager) #sensors.append(eiger.getDataMatrix())
|
||||
#Initialize vartiables
|
||||
if not DRY_RUN and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
open_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Open')
|
||||
|
||||
#put_id_offset(1, OFFSET_ID_1) #offset on ID1
|
||||
#put_id_offset(2, OFFSET_ID_2) #offset on ID2
|
||||
@@ -117,6 +119,8 @@ finally:
|
||||
for i in range(len(rois)):
|
||||
rois[i].parent.monitored = False # Remove listeners on the image
|
||||
if not DRY_RUN and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
|
||||
close_vg10()
|
||||
close_vg10()
|
||||
if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "true":
|
||||
caput(FAST_SHTR, 'Close')
|
||||
#restore_eiger()
|
||||
print "Running time: " + str(time.time() - start)
|
||||
@@ -0,0 +1,12 @@
|
||||
EXPOSURE = 1.0
|
||||
AVERAGE = 2
|
||||
|
||||
counter = 0
|
||||
while(True):
|
||||
print "-> Averaging %d..." % (counter,)
|
||||
init_eiger(exposure=EXPOSURE)
|
||||
av = average_eiger_frames(AVERAGE, roi=None, wait_next=True)
|
||||
plot(av.matrix)
|
||||
print "-> Restoring %d..." % (counter,)
|
||||
restore_eiger()
|
||||
counter = counter+1
|
||||
@@ -0,0 +1,14 @@
|
||||
def neutralize_position(retries = 3):
|
||||
for i in range(retries):
|
||||
try:
|
||||
if abs(manip_x.readback.read()) > 50:
|
||||
manip_x.write(0.0)
|
||||
if abs(manip_y.readback.read()) > 50:
|
||||
manip_y.write(0.0)
|
||||
|
||||
time.sleep(1)
|
||||
break
|
||||
except:
|
||||
if i>=(retries-1):
|
||||
raise
|
||||
log("neutralize_position error - retrying: " + sys.exc_info()[1])
|
||||
Reference in New Issue
Block a user