From 8a783405bb42e4f53da6ef7186517f868945d27f Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Mon, 27 Apr 2026 18:09:52 +0300 Subject: [PATCH] focus_seq_FLI.py: rewrite for using ccd_capture --- focus_seq_FLI.py | 56 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/focus_seq_FLI.py b/focus_seq_FLI.py index 4f4218f..9686366 100755 --- a/focus_seq_FLI.py +++ b/focus_seq_FLI.py @@ -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)