fixes during real tests

This commit is contained in:
2024-10-11 02:12:34 +03:00
parent ce5fade2ff
commit 46ac8ee887
2 changed files with 22 additions and 15 deletions

View File

@@ -84,7 +84,7 @@ def getFocusSequencePars(**user_kwds):
"focus_start": None,
"focus_stop": None,
"focus_step": None,
"root_filename": "focus.fits",
"root_filename": "focus.fit",
"acq_per_value": 1, # number of acquisitions per focus value
"exp_time": 10, # exposure time in seconds
"set_to_best": True, # set focus to the best value
@@ -251,7 +251,7 @@ 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="")
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())
@@ -353,7 +353,7 @@ def focussingSequence(
ret_val["ret_code"] = -1
return ret_val
N = (focus_range[1] - focus_range[0]) / focus_range[2] + 1
N = int((focus_range[1] - focus_range[0]) / focus_range[2] + 1)
if N < 3:
ret_val["ret_code"] = -1
@@ -379,18 +379,18 @@ def focussingSequence(
fname = rname.stem
file_ext = rname.suffix
if file_ext == "":
file_ext = ".fits"
file_ext = ".fit"
futures = []
flux_rad = []
executor = ProcessPoolExecutor(max_workers=max_wks)
i_foc = 0
i_foc = 1
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="")
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:
@@ -401,10 +401,10 @@ def focussingSequence(
print("OK", file=log_output)
filename = "{}_{:04d}{}".format(fname, i_foc, file_ext)
full_filename = pt.Path.joinpath(dir, pt.Path(filename))
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="")
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:
@@ -414,7 +414,8 @@ def focussingSequence(
else:
print("OK", file=log_output)
futures.append(executor.submit(amt.compute_mean_flux_radius, fname, **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="")
@@ -580,9 +581,9 @@ def getFocussingSequenceCmdlinePars(parser):
parser.add_argument(
"--foc-file",
help="Rootname of output focussing images. Default is 'focus.fits'.",
help="Rootname of output focussing images. Default is 'focus.fit'.",
type=str,
default="focus.fits",
default="focus.fit",
)
parser.add_argument(
@@ -702,7 +703,7 @@ def parsFocussingSequenceCmdlinePars(parser_args, parser_msg=[]):
parser_msg.append("Invalid '--foc_file' argument! Use of defaul value!")
kwds["root_filename"] = (
parser_args.foc_file if parser_args.foc_file != "" else "focus.fits"
parser_args.foc_file if parser_args.foc_file != "" else "focus.fit"
)
if parser_args.repeat <= 0: