Skip to main content

A high-resolution time library with instants taken from the GPS epoch.

Project description

ligo_hires_gps_time is a Rust crate that provides high-resolution time types that coincide with GPS time, which is seconds since Januray 6, 1980, and disregards leap seconds.

The module provides two units of time of different duration.

The structs PipInstant, and PipDuration use the "pip" unit. There are $2^{30} \cdot 5^{9} = 2,097,152,000,000,000$ pips per second.

The structs ThumpInstant and ThumpDuration use the "thump". There are $2^{19} \cdot 5^{5} = 1,638,400,000$ pips per second.

History and Motivation

Almost all LIGO channels have a data rate that is a power of two. This choice has some benefits. The data rates are exactly representable as floating point numbers. FFTs, which are more efficient with inputs with sizes that are powers of two, produce bucket-widths that are either simple fractions of 1 Hz, or multiples of 1 Hz.

At the same time, LIGO software has historically used nanosecond resolution value to represent times and durations. Since there are 1 billion nanoseconds in a second, and 1 billion is factored into $2^9 \cdot 5^9$, nanoseconds can exactly represent any rate that's a power of two, as long as it's no greater than $2^9$, or 512 Hz.

The typical LIGO fast channel is $2^{14}$ or 16384 Hz, which is too great to be represented by nanoseconds exactly.
The period of such a channel is $P = 61035.15625$ ns .

For nanosecond resolution values, the error in units of samples is $E = 1 - \lfloor{P}\rfloor/{P} = 2.56\cdot10^{-6}$ samples-per-sample.

We get into trouble when $E \cdot n \ge 0.5$, where $n$ is the number of samples. For a 16384 Hz channel, that's less than 12 seconds worth of samples.

Double-precision floating point values can help, but they will become worse than nanosecond resolution for any span greater than 52 days, and won't do much better for most of the days prior.

With care, this error can be corrected, but if the right time resolution is used, the error is zero.

Operators

Useful math operators between durations and instants are provided, as well as operators for scaling duration.

Features

nds

Include functions to convert to and from NDS time types.

hifitime

Include functions to convert to and from hifitime types.

python

Include pyo3 and use it to create a python interface

all

Include all other features

Python

We use pyO3 to create a python interface, providing these same types and operators in python.

Build and package the python using "maturin", but make sure to specify at least the 'python' feature.

maturin develop --features python
python
import gps_pip

Testing python

With python in development using maturin, run

python -m pytest

Testing

bacon can be used to speed up testing.

The repo includes a bacon.toml file with some custom jobs.

Run bacon in the project directory. Use the hotkeys 1 through 0 in order to complete a full test, including of python interface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ligo_hires_gps_time-0.5.3.tar.gz (21.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ligo_hires_gps_time-0.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (317.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (317.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (314.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (314.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (315.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file ligo_hires_gps_time-0.5.3.tar.gz.

File metadata

  • Download URL: ligo_hires_gps_time-0.5.3.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for ligo_hires_gps_time-0.5.3.tar.gz
Algorithm Hash digest
SHA256 003e7fc43698917c16d025d8d03e81686a84f8370b5720fe6329aa80817ba842
MD5 b9978e585af5ce22e5497378a8b34314
BLAKE2b-256 4644fd8a9fa296d9ea518268359a3372f599a66c56a547594a28c8ebc9487114

See more details on using hashes here.

File details

Details for the file ligo_hires_gps_time-0.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f09fcf87f27418e780b4254401a524844c9b75368e73f1484331c59554224ad8
MD5 fb2d0e1c64ac427d3680f459dfbec401
BLAKE2b-256 461135085b7b668035776f98197f618b39a571ed68e8b1d203ad7e9a3a3cee35

See more details on using hashes here.

File details

Details for the file ligo_hires_gps_time-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 138266ce382347f50a2a1b95f4260f957647140c59d809e8eab5b4a73f65abb8
MD5 b19c7daeede735dfee3af982689a0863
BLAKE2b-256 e19a34189b28302a94f930ea76b1e53a26c5aadbefec84ba573ec0fa85e99156

See more details on using hashes here.

File details

Details for the file ligo_hires_gps_time-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f0d66a8fee1c8cf1a37d1c3cdc243fe860f17257a30e63a072ca6f62f3085c0
MD5 70c483977f326be36f2d10975a880c14
BLAKE2b-256 d2b664b6a1b61df0948230cb411a23e31c2178c02ad3d45b64ed61b83f1878a6

See more details on using hashes here.

File details

Details for the file ligo_hires_gps_time-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d914427646b8e12a7d39261da7bd0d372d2c5a8a1a0face12fd7d2ea00f8a34
MD5 77a0d6df5395250901c2c38d35e464ad
BLAKE2b-256 e3ed7306eb45c7e0aa0c47d1d8172231b958908504f0a7ca3732e859ae917ff5

See more details on using hashes here.

File details

Details for the file ligo_hires_gps_time-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d3a3583d3dc68bfc9a00bf62da5bc0e0438efacdefd012c213e6e95cf8beb5d
MD5 5af828722d9552612c173691b9e36ff8
BLAKE2b-256 3b2c86b7a642cdea9bcbad778ba60a03fb3cf550839fa0e9767507b5c204f65a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page