focus_seq_FLI.py: rewrite for using ccd_capture
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
# This variant of the script uses Eddy Emelianov's
|
||||
# 'fli_control' executable
|
||||
#
|
||||
# 27.04.2026 (Fatkhullin T.A.)
|
||||
# changes according to Eddy Emelianov's "ccd_capture" executable
|
||||
# (a new age FLI hardware control software)
|
||||
#
|
||||
|
||||
|
||||
from OBSUTILS import focussing_app
|
||||
@@ -21,15 +25,24 @@ import pathlib as pl
|
||||
|
||||
|
||||
def init_seq(seq_kwds):
|
||||
# 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)
|
||||
# # 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)
|
||||
|
||||
pt = pl.Path(seq_kwds["root_filename"])
|
||||
if not len(pt.suffix):
|
||||
pt.with_suffix(".fits")
|
||||
seq_kwds["root_filename"] = str(pt)
|
||||
|
||||
#
|
||||
# search for existing files
|
||||
# and compute start index of focus file
|
||||
#
|
||||
|
||||
foc_files = list(
|
||||
pt.absolute().parent.glob("{}_[0-9][0-9][0-9][0-9].fit".format(pt.stem))
|
||||
# 27.04.2026
|
||||
pt.absolute().parent.glob("{}_[0-9][0-9][0-9][0-9]{}".format(pt.stem, pt.suffix))
|
||||
# pt.absolute().parent.glob("{}_[0-9][0-9][0-9][0-9].fit".format(pt.stem))
|
||||
)
|
||||
|
||||
seq_kwds["start_idx"] = 1
|
||||
@@ -51,7 +64,11 @@ def set_focus(foc_val):
|
||||
print("INVALID FLI-FOCUSER VALUE! IT MUST BE NON-NEGATIVE VALUE!")
|
||||
return -1
|
||||
|
||||
cmd = ["fli_control", "-g", str(int(foc_val))]
|
||||
# cmd = ["fli_control", "-g", str(int(foc_val))]
|
||||
|
||||
# 27.04.2026
|
||||
cmd = ["ccd_capture", "-VVV", "--plugin", "libdevfli.so", "-r", "/tmp/10micron.fitsheader", "-r", "/tmp/telescope.fitsheader", "-r", "/tmp/dome.fitsheader", "-g", str(foc_val)]
|
||||
|
||||
ret = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||
return ret.returncode
|
||||
|
||||
@@ -61,20 +78,23 @@ def get_image(filename, exp_time):
|
||||
# Eddy's 'fli_control' related stub:
|
||||
# filename is expected in form 'rootname_DDDD.ext'
|
||||
# convert it to 'rootname'
|
||||
#
|
||||
|
||||
|
||||
fname = str(filename).split("_")
|
||||
fname = fname[0]
|
||||
# fname = str(filename).split("_")
|
||||
# fname = fname[0]
|
||||
|
||||
cmd = [
|
||||
"fli_control",
|
||||
"-r",
|
||||
"/tmp/10micron.fitsheader",
|
||||
"-x",
|
||||
"{:d}".format(int(np.round(exp_time * 1000))), # to microseconds
|
||||
fname,
|
||||
]
|
||||
# cmd = [
|
||||
# "fli_control",
|
||||
# "-r",
|
||||
# "/tmp/10micron.fitsheader",
|
||||
# "-x",
|
||||
# "{:d}".format(int(np.round(exp_time * 1000))), # to microseconds
|
||||
# fname,
|
||||
# ]
|
||||
|
||||
# 27.04.2026
|
||||
cmd = ["ccd_capture", "-VVV", "--plugin", "libdevfli.so", "-r", "/tmp/10micron.fitsheader", "-r", "/tmp/telescope.fitsheader", "-r", "/tmp/dome.fitsheader", "-x", str(exp_time), "-o", filename]
|
||||
|
||||
ret = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||
return ret.returncode
|
||||
|
||||
@@ -82,7 +102,9 @@ def get_image(filename, exp_time):
|
||||
if __name__ == "__main__":
|
||||
parser = ap.ArgumentParser(
|
||||
prog="{}".format(pl.Path(sys.argv[0]).name),
|
||||
description="FLI CCD and focuser hardware: focussing sequence implementation. It is assumed that 'fli_control' software is installed in the OS.",
|
||||
# 27.04.2026
|
||||
description="FLI CCD and focuser hardware: focussing sequence implementation. It is assumed that 'ccd_capture' software is installed in the OS.",
|
||||
# description="FLI CCD and focuser hardware: focussing sequence implementation. It is assumed that 'fli_control' software is installed in the OS.",
|
||||
)
|
||||
|
||||
ret = focussing_app(parser, init_seq, set_focus, get_image)
|
||||
|
||||
Reference in New Issue
Block a user