Development documentation · 0.2.3 30c2f8ba · Intro examples tested with 0.2.3 · Version details · Known limitations

gwexpy.time.to_gps#

gwexpy.time.to_gps(t, *args, dtype=None, **kwargs)#

Convert a given time or array of times to GPS seconds.

This is a vectorized extension of gwpy.time.to_gps. It supports single values (strings, datetime, etc.) as well as arrays, pandas Series, and lists.

Parameters:
  • t (str, datetime.datetime, astropy.time.Time, or array-like) – The input time(s) to convert. Supported formats include UTC strings, datetime objects, pandas Timestamps, or arrays of these types.

  • *args – Additional positional arguments passed to gwpy.time.to_gps.

  • dtype ({None, float, "float", "quantity"}, optional) – Output mode for the converted GPS seconds. None preserves exact LIGOTimeGPS elements for NumPy datetime64 inputs; other inputs preserve the existing GWpy-compatible behavior. float or "float" returns Python float for scalar inputs and numpy.ndarray for array-like inputs. "quantity" returns an astropy.units.Quantity in seconds, which can be compared with GWpy/GWExpy time axes.

  • **kwargs – Additional keyword arguments passed to gwpy.time.to_gps.

Returns:

The equivalent time in GPS seconds. With dtype=None, NumPy datetime64 scalars return LIGOTimeGPS and arrays return object arrays of exact LIGOTimeGPS elements. With dtype=float or dtype="float", returns numeric seconds. With dtype="quantity", returns seconds as an astropy.units.Quantity.

Return type:

object