Skip to content

Commit

Permalink
adding more typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
dlakaplan committed Aug 1, 2024
1 parent 974ba0a commit 3bf0584
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/pint/fits_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,30 @@

from erfa import DAYSEC as SECS_PER_DAY

from astropy.io import fits

from pint.pulsar_mjd import fortran_float


__all__ = ["read_fits_event_mjds", "read_fits_event_mjds_tuples"]


def read_fits_event_mjds_tuples(event_hdu, timecolumn="TIME"):
def read_fits_event_mjds_tuples(
event_hdu: fits.hdu.BinTableHDU, timecolumn: str = "TIME"
) -> np.ndarray:
"""Read a set of MJDs from a FITS HDU, with proper conversion of times to MJD
The FITS time format is defined here:
https://heasarc.gsfc.nasa.gov/docs/journal/timing3.html
Parameters
----------
event_hdu : fits.hdu.BinTableHDU
timecolumn : str, optional
Returns
-------
mjds: MJDs returned are tuples of two doubles (jd1, jd2), as use by
mjds: MJDs returned are tuples of two doubles (jd1, jd2), as used by
astropy Time() objects.
"""
Expand Down Expand Up @@ -63,13 +72,24 @@ def read_fits_event_mjds_tuples(event_hdu, timecolumn="TIME"):
)


def read_fits_event_mjds(event_hdu, timecolumn="TIME"):
def read_fits_event_mjds(
event_hdu: fits.hdu.BinTableHDU, timecolumn: str = "TIME"
) -> np.ndarray:
"""Read a set of MJDs from a FITS HDU, with proper conversion of times to MJD
The FITS time format is defined here:
https://heasarc.gsfc.nasa.gov/docs/journal/timing3.html
MJDs returned are double precision floats
Parameters
----------
event_hdu : fits.hdu.BinTableHDU
timecolumn : str, optional
Returns
-------
mjds: np.ndarray
"""

event_hdr = event_hdu.header
Expand Down

0 comments on commit 3bf0584

Please sign in to comment.