Commit 7c3a3f05 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

get fits header

parent c400cca7
...@@ -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, headers, 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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment