LAL  7.4.1.1-f1ed79c

Detailed Description

Utilties for calculating and modifying GPS times using the LAL date package.

Synopsis

from lal import gpstime

This module wraps the LAL Header Date.h module into Python providing functions to convert from the datetime.datetime objects from the Python standard library into LIGOTimeGPS numbers, and vice-versa. See in particular gps_to_utc and utc_to_gps.

This module also provides a Python implementation of the ‘tconvert’ module, allowing conversion from strings of dates and times into LIGOTimeGPS, and vice-versa. See in particular gps_to_str and str_to_gps.

Author
Duncan Macleod dunca.nosp@m.n.ma.nosp@m.cleod.nosp@m.@lig.nosp@m.o.org

Prototypes

def lal.gpstime.gps_time_now ()
 Get the current time in GPS seconds. More...
 
def lal.gpstime.utc_to_gps (utc_time)
 Convert the given datetime.datetime into a GPS time. More...
 
def lal.gpstime.gps_to_utc (gps)
 Convert a GPS time into a datetime.datetime More...
 
def lal.gpstime.utc_time_now ()
 Get the current date and time in UTC. More...
 
def lal.gpstime.str_to_gps (time_string=None)
 Converts a date/time string into a GPS time. More...
 
def lal.gpstime.gps_to_str (gps, form=None)
 onvert a LIGOTimeGPS time object into a string. More...
 
def lal.gpstime.tconvert (arg=None, form=None)
 Convert date/time strings to and from GPS times. More...
 

Variables

dictionary lal.gpstime.TIME_ZONES
 
 lal.gpstime.GPS_EPOCH = _datetime.datetime(1980, 1, 6, 0, 0, 0)
 
 lal.gpstime.LAL_GPS_MAX = _datetime.datetime(2048, 1, 24, 3, 13, 55)
 

Function Documentation

◆ gps_time_now()

def lal.gpstime.gps_time_now ( )

Get the current time in GPS seconds.

Returns
a LIGOTimeGPS

Definition at line 91 of file gpstime.py.

◆ utc_to_gps()

def lal.gpstime.utc_to_gps (   utc_time)

Convert the given datetime.datetime into a GPS time.

Returns
a LIGOTimeGPS

Definition at line 99 of file gpstime.py.

◆ gps_to_utc()

def lal.gpstime.gps_to_utc (   gps)

Convert a GPS time into a datetime.datetime

Returns
a Python datetime.datetime object in UTC

Definition at line 110 of file gpstime.py.

◆ utc_time_now()

def lal.gpstime.utc_time_now ( )

Get the current date and time in UTC.

Returns
a Python datetime.datetime object in UTC

Definition at line 128 of file gpstime.py.

◆ str_to_gps()

def lal.gpstime.str_to_gps (   time_string = None)

Converts a date/time string into a GPS time.

he following special words are permitted:

  • "now"
  • "today"
  • "yesterday"
  • "tomorrow"

xample: code

gpstime.str_to_gps("September 14 2011, 01:46:25")

000000000.000000000 endcode

returns a LIGOTimeGPS

Definition at line 148 of file gpstime.py.

◆ gps_to_str()

def lal.gpstime.gps_to_str (   gps,
  form = None 
)

onvert a LIGOTimeGPS time object into a string.

he output format can be given explicitly, but will default s shown in the example.

xample:

code

gps_to_str(1000000000)

September 14 2011, 01:46:25 UTC' endcode

returns a string with the given format.

Definition at line 185 of file gpstime.py.

◆ tconvert()

def lal.gpstime.tconvert (   arg = None,
  form = None 
)

Convert date/time strings to and from GPS times.

f no argument is given, the current GPS time is returned.

he following special words are permitted:

  • "now"
  • "today"
  • "yesterday"
  • "tomorrow"

xample:

code

tconvert()

048275013.000000000

tconvert("January 6 1980 00:00:00")

.000000000

tconvert(1000000000)

September 14 2011, 01:46:25 UTC' endcode

returns the LIGOTimeGPS of the given time string, OR, string epresenting the given GPS time

Definition at line 218 of file gpstime.py.

Variable Documentation

◆ TIME_ZONES

dictionary lal.gpstime.TIME_ZONES
Initial value:
1 = {
2  "PST": -8*3600,
3  "PDT": -7*3600,
4  "CST": -6*3600,
5  "CDT": -5*3600,
6  "EST": -5*3600,
7  "EDT": -4*3600,
8  "GMT": 0,
9  "UTC": 0,
10  "BST": 1*3600,
11  "CET": 1*3600,
12  "CEST": 2*3600,
13 }

Definition at line 59 of file gpstime.py.

◆ GPS_EPOCH

lal.gpstime.GPS_EPOCH = _datetime.datetime(1980, 1, 6, 0, 0, 0)

Definition at line 72 of file gpstime.py.

◆ LAL_GPS_MAX

lal.gpstime.LAL_GPS_MAX = _datetime.datetime(2048, 1, 24, 3, 13, 55)

Definition at line 73 of file gpstime.py.