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.6.0.tar.gz (21.2 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.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (319.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (319.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (316.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (316.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (317.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: ligo_hires_gps_time-0.6.0.tar.gz
  • Upload date:
  • Size: 21.2 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.6.0.tar.gz
Algorithm Hash digest
SHA256 ca9e3fd7a09f7183a1413a2b25f206337a79d93334fd1159c5271e0f08c52322
MD5 9cc9dc856ffaccd151b5b7edeab6f586
BLAKE2b-256 f04c9dc578de7e903c47bafbb1e55c13bfecdb76b0c883762c87431a410f2d86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 93e447950caa39efd6c8eccedf8b449c7f57cb8d7af44585c484678c095eaeac
MD5 96b5fdc4584dbe2ea3d0bc478cdae3b9
BLAKE2b-256 bf27eaac8af915c9ae83a8a5219087ed17669dc5c8b59a4ff01d2fe58b74c7cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e57f01136cf9c678127fc04660a69344f76caf8a2bea6f3315f07591065ae071
MD5 b9ea95b00b4cda02e7c62d0d294a8ef8
BLAKE2b-256 dfa2a2e455d999268f40cbf9d26b0056728a367b511839b7512b645d0e128fb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47e6e4b1a0e23bc3c2c2c6cdb87290c8b60f3b462ec9cfb6cee12875a34f8561
MD5 ad6e635217fc6be763b76be08e3a8154
BLAKE2b-256 4802a470bc304ce352a25d9632adb12b4ca5acefd8211900c7a1de0103012833

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00fc3696aca46e4b30f1dd1949465d34b93fe6b7ecaec5b0132fa82cb7e98ee4
MD5 4350f6aea25c4b37d4a7c65e3b5cbc85
BLAKE2b-256 027f379a0f445c4c289cf5a1eb8b561e80335722ab4afd594142d00f0b6e254a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31dab8f7f88a0af99909cb8ff17d880b649e9a6b50f5441b9df5a9dd5cec86ef
MD5 fdcc8dd30575c2b80acd5ae06edc8884
BLAKE2b-256 d9ef6f9a7ff5ba92cd2d4c818051724f4b395c848c7ca23b77327db5174de977

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