diff --git a/focus_app.py b/focus_app.py index c7aa7f3..03ffd36 100644 --- a/focus_app.py +++ b/focus_app.py @@ -125,6 +125,10 @@ def focussing_app(parser, init_seq_func, set_focus_func, get_image_func): pt.with_stem(pt.stem + "_rough") ) + # rough estimation: be sure that only a single + # acquisition per focus value + seq_rough_kwds["acq_per_value"] = 1 + result = obsutil.focussingSequence( [focus_start, focus_stop], init_seq_func, @@ -141,7 +145,7 @@ def focussing_app(parser, init_seq_func, set_focus_func, get_image_func): return result["ret_code"] # compute precise range start and stop values - r = args.num * focus_step / 2.0 + r = (args.num-1) * focus_step / 2.0 focus_start = result["focus_value"] - r focus_stop = result["focus_value"] + r diff --git a/focus_seq_FLI.py b/focus_seq_FLI.py index 382c0a2..81b89ab 100755 --- a/focus_seq_FLI.py +++ b/focus_seq_FLI.py @@ -21,8 +21,8 @@ import pathlib as pl def init_seq(seq_kwds): - # remove extension as Eddy's 'fli_control' add hardcoded '.fit' - pt = pl.Path(seq_kwds["root_filename"]).with_suffix("") + # replace extension as Eddy's 'fli_control' add hardcoded '.fit' + pt = pl.Path(seq_kwds["root_filename"]).with_suffix(".fit") seq_kwds["root_filename"] = str(pt) # @@ -35,7 +35,13 @@ def init_seq(seq_kwds): seq_kwds["start_idx"] = 1 N = len(foc_files) if N > 0: - seq_kwds["start_idx"] = N + max = 0 + for fname in foc_files: + inum = int(fname.stem.split('_')[1]) + if inum > max: + max = inum + + seq_kwds["start_idx"] = max + 1 return 0 diff --git a/focus_utils.py b/focus_utils.py index 259e9c9..3228bb9 100644 --- a/focus_utils.py +++ b/focus_utils.py @@ -335,7 +335,7 @@ def focussingSequence( ret_val["ret_code"] = -1 return ret_val - N = 7 + N = 5 if len(focus_range) > 2: if np.isclose(focus_range[2], 0): @@ -421,7 +421,7 @@ def focussingSequence( # filename = "{}_{:04d}{}".format(fname, i_foc, file_ext) # full_filename = str(pt.Path.joinpath(dir, pt.Path(filename))) - full_filename = str(rname.with_stem("{}_{:04d}", rname.stem, i_foc)) + full_filename = str(rname.with_stem("{}_{:04d}".format(rname.stem, i_foc))) print(log_ident, file=log_output, end="") print(