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.0.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.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (319.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.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.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (315.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (315.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (317.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for ligo_hires_gps_time-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c1b173ad2c48ba30f92be64eae0e4562cde8cc8e4319a88ffd93ed7757ed07bc
MD5 bd6bd97037afb32aa32726ac021db4bd
BLAKE2b-256 5b2f10de7ab71f7d157e7ed2ec4e1ed1d35ddb19d40a240eab4e8c25f75776fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4cc79081f6ae5acd33086e6595a1dfc7168491d55459a34cbf576cc11efc058
MD5 e5c98917c091e0d287c6bd744b2a1449
BLAKE2b-256 8dee0595e01acec37293a7aeb9b045a8d0f305831c7e533d00bf603fd63c03ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 33d125ac3dc18562ab1e3909eaecba9909b2e151e06063cf12959129c33cf0dc
MD5 47e00fd94a7ae37416bfc29f0aacb700
BLAKE2b-256 b92947859c0da6e3678fda22a437ec5a867e17f119b6cf8164b9feea27a1ad05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ca02452c15088a675cb8dc77aeb75c3ec18b4db7c39a5112662b4e5565a4fe9
MD5 753efd283d71d3a4b082cbf85f40eb1f
BLAKE2b-256 d64f7763849a8b606c24586e5d7ec3135cd9029925b71b6a9a6e271f5f8b59c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f8ccddfaedc781992b0e80e16f4482a79b573b5ccbb8fd1d24814021c1cd2da
MD5 66b1593890f38b28c6ad6b0f49213c93
BLAKE2b-256 5acb36dd860afc17055ade7103254e74396134eaf5dd761629f787f022b36ca4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 efd38bcfc4aa4c294401c4e7e1ccf9f1f2c4d4ea88b00f774a5b554ac0775255
MD5 3ebd23869a496f8543b8b8a08f20e4f9
BLAKE2b-256 1793331bd132b2b0fc9b392cf9e1807611fbdc965bb7398612102cb8b3e46286

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