Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_proto
Commits
96b2c78c
Commit
96b2c78c
authored
Feb 09, 2023
by
BO ZHANG
🏀
Browse files
update example_interface.py
parent
279717c0
Pipeline
#261
passed with stages
in 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
doc/source/ch08_csst_common.rst
View file @
96b2c78c
...
...
@@ -286,7 +286,7 @@ Source code
.. literalinclude:: csst_common/example_interface.py
:caption: ``example_interface.py``
:emphasize-lines: 7-11,25-29,75-8
6
,10
1
-11
2
,1
69
-17
1
:emphasize-lines: 7-11,25-29,75-8
8
,10
3
-11
6
,1
73
-17
5
:linenos:
:language: python
...
...
doc/source/csst_common/example_interface.py
View file @
96b2c78c
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment