06.2026
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#If running from editor
|
||||
if (get_exec_pars().source == CommandSource.ui) and (get_exec_pars().script == "Eiger2Img") :
|
||||
METHOD = "Two_Pol"
|
||||
SWITCHING = "Tune_Detune"
|
||||
METHOD = "Two_Pol" # "Two_Energies"
|
||||
SWITCHING = "Normal" #"Tune_Detune"
|
||||
SEQUENCE = "A"
|
||||
MEASUREMENTS = 4
|
||||
AUTO_SAVE = True
|
||||
@@ -16,6 +16,35 @@ if (get_exec_pars().source == CommandSource.ui) and (get_exec_pars().script == "
|
||||
print "Starting 2Img: ", METHOD, SWITCHING, SEQUENCE , MEASUREMENTS, AUTO_SAVE, EXPOSURE, AVERAGE, ENERGY_1, ENERGY_2, SWITCH_POL,NUMBER_SCANS
|
||||
#SEQUENCE = "A": C+,C-,C-,C+,C+;C-,C-,C+,␍
|
||||
#SEQUENCE = "B": C+,C-,C+,C-,C+,-;C+,C-.
|
||||
|
||||
#def get_dry_run():
|
||||
# return True
|
||||
|
||||
|
||||
#TODO: fix id.py
|
||||
cur_pol = ID2_mode.read()
|
||||
def init_pol_switch(switching_type, sid = "ID2", pol_id1=None, pol_id2=None):
|
||||
print "Init id2 Pol=" + str(cur_pol)
|
||||
|
||||
def switch_pol():
|
||||
global cur_pol
|
||||
cur = ID2_mode.read()
|
||||
if cur == "Circular+":
|
||||
next = "Circular-"
|
||||
elif cur == "Circular-":
|
||||
next = "Circular+"
|
||||
elif cur == "Linear H":
|
||||
next = "Linear V+"
|
||||
elif cur == "Linear V+":
|
||||
next = "Linear H"
|
||||
else:
|
||||
raise Exception("Invalid initial pol: " + str(cur_pol))
|
||||
print "Set id2 Pol=" + str(next)
|
||||
if not get_dry_run():
|
||||
ID2_mode.move(next)
|
||||
wait_channel("X11PHS:alldone", 1)
|
||||
cur_pol = next
|
||||
|
||||
|
||||
SHOW_IMAGES = True
|
||||
SAVE_DIAGS = True
|
||||
@@ -34,26 +63,27 @@ start = time.time()
|
||||
threads = []
|
||||
image_drift=None
|
||||
calculated_shifts={}
|
||||
data_path = "{data}/{year}_{month}/{date}/{date}_{name}"
|
||||
set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True)
|
||||
#data_path = "{data}/{year}_{month}/{date}/{date}_{name}"
|
||||
#set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True)
|
||||
set_exec_pars(name=METHOD, open=True)
|
||||
|
||||
|
||||
def get_image_file_name(cycle=-1, frame_index=0, short_name=False, shifted=False):
|
||||
global max_index
|
||||
if (METHOD == "Two_Pol") and (SEQUENCE == "A") and (frame_index<2) and ((cycle%2)==0): #Swapped
|
||||
frame_index = 0 if frame_index else 1
|
||||
root = "" if short_name else (data_path + "/")
|
||||
root = "" if short_name else (get_exec_pars().path + "/")
|
||||
abs_index=run_index + frame_index
|
||||
max_index= max(max_index, frame_index)
|
||||
prefix = Setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,)))
|
||||
prefix = Setup.expandPath("i{date}%02d_" + ("%04d" % (abs_index,)))
|
||||
|
||||
if cycle < 0:
|
||||
if (shifted):
|
||||
prefix = "c" + prefix
|
||||
ret = root + prefix + ".tif"
|
||||
ret = root + prefix + ".tiff"
|
||||
else:
|
||||
prefix = prefix + ("_corr/c" if shifted else "/")
|
||||
ret= root + prefix + "i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
|
||||
ret= root + prefix + "i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tiff"
|
||||
return Setup.expandPath(ret)
|
||||
|
||||
|
||||
@@ -76,6 +106,7 @@ if not get_dry_run() and str(get_setting("AUTO_SWITCH_SHUTTER")).lower() == "tru
|
||||
if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")):
|
||||
init_pol_switch(SWITCHING)
|
||||
|
||||
|
||||
def imageinfo(info):
|
||||
pass
|
||||
|
||||
@@ -126,7 +157,7 @@ def save_image_file(frame, cycle=-1, frame_index=0, processed_shift=False):
|
||||
|
||||
init_eiger(exposure=EXPOSURE)
|
||||
|
||||
run_index = Context.getDaySequentialNumber()
|
||||
run_index = 0 #Context.getDaySequentialNumber()
|
||||
print " ---- Run index : %d" %(run_index,)
|
||||
max_index=0
|
||||
|
||||
@@ -243,8 +274,8 @@ try:
|
||||
max_index=max_index+1
|
||||
print " ---- New un index : %d" %(run_index,)
|
||||
finally:
|
||||
for i in range(max_index):
|
||||
Context.incrementDaySequentialNumber()
|
||||
#for i in range(max_index):
|
||||
# Context.incrementSequentialNumbers()
|
||||
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":
|
||||
|
||||
Reference in New Issue
Block a user