Initial commit
This commit is contained in:
55
best_focus.py
Executable file
55
best_focus.py
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
#
|
||||
# Compute the best focus value from sequence of FITS images
|
||||
#
|
||||
|
||||
|
||||
import OBSUTILS as obsutil
|
||||
import argparse as ap
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ap.ArgumentParser(prog=sys.argv[1])
|
||||
|
||||
parser.add_argument(
|
||||
"files", help="Acquired FITS image filenames of focussing sequence", nargs="*"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", help="Verbose output", action="store_true", default=False
|
||||
)
|
||||
|
||||
parser = obsutil.getFocusCalcCmdlinePars(parser)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
log = []
|
||||
foc_kwds = obsutil.parsFocusCalcCmdlinePars(args, log)
|
||||
|
||||
if args.verbose:
|
||||
if len(log):
|
||||
for log_str in log:
|
||||
print(log_str)
|
||||
|
||||
if args.verbose:
|
||||
print("START FOCUS MEASUREMENT: \n")
|
||||
|
||||
if args.verbose:
|
||||
result = obsutil.computeFocus(args.files, log_output=sys.stdout, **foc_kwds)
|
||||
else:
|
||||
result = obsutil.computeFocus(args.files, log_output=None, **foc_kwds)
|
||||
|
||||
# if args.verbose:
|
||||
# for log_str in result["log"]:
|
||||
# print("\t", log_str)
|
||||
|
||||
if result["ret_code"] != 0:
|
||||
if args.verbose:
|
||||
print("\nFAIL!")
|
||||
sys.exit(result["ret_code"])
|
||||
|
||||
if args.verbose:
|
||||
print("\nALL DONE")
|
||||
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user