Package glue :: Module lal :: Class LIGOTimeGPS
[hide private]
[frames] | no frames]

Class LIGOTimeGPS

source code

object --+
         |
        LIGOTimeGPS

An object for storing times with nanosecond resolution. LAL defines an equivalent object which is used through-out the search algorithms to represent times. Many LALApps routines input and output times in a manner that meshes well with this object.

Internally the time is represented as a signed integer "seconds" part and an unsigned integer "nanoseconds" part. The actual time is always constructed by adding the nanoseconds to the seconds. So -0.5 s is represented by setting seconds = -1, and nanoseconds to 500000000. That's the way LAL does it.

Instance Methods [hide private]
 
__abs__(self) source code
 
__add__(self, other)
Add a value to a LIGOTimeGPS.
source code
 
__cmp__(self, other)
Compare a value to a LIGOTimeGPS.
source code
 
__div__(self, other)
Divide a LIGOTimeGPS by a number.
source code
 
__float__(self)
Convert a LIGOTimeGPS to seconds as a float.
source code
 
__hash__(self)
hash(x)
source code
 
__init__(self, seconds, nanoseconds=0)
Create a LIGOTimeGPS instance.
source code
 
__int__(self)
Return the integer part (seconds) of a LIGOTimeGPS as an int.
source code
 
__long__(self)
Return the integer part (seconds) of a LIGOTimeGPS as a long.
source code
 
__mod__(self, other)
Compute the remainder when a LIGOTimeGPS is divided by a number.
source code
 
__mul__(self, other)
Multiply a LIGOTimeGPS by a number.
source code
 
__neg__(self) source code
 
__nonzero__(self)
Return True if the LIGOTimeGPS is nonzero.
source code
 
__pos__(self) source code
 
__radd__(self, other)
Add a value to a LIGOTimeGPS.
source code
 
__repr__(self)
repr(x)
source code
 
__rmul__(self, other)
Multiply a LIGOTimeGPS by a number.
source code
 
__rsub__(self, other)
Subtract a LIGOTimeGPS from a value.
source code
 
__str__(self)
Return an ASCII string representation of a LIGOTimeGPS.
source code
 
__sub__(self, other)
Subtract a value from a LIGOTimeGPS.
source code
 
ns(self)
Convert a LIGOTimeGPS to a count of nanoseconds as a long.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  gpsNanoSeconds
  gpsSeconds
  nanoseconds
  seconds

Inherited from object: __class__

Method Details [hide private]

__add__(self, other)
(Addition operator)

source code 

Add a value to a LIGOTimeGPS. If the value being added to the LIGOTimeGPS is not also a LIGOTimeGPS, then an attempt is made to convert it to a LIGOTimeGPS.

Example:

>>> LIGOTimeGPS(100.5) + LIGOTimeGPS(3)
LIGOTimeGPS(103, 500000000)
>>> LIGOTimeGPS(100.5) + 3
LIGOTimeGPS(103, 500000000)
>>> LIGOTimeGPS(100.5) + "3"
LIGOTimeGPS(103, 500000000)

__cmp__(self, other)
(Comparison operator)

source code 

Compare a value to a LIGOTimeGPS. If the value being compared to the LIGOTimeGPS is not also a LIGOTimeGPS, then an attempt is made to convert it to a LIGOTimeGPS.

Example:

>>> LIGOTimeGPS(100.5) < LIGOTimeGPS(200)
True
>>> LIGOTimeGPS(100.5) < 200
True
>>> LIGOTimeGPS(100.5) < "200"
True

__div__(self, other)

source code 

Divide a LIGOTimeGPS by a number.

Example:

>>> LIGOTimeGPS(100.5) / 2
LIGOTimeGPS(50, 250000000)

__float__(self)

source code 

Convert a LIGOTimeGPS to seconds as a float.

Example:

>>> float(LIGOTimeGPS(100.5))
100.5

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

