Fix bug parallel nwriting
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Sun Feb 09 15:51:55 CET 2020
|
||||
#Tue Feb 11 17:02:23 CET 2020
|
||||
HARMONIC_ID_1=1
|
||||
ALPHA_ID_2=0.0
|
||||
ENERGY=708.5
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#Tue Feb 11 15:43:01 CET 2020
|
||||
FileSequentialNumber=568
|
||||
#Tue Feb 11 17:26:16 CET 2020
|
||||
FileSequentialNumber=577
|
||||
|
||||
@@ -161,7 +161,7 @@ def _save_as_tiff(data, filename, check=False, show = False):
|
||||
|
||||
def save_as_tiff(data, filename, check=False, show = False, parallel=True):
|
||||
if parallel:
|
||||
fork((_save_as_tiff,(filename, check, show)),)
|
||||
return fork((_save_as_tiff,(data, filename, check, show)),)
|
||||
else:
|
||||
_save_as_tiff(data, filename, check, show)
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ if METHOD == "Two_Energies":
|
||||
if en < 89.9 or en > 2000:
|
||||
raise Exception("Bad energy argument")
|
||||
|
||||
start = time.time()
|
||||
threads = []
|
||||
|
||||
path = "{data}/{year}_{month}/{date}" + "/" + METHOD + "_{seq}%03d"
|
||||
@@ -156,7 +157,8 @@ def save_image_file(frame, cycle=-1, frame_index=0):
|
||||
if SHOW_IMAGES:
|
||||
plot(frame.matrix if (type(frame) == Data) else get_ip_array(frame), name = get_image_file_name(cycle, frame_index, True))
|
||||
if AUTO_SAVE and (frame is not None):
|
||||
filename = get_image_file_name(cycle, frame_index)
|
||||
filename = get_image_file_name(cycle, frame_index)
|
||||
threads.append(save_as_tiff(frame, filename, check=False, parallel=True))
|
||||
|
||||
log(filename)
|
||||
print filename
|
||||
@@ -213,7 +215,10 @@ try:
|
||||
# objective = getObjective()
|
||||
# temp = getLEEMtemp()
|
||||
# log(0 , "Temp : " + Format(temp,"0.00") + " OB : " + Format(objective,"0.00") + " StigmaA : " + " StigmaB : " )
|
||||
# Auto average and save
|
||||
# Auto average and save
|
||||
|
||||
print "Waiting file writing threads to finish..."
|
||||
for t in threads:
|
||||
join(t)
|
||||
if (METHOD != "Take_Image") and (MEASUREMENTS > 1) and (AUTO_SAVE == 1):
|
||||
print "--- Averaging..."
|
||||
|
||||
@@ -10,7 +10,7 @@ if get_exec_pars().source == CommandSource.ui:
|
||||
NUMBER_SCANS =1
|
||||
RANGES = [[500.0, 1000.0, 100.0]]
|
||||
|
||||
DRY_RUN=True
|
||||
DRY_RUN=False
|
||||
|
||||
if len(RANGES) == 0:
|
||||
raise Exception("No scan range defined")
|
||||
|
||||
Reference in New Issue
Block a user