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-dfs
csst-dfs-commons
Commits
7c3a3f05
Commit
7c3a3f05
authored
Feb 21, 2023
by
Wei Shoulin
Browse files
get fits header
parent
c400cca7
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_commons/utils/fits.py
View file @
7c3a3f05
...
@@ -2,13 +2,20 @@ from astropy_healpix import HEALPix
...
@@ -2,13 +2,20 @@ from astropy_healpix import HEALPix
from
astropy.coordinates
import
ICRS
from
astropy.coordinates
import
ICRS
from
astropy
import
units
as
u
from
astropy
import
units
as
u
from
astropy.coordinates
import
SkyCoord
from
astropy.coordinates
import
SkyCoord
from
astropy.io
import
fits
def
get_header_value
(
key
:
str
,
header
,
default_value
=
None
):
def
get_header_value
(
key
:
str
,
header
s
,
default_value
=
None
):
try
:
try
:
v
=
header
[
key
]
ret_value
=
None
if
type
(
v
)
==
str
:
if
not
isinstance
(
headers
,
list
):
return
v
.
strip
()
headers
=
[
headers
]
return
v
for
header
in
headers
:
if
key
in
header
:
ret_value
=
header
[
key
]
if
type
(
ret_value
)
==
str
:
return
ret_value
.
strip
()
if
ret_value
is
None
:
return
default_value
except
Exception
as
e
:
except
Exception
as
e
:
return
default_value
return
default_value
...
...
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