Skip to content
GitLab
Explore
Projects
Groups
Snippets
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_common
Commits
920d289c
Commit
920d289c
authored
1 year ago
by
BO ZHANG
Browse files
Options
Download
Email Patches
Plain Diff
add type annotation
parent
aa18ce37
No related merge requests found
Pipeline
#2437
failed with stage
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
csst_common/io.py
+31
-2
csst_common/io.py
with
31 additions
and
2 deletions
+31
-2
csst_common/io.py
+
31
-
2
View file @
920d289c
...
@@ -6,10 +6,12 @@ Author: Bo Zhang
...
@@ -6,10 +6,12 @@ Author: Bo Zhang
Created: 2023-12-13
Created: 2023-12-13
Modified-History:
Modified-History:
2023-12-10, Bo Zhang, created
2023-12-10, Bo Zhang, created
2023-12-15, Bo Zhang, add verify_checksum and append_header, add module header
2023-12-15, Bo Zhang, added verify_checksum and append_header, add module header
2023-12-16, Bo Zhang, fixed a bug in finding the first key when reformatting
"""
"""
import
warnings
import
warnings
from
copy
import
deepcopy
from
copy
import
deepcopy
from
typing
import
Optional
from
astropy.io
import
fits
from
astropy.io
import
fits
...
@@ -86,7 +88,34 @@ def append_header(
...
@@ -86,7 +88,34 @@ def append_header(
return
original_h
return
original_h
def
reformat_header
(
h
:
fits
.
Header
,
strip
=
True
,
comment
=
None
):
def
reformat_header
(
h
:
fits
.
Header
,
strip
:
bool
=
True
,
comment
:
Optional
[
str
]
=
None
,
):
"""
Reformat fits Header.
Remove blanks, comments, and history, and add a new comment at the beginning.
Parameters
----------
h : fits.Header
The original header.
strip: bool = True
If `True`, strip cards like SIMPLE, BITPIX, etc.
so the rest of the header can be used to reconstruct another kind of header.
comment: Optional[str] = None
The new comment at the beginning.
See Also
--------
astropy.io.fits.Header.strip()
References
----------
https://docs.astropy.org/en/stable/io/fits/api/headers.html#astropy.io.fits.Header.strip
"""
h_copy
=
deepcopy
(
h
)
h_copy
=
deepcopy
(
h
)
# strip
# strip
if
strip
:
if
strip
:
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets