This commit is contained in:
2024-10-11 15:01:20 +03:00
parent 46ac8ee887
commit 281beba65a

View File

@@ -251,7 +251,12 @@ def computeFocus(
if len(futures):
print("", file=log_output)
print(log_ident, file=log_output, end="")
print("waiting for the end of calculations ...\t", file=log_output, end="", flush=True)
print(
"waiting for the end of calculations ...\t",
file=log_output,
end="",
flush=True,
)
for i in range(len(futures)):
flux_rad.append(futures[i].result())
@@ -390,41 +395,55 @@ def focussingSequence(
ret_code = 0
for foc_val in focus_value:
print(log_ident, file=log_output, end="")
print("set focus value to {:g} ...\t".format(foc_val), file=log_output, end="", flush=True)
print(
"set focus value to {:g} ...\t".format(foc_val),
file=log_output,
end="",
flush=True,
)
ret_code = set_focus_func(foc_val)
if ret_code:
ret_val["ret_code"] = ret_code
print("FAIL!", file=log_output)
print("FAIL!", file=log_output, flush=True)
break
else:
print("OK", file=log_output)
print("OK", file=log_output, flush=True)
filename = "{}_{:04d}{}".format(fname, i_foc, file_ext)
full_filename = str(pt.Path.joinpath(dir, pt.Path(filename)))
print(log_ident, file=log_output, end="")
print("get image '{}' ...\t".format(full_filename), file=log_output, end="", flush=True)
print(
"get image '{}' ...\t".format(full_filename),
file=log_output,
end="",
flush=True,
)
ret_code = get_image_func(full_filename, seq_kwds["exp_time"])
if ret_code:
ret_val["ret_code"] = ret_code
print("FAIL!", file=log_output)
print("FAIL!", file=log_output, flush=True)
break
else:
print("OK", file=log_output)
print("OK", file=log_output, flush=True)
futures.append(executor.submit(amt.compute_mean_flux_radius, full_filename, **seq_kwds))
futures.append(
executor.submit(amt.compute_mean_flux_radius, full_filename, **seq_kwds)
)
i_foc += 1
print("", file=log_output)
print(log_ident, file=log_output, end="")
print("waiting for the end of calculations ...\t", file=log_output, end="")
print("", file=log_output, flush=True)
print(log_ident, file=log_output, end="", flush=True)
print(
"waiting for the end of calculations ...\t", file=log_output, end="", flush=True
)
for i in range(len(futures)):
flux_rad.append(futures[i].result())
print("OK", file=log_output)
print("OK", file=log_output, flush=True)
if ret_code == 0:
fit_res = fitFocusCurve(focus_value, flux_rad, **seq_kwds)
@@ -434,7 +453,10 @@ def focussingSequence(
ret_val["is_robust"] = fit_res[2]
else:
print(
"THERE WERE ERRORS DURING FOCUSSING SEQUENCE SO NO BEST FOCUS IS AVAILABLE!!!"
"THERE WERE ERRORS DURING FOCUSSING SEQUENCE SO NO BEST FOCUS IS AVAILABLE!!!",
file=log_output,
end="",
flush=True,
)
return ret_val