some fixes
This commit is contained in:
22
focus_app.py
22
focus_app.py
@@ -177,16 +177,34 @@ def focussing_app(parser, init_seq_func, set_focus_func, get_image_func):
|
||||
**seq_kwds
|
||||
)
|
||||
|
||||
if result["ret_code"]:
|
||||
if args.verbose:
|
||||
print(
|
||||
"\tFocussing sequence returned error code: {:g}".format(
|
||||
result["ret_code"]
|
||||
)
|
||||
)
|
||||
print("\tCannot set best focus value!")
|
||||
|
||||
return result["ret_code"]
|
||||
|
||||
if args.verbose:
|
||||
print("\tThe best focus value: {:g}".format(result["focus_value"]))
|
||||
|
||||
if not args.do_not_set:
|
||||
if args.verbose:
|
||||
print("\n\tSet focus to the best value ...", end="")
|
||||
set_focus_func(result["focus_value"])
|
||||
|
||||
ret_code = set_focus_func(result["focus_value"])
|
||||
|
||||
if ret_code:
|
||||
if args.verbose:
|
||||
print("\tFAILED")
|
||||
else:
|
||||
if args.verbose:
|
||||
print("\tOK")
|
||||
|
||||
if args.verbose:
|
||||
print("DONE.")
|
||||
|
||||
return 0
|
||||
return ret_code
|
||||
|
||||
@@ -21,7 +21,7 @@ import pathlib as pl
|
||||
|
||||
|
||||
def init_seq(seq_kwds):
|
||||
# replace extension as Eddy's 'fli_control' add hardcoded '.fit'
|
||||
# replace extension since Eddy's 'fli_control' adds hardcoded '.fit'
|
||||
pt = pl.Path(seq_kwds["root_filename"]).with_suffix(".fit")
|
||||
seq_kwds["root_filename"] = str(pt)
|
||||
|
||||
@@ -47,6 +47,10 @@ def init_seq(seq_kwds):
|
||||
|
||||
|
||||
def set_focus(foc_val):
|
||||
if foc_val < 0:
|
||||
print("INVALID FLI-FOCUSER VALUE! IT MUST BE NON-NEGATIVE VALUE!")
|
||||
return -1
|
||||
|
||||
cmd = ["fli_control", "-g", str(int(foc_val))]
|
||||
ret = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||
return ret.returncode
|
||||
|
||||
@@ -20,6 +20,9 @@ import subprocess as sp
|
||||
|
||||
|
||||
def set_focus(foc_val):
|
||||
if foc_val < 0:
|
||||
print("INVALID FLI-FOCUSER VALUE! IT MUST BE NON-NEGATIVE VALUE!")
|
||||
return -1
|
||||
cmd = ["fli_control", "-g", str(int(foc_val))]
|
||||
ret = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||
return ret.returncode
|
||||
@@ -159,8 +162,11 @@ if __name__ == "__main__":
|
||||
focus_stop = result["focus_value"] + r
|
||||
|
||||
if args.verbose:
|
||||
print("\testimate guess focus position in range [{:g},{:g}]".format(focus_start, focus_stop))
|
||||
|
||||
print(
|
||||
"\testimate guess focus position in range [{:g},{:g}]".format(
|
||||
focus_start, focus_stop
|
||||
)
|
||||
)
|
||||
|
||||
if np.isfinite(args.focus_step):
|
||||
result = obsutil.focussingSequence(
|
||||
|
||||
Reference in New Issue
Block a user