Commit 920d289c authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add type annotation

parent aa18ce37
Pipeline #2437 failed with stage
......@@ -6,10 +6,12 @@ Author: Bo Zhang
Created: 2023-12-13
Modified-History:
2023-12-10, Bo Zhang, created
2023-12-15, Bo Zhang, add 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
"""
import warnings
from copy import deepcopy
from typing import Optional
from astropy.io import fits
......@@ -86,7 +88,34 @@ def append_header(
return original_h
def reformat_header(h: fits.Header, strip=True, comment=None):
def reformat_header(
h: fits.Header,
strip: bool = True,
comment: Optional[str] = None,
):
"""
Reformat fits Header.
Remove blanks, comments, and history, and add a new comment at the beginning.
Parameters
----------
h : fits.Header
The original header.
strip: bool = True
If `True`, strip cards like SIMPLE, BITPIX, etc.
so the rest of the header can be used to reconstruct another kind of header.
comment: Optional[str] = None
The new comment at the beginning.
See Also
--------
astropy.io.fits.Header.strip()
References
----------
https://docs.astropy.org/en/stable/io/fits/api/headers.html#astropy.io.fits.Header.strip
"""
h_copy = deepcopy(h)
# strip
if strip:
......
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