Commit 96b2c78c authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

update example_interface.py

parent 279717c0
Pipeline #261 passed with stages
in 12 seconds
...@@ -286,7 +286,7 @@ Source code ...@@ -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
......
...@@ -74,16 +74,18 @@ def process_single_image( ...@@ -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)
...@@ -100,8 +102,10 @@ def one_job(dm: CsstMsDataManager, detector: int): ...@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment