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-dfs
csst-dfs-commons
Commits
7c3a3f05
Commit
7c3a3f05
authored
2 years ago
by
Wei Shoulin
Browse files
Options
Download
Email Patches
Plain Diff
get fits header
parent
c400cca7
main
master
1.0.1
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
csst_dfs_commons/utils/fits.py
+12
-5
csst_dfs_commons/utils/fits.py
with
12 additions
and
5 deletions
+12
-5
csst_dfs_commons/utils/fits.py
+
12
-
5
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
...
...
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