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
7a967334
Commit
7a967334
authored
Oct 23, 2025
by
BO ZHANG
🏀
Browse files
add support for fits: open, getheader, getval, getdata
parent
9e9234cb
Pipeline
#10804
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/test_fits.py
0 → 100644
View file @
7a967334
"""
Identifier: tests/test_fits_header_ops.py
Name: test_fits_header_ops.py
Description: test append_header
Author: Bo Zhang
Created: 2023-12-15
Modified-History:
2023-12-15, Bo Zhang, add TestFitsHeaderOps.test_append_header
2023-12-15, Bo Zhang, add TestFitsHeaderOps.test_reformat_header
"""
import
os
import
unittest
from
csst_common
import
fits
test_fits_file
=
os
.
path
.
join
(
os
.
environ
[
"UNIT_TEST_DATA_ROOT"
],
"csst_common/test_fits/hl.fits"
,
)
class
TestFitsHeaderOps
(
unittest
.
TestCase
):
def
test_fits_open
(
self
):
hl
=
fits
.
open
(
test_fits_file
)
self
.
assertIsInstance
(
hl
,
fits
.
HDUList
)
def
test_fits_header
(
self
):
header
=
fits
.
getheader
(
test_fits_file
,
ext
=
0
)
self
.
assertIsInstance
(
header
,
fits
.
Header
)
def
test_fits_getval
(
self
):
val
=
fits
.
getval
(
test_fits_file
,
ext
=
0
,
keyword
=
"SIMPLE"
)
self
.
assertEqual
(
val
,
True
)
def
test_fits_getdata
(
self
):
data
=
fits
.
getdata
(
test_fits_file
,
ext
=
0
)
self
.
assertEqual
(
data
,
None
)
tests/test_io.py
View file @
7a967334
...
...
@@ -22,7 +22,6 @@ from csst_common.io import (
generate_meta
,
append_meta
,
extract_meta
,
fits_open
,
)
...
...
@@ -143,12 +142,3 @@ class TestFitsHeaderOps(unittest.TestCase):
self
.
assertIn
(
"META"
,
set
(
hdulist
[
0
].
header
.
keys
()))
meta
=
extract_meta
(
hdulist
)
self
.
assertEqual
(
meta
[
"obs_id"
],
"123456"
)
def
test_fits_open
(
self
):
hl
=
fits_open
(
os
.
path
.
join
(
os
.
environ
[
"UNIT_TEST_DATA_ROOT"
],
"csst_common/test_fits/hl.fits"
,
)
)
self
.
assertTrue
(
isinstance
(
hl
,
fits
.
HDUList
))
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