gwexpy.time.to_gps

gwexpy.time.to_gps(t, *args, dtype=None, **kwargs)[source]

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 the default 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, this preserves the existing GWpy-compatible return types. With dtype=float or dtype="float", returns numeric seconds. With dtype="quantity", returns seconds as an astropy.units.Quantity.

Return type:

object