Skip to content

Commit

Permalink
remove fits_hdu_name
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Feb 24, 2025
1 parent e076db5 commit f021544
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/stdatamodels/fits_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
log.addHandler(logging.NullHandler())


__all__ = ["to_fits", "from_fits", "fits_hdu_name", "get_hdu", "is_builtin_fits_keyword"]
__all__ = ["to_fits", "from_fits", "get_hdu", "is_builtin_fits_keyword"]


_ASDF_EXTENSION_NAME = "ASDF"
Expand Down Expand Up @@ -112,22 +112,10 @@ def _get_indexed_keyword(keyword, i):
return keyword


def fits_hdu_name(name):
"""
Returns a FITS hdu name in the correct form for the current
version of Python.
"""
if isinstance(name, bytes):
return name.decode("ascii")
return name


def _get_hdu_name(schema):
hdu_name = schema.get("fits_hdu")
if hdu_name in (None, "PRIMARY"):
hdu_name = 0
else:
hdu_name = fits_hdu_name(hdu_name)
return hdu_name


Expand Down Expand Up @@ -470,7 +458,6 @@ def normalize_array(node):
def _save_extra_fits(hdulist, tree):
# Handle _extra_fits
for hdu_name, parts in tree.get("extra_fits", {}).items():
hdu_name = fits_hdu_name(hdu_name)
if "data" in parts:
hdu_type = _get_hdu_type(hdu_name, value=parts["data"])
hdu = _get_or_make_hdu(hdulist, hdu_name, hdu_type=hdu_type, value=parts["data"])
Expand Down

0 comments on commit f021544

Please sign in to comment.