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
11b366fd
Commit
11b366fd
authored
Aug 05, 2025
by
BO ZHANG
🏀
Browse files
tweaks
parent
788497ee
Pipeline
#10162
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_common/io.py
View file @
11b366fd
...
@@ -9,6 +9,7 @@ Modified-History:
...
@@ -9,6 +9,7 @@ Modified-History:
2023-12-15, Bo Zhang, added 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
2023-12-16, Bo Zhang, fixed a bug in finding the first key when reformatting
2024-06-08, Bo Zhang, added delete_section
2024-06-08, Bo Zhang, added delete_section
2025-08-05, Bo Zhang, added generate_meta
"""
"""
import
os
import
os
...
@@ -16,14 +17,14 @@ import json
...
@@ -16,14 +17,14 @@ import json
import
bisect
import
bisect
import
warnings
import
warnings
from
copy
import
deepcopy
from
copy
import
deepcopy
from
typing
import
Optional
from
typing
import
Optional
,
Any
from
astropy.io
import
fits
from
astropy.io
import
fits
REQUIRED_KEYS_IN_META
=
dict
(
REQUIRED_KEYS_IN_META
=
dict
(
# 观测数据相关的ID参数
# 观测数据相关的ID参数
dataset
=
"__
instrumen
t__"
,
dataset
=
"__
datase
t__"
,
instrument
=
"__instrument__"
,
instrument
=
"__instrument__"
,
obs_type
=
"__obs_type__"
,
obs_type
=
"__obs_type__"
,
obs_group
=
"__obs_group__"
,
obs_group
=
"__obs_group__"
,
...
@@ -56,7 +57,7 @@ def generate_meta(**kwargs) -> fits.Header:
...
@@ -56,7 +57,7 @@ def generate_meta(**kwargs) -> fits.Header:
Parameters
Parameters
----------
----------
kwargs :
dict
kwargs :
Any
Meta data.
Meta data.
Returns
Returns
...
...
tests/test_fits_header_ops.py
View file @
11b366fd
...
@@ -13,7 +13,13 @@ import unittest
...
@@ -13,7 +13,13 @@ import unittest
from
astropy.io
import
fits
from
astropy.io
import
fits
from
csst_common.io
import
append_header
,
reformat_header
,
delete_section
,
get_proc_info
from
csst_common.io
import
(
append_header
,
reformat_header
,
delete_section
,
get_proc_info
,
generate_meta
,
)
class
TestFitsHeaderOps
(
unittest
.
TestCase
):
class
TestFitsHeaderOps
(
unittest
.
TestCase
):
...
@@ -122,3 +128,7 @@ class TestFitsHeaderOps(unittest.TestCase):
...
@@ -122,3 +128,7 @@ class TestFitsHeaderOps(unittest.TestCase):
def
test_get_proc_info
(
self
):
def
test_get_proc_info
(
self
):
proc_info
=
get_proc_info
()
proc_info
=
get_proc_info
()
self
.
assertEquals
(
proc_info
[
"BUILD"
],
"-"
)
self
.
assertEquals
(
proc_info
[
"BUILD"
],
"-"
)
def
test_generate_meta
(
self
):
h
=
generate_meta
()
self
.
assertIsInstance
(
h
,
fits
.
Header
)
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