Loading doc/source/ch08_csst_common.rst +1 −1 Original line number Original line Diff line number Diff line Loading @@ -286,7 +286,7 @@ Source code .. literalinclude:: csst_common/example_interface.py .. literalinclude:: csst_common/example_interface.py :caption: ``example_interface.py`` :caption: ``example_interface.py`` :emphasize-lines: 7-11,25-29,75-86,101-112,169-171 :emphasize-lines: 7-11,25-29,75-88,103-116,173-175 :linenos: :linenos: :language: python :language: python Loading doc/source/csst_common/example_interface.py +11 −7 Original line number Original line Diff line number Diff line Loading @@ -74,16 +74,18 @@ def process_single_image( # check result existence # check result existence if os.path.exists(filepath_output): if os.path.exists(filepath_output): # file exists, check precison # file exists, check status and precision if fits.getheader(filepath_output)["TOL"] < 1e-5: if fits.getheader(filepath_output)["STT_DIST"] == 0 and \ return CsstStatus.PERFECT, fr fits.getheader(filepath_output)["PCS_DIST"] < 1e-5 and \ fits.getheader(filepath_output)["NS_DIST"] >= 8: return CsstStatus.PERFECT else: else: return CsstStatus.WARNING, fr return CsstStatus.WARNING else: else: # file doesn't exist, do your fallback solution # file doesn't exist, do your fallback solution fits.HDUList(fits.PrimaryHDU()).writeto(filepath_output) fits.HDUList(fits.PrimaryHDU()).writeto(filepath_output) assert os.path.exists(filepath_output) assert os.path.exists(filepath_output) return CsstStatus.WARNING, fr return CsstStatus.WARNING # process multiple images in an exposure (RECOMMENDED, at least for MBI or SLS) # process multiple images in an exposure (RECOMMENDED, at least for MBI or SLS) Loading @@ -100,8 +102,10 @@ def one_job(dm: CsstMsDataManager, detector: int): # check result existence # check result existence if os.path.exists(filepath_output): if os.path.exists(filepath_output): # file exists, check precison # file exists, check status and precision if fits.getheader(filepath_output)["TOL"] < 1e-5: if fits.getheader(filepath_output)["STT_DIST"] == 0 and \ fits.getheader(filepath_output)["PCS_DIST"] < 1e-5 and \ fits.getheader(filepath_output)["NS_DIST"] >= 8: return CsstStatus.PERFECT return CsstStatus.PERFECT else: else: return CsstStatus.WARNING return CsstStatus.WARNING Loading Loading
doc/source/ch08_csst_common.rst +1 −1 Original line number Original line Diff line number Diff line Loading @@ -286,7 +286,7 @@ Source code .. literalinclude:: csst_common/example_interface.py .. literalinclude:: csst_common/example_interface.py :caption: ``example_interface.py`` :caption: ``example_interface.py`` :emphasize-lines: 7-11,25-29,75-86,101-112,169-171 :emphasize-lines: 7-11,25-29,75-88,103-116,173-175 :linenos: :linenos: :language: python :language: python Loading
doc/source/csst_common/example_interface.py +11 −7 Original line number Original line Diff line number Diff line Loading @@ -74,16 +74,18 @@ def process_single_image( # check result existence # check result existence if os.path.exists(filepath_output): if os.path.exists(filepath_output): # file exists, check precison # file exists, check status and precision if fits.getheader(filepath_output)["TOL"] < 1e-5: if fits.getheader(filepath_output)["STT_DIST"] == 0 and \ return CsstStatus.PERFECT, fr fits.getheader(filepath_output)["PCS_DIST"] < 1e-5 and \ fits.getheader(filepath_output)["NS_DIST"] >= 8: return CsstStatus.PERFECT else: else: return CsstStatus.WARNING, fr return CsstStatus.WARNING else: else: # file doesn't exist, do your fallback solution # file doesn't exist, do your fallback solution fits.HDUList(fits.PrimaryHDU()).writeto(filepath_output) fits.HDUList(fits.PrimaryHDU()).writeto(filepath_output) assert os.path.exists(filepath_output) assert os.path.exists(filepath_output) return CsstStatus.WARNING, fr return CsstStatus.WARNING # process multiple images in an exposure (RECOMMENDED, at least for MBI or SLS) # process multiple images in an exposure (RECOMMENDED, at least for MBI or SLS) Loading @@ -100,8 +102,10 @@ def one_job(dm: CsstMsDataManager, detector: int): # check result existence # check result existence if os.path.exists(filepath_output): if os.path.exists(filepath_output): # file exists, check precison # file exists, check status and precision if fits.getheader(filepath_output)["TOL"] < 1e-5: if fits.getheader(filepath_output)["STT_DIST"] == 0 and \ fits.getheader(filepath_output)["PCS_DIST"] < 1e-5 and \ fits.getheader(filepath_output)["NS_DIST"] >= 8: return CsstStatus.PERFECT return CsstStatus.PERFECT else: else: return CsstStatus.WARNING return CsstStatus.WARNING Loading