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.4.tar.gz (21.9 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.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (325.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (325.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (321.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (322.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ligo_hires_gps_time-0.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (322.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: ligo_hires_gps_time-0.6.4.tar.gz
  • Upload date:
  • Size: 21.9 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.4.tar.gz
Algorithm Hash digest
SHA256 64d44943a412450eebd5465772cc61bdae2cdcda79dd28806b08190dee825592
MD5 b15c75d8549e2032331247736388b8b1
BLAKE2b-256 529b876772ace0e3363baffed688b7038fd35a83e0a06be7fb6fcccd8b9af7e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2169be8838cc9d027d2d09b8438b23f0820628ef42c52bd24ff1bebc6f5d6860
MD5 61552d77f37385c93f94f8c9849cd987
BLAKE2b-256 33705527a08779c1c314ed2dd9a7ec22e76bf4c18f4d164ed52e13dc264c49e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bbe832ed638a4e29e5c0745fa13a350c5e4ba00bebb999f8038b2215aea5ed9
MD5 ab1f2870d47be96edee6f13a644d338a
BLAKE2b-256 9237a174ee482bfb48e3ea9ec343d9548a4f40be0f67c7795c06b84a0352dbbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcda782f278491085aff79772cf3c2390893953a2bddfac9e708ab868250f398
MD5 9c5d65d350d8ec153db750daf300406a
BLAKE2b-256 7456b2ae3b2b2e234649dc042743a1653fdb9636b7ef57655d1fcedb625a705e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76ab723a363e2d01e37beb89f26dd34c56a8e7d78132a0ddbfa7e964a9e038e7
MD5 1ab8be976a96f5d9cc597d7f3d391d93
BLAKE2b-256 e208ed25551a27244d4ebf4a0e00ec847ecb971a02a9f0ce6c95c3d9aa6f5786

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ligo_hires_gps_time-0.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 843869f4ab5870d9d85d509e6b78f4ffcd18411494c33533dc147f6aa626165a
MD5 ca1468b19c9d9572a1129580cfd92d1a
BLAKE2b-256 173ee63012aad0be8d7d2ef742ad6edb371da054ce700ffe812d13581003283c

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