__init__(self, seconds, nanoseconds=0)
(Constructor)

source code 

Create a LIGOTimeGPS instance. The first parameter is the count of seconds, and the second (optional) parameter is the count of nanoseconds. If the nanoseconds parameter is not supplied, it is assumed to be 0. Either parameter can be a numeric type or an ASCII string.

Example:

>>> LIGOTimeGPS(100.5)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS("100.5")
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS(100, 500000000)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS(0, 100500000000)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS(100.2, 300000000)
LIGOTimeGPS(100, 500000000)
>>> LIGOTimeGPS("0.000000001")
LIGOTimeGPS(0, 1)
>>> LIGOTimeGPS("0.0000000012")
LIGOTimeGPS(0, 1)
>>> LIGOTimeGPS("0.0000000018")
LIGOTimeGPS(0, 2)
>>> LIGOTimeGPS("-0.8")
LIGOTimeGPS(-1, 200000000)
>>> LIGOTimeGPS("-1.2")
LIGOTimeGPS(-2, 800000000)
Overrides: object.__init__

__int__(self)

source code 

Return the integer part (seconds) of a LIGOTimeGPS as an int.

Example:

>>> int(LIGOTimeGPS(100.5))
100

__long__(self)

source code 

Return the integer part (seconds) of a LIGOTimeGPS as a long.

Example:

>>> long(LIGOTimeGPS(100.5))
100L

__mod__(self, other)

source code 

Compute the remainder when a LIGOTimeGPS is divided by a number.

Example:

>>> LIGOTimeGPS(100.5) % 3
LIGOTimeGPS(1, 500000000)

__mul__(self, other)

source code 

Multiply a LIGOTimeGPS by a number.

Example:

>>> LIGOTimeGPS(100.5) * 2
LIGOTimeGPS(201, 0)

__nonzero__(self)
(Boolean test operator)

source code 

Return True if the LIGOTimeGPS is nonzero.

Example:

>>> bool(LIGOTimeGPS(100.5))
True

__radd__(self, other)
(Right-side addition operator)

source code 

Add a value to a LIGOTimeGPS. If the value being added to the LIGOTimeGPS is not also a LIGOTimeGPS, then an attempt is made to convert it to a LIGOTimeGPS.

Example:

>>> LIGOTimeGPS(100.5) + LIGOTimeGPS(3)
LIGOTimeGPS(103, 500000000)
>>> LIGOTimeGPS(100.5) + 3
LIGOTimeGPS(103, 500000000)
>>> LIGOTimeGPS(100.5) + "3"
LIGOTimeGPS(103, 500000000)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__rmul__(self, other)

source code 

Multiply a LIGOTimeGPS by a number.

Example:

>>> LIGOTimeGPS(100.5) * 2
LIGOTimeGPS(201, 0)

__str__(self)
(Informal representation operator)

source code 

Return an ASCII string representation of a LIGOTimeGPS.

Overrides: object.__str__

__sub__(self, other)
(Subtraction operator)

source code 

Subtract a value from a LIGOTimeGPS. If the value being subtracted from the LIGOTimeGPS is not also a LIGOTimeGPS, then an attempt is made to convert it to a LIGOTimeGPS.

Example:

>>> LIGOTimeGPS(100.5) - LIGOTimeGPS(3)
LIGOTimeGPS(97, 500000000)
>>> LIGOTimeGPS(100.5) - 3
LIGOTimeGPS(97, 500000000)
>>> LIGOTimeGPS(100.5) - "3"
LIGOTimeGPS(97, 500000000)

ns(self)

source code 

Convert a LIGOTimeGPS to a count of nanoseconds as a long.

Example:

>>> LIGOTimeGPS(100.5).ns()
100500000000

Property Details [hide private]

gpsNanoSeconds

Get Method:
unreachable(self)

gpsSeconds

Get Method:
unreachable(self)

nanoseconds

Get Method:
unreachable(self)

seconds

Get Method:
unreachable(self)