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
.. literalinclude:: csst_common/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:
:language: python
......
......@@ -74,16 +74,18 @@ def process_single_image(
# check result existence
if os.path.exists(filepath_output):
# file exists, check precison
if fits.getheader(filepath_output)["TOL"] < 1e-5:
return CsstStatus.PERFECT, fr
# file exists, check status and precision
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
else:
return CsstStatus.WARNING, fr
return CsstStatus.WARNING
else:
# file doesn't exist, do your fallback solution
fits.HDUList(fits.PrimaryHDU()).writeto(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)
......@@ -100,8 +102,10 @@ def one_job(dm: CsstMsDataManager, detector: int):
# check result existence
if os.path.exists(filepath_output):
# file exists, check precison
if fits.getheader(filepath_output)["TOL"] < 1e-5:
# file exists, check status and precision
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
else:
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