opticam_new.utils.time_helpers

Functions

apply_barycentric_correction(original_times, coords)

Apply barycentric corrections to a time array.

get_time(header, file)

Parse the time from the header of a FITS file.

infer_gtis(time[, threshold])

Infer GTIs from a light curve.

Module Contents

opticam_new.utils.time_helpers.apply_barycentric_correction(original_times, coords)

Apply barycentric corrections to a time array.

Parameters

timesfloat | NDArray

The time(s) to correct.

coordsSkyCoord

The coordinates of the source.

Returns

float | NDArray

The corrected time(s).

Parameters:
  • original_times (float | numpy.typing.NDArray)

  • coords (astropy.coordinates.SkyCoord)

Return type:

float | numpy.typing.NDArray

opticam_new.utils.time_helpers.get_time(header, file)

Parse the time from the header of a FITS file.

Parameters

header

The FITS file header.

filestr

The path to the file.

Returns

float

The time of the observation in MJD.

Raises

ValueError

If the time cannot be parsed from the header.

KeyError

If neither ‘GPSTIME’ nor ‘UT’ keys are found in the header.

Parameters:
  • header (Dict)

  • file (str)

Return type:

float

opticam_new.utils.time_helpers.infer_gtis(time, threshold=1.5)

Infer GTIs from a light curve.

Parameters

timeArrayLike

The time array.

thresholdfloat, optional

The threshold for detecting gaps in units of the median time resolution, by default 1.5.

Returns

List[Tuple[float, float]]

The inferred GTIs.

Parameters:
  • time (numpy.typing.NDArray)

  • threshold (float)

Return type:

numpy.typing.NDArray