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_common
Commits
0da320ef
Commit
0da320ef
authored
Jun 08, 2024
by
BO ZHANG
🏀
Browse files
add delete_section
parent
be7eda29
Pipeline
#5410
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
tests/test_fits_header_ops.py
View file @
0da320ef
...
...
@@ -8,11 +8,12 @@ Modified-History:
2023-12-15, Bo Zhang, add TestFitsHeaderOps.test_append_header
2023-12-15, Bo Zhang, add TestFitsHeaderOps.test_reformat_header
"""
import
unittest
from
astropy.io
import
fits
from
csst_common.io
import
append_header
,
reformat_header
from
csst_common.io
import
append_header
,
reformat_header
,
delete_section
class
TestFitsHeaderOps
(
unittest
.
TestCase
):
...
...
@@ -100,3 +101,20 @@ class TestFitsHeaderOps(unittest.TestCase):
tuple
(
h_rfmt
.
keys
()),
(
"COMMENT"
,
"COMMENT"
,
"COMMENT"
,
"A"
,
"SIMPLE"
,
"NAXIS1"
),
)
def
test_delete_section
(
self
):
h
=
fits
.
Header
()
h
.
add_comment
(
"A"
)
h
.
add_comment
(
"B"
)
h
.
add_comment
(
"C"
)
h
.
set
(
"SIMPLE"
,
True
)
h
.
set
(
"NAXIS1"
,
1
)
h
.
add_comment
(
"======"
)
h
.
add_comment
(
"WCS"
)
h
.
add_comment
(
"======"
)
h
.
set
(
"A"
,
1
)
h
.
add_comment
(
"======"
)
h
.
add_comment
(
"======"
)
h_del
=
delete_section
(
h
,
title
=
"WCS"
)
self
.
assertEqual
(
len
(
h_del
.
cards
),
7
)
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