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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ligo_hires_gps_time-0.6.3.tar.gz.
File metadata
- Download URL: ligo_hires_gps_time-0.6.3.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49d94ee84e820baa62f105cb7ceb94bbcf30f939dcbae97ad388c42ab9a14307
|
|
| MD5 |
d7cbfc5ec9f4237127a18bd4a52acda7
|
|
| BLAKE2b-256 |
cb45e475f2f5dbe7588db813c37235fbc330edcb7d90dac706271dbc8d9d88bd
|
File details
Details for the file ligo_hires_gps_time-0.6.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ligo_hires_gps_time-0.6.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 315.6 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46c9d27c39b52935dc8e6ae2c40406127d7efcaac4307127ee7f188d77db6c33
|
|
| MD5 |
7432d5cdebc85f278b2321ccb411d2da
|
|
| BLAKE2b-256 |
45625096adb43e8c0827ad84b649c03056c9abf5468baff7d37256662290d9b2
|
File details
Details for the file ligo_hires_gps_time-0.6.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ligo_hires_gps_time-0.6.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 315.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c93883d7f1008a657e3b17bbb6879fe75c8439859087b08a5b2d190a1bfda03
|
|
| MD5 |
a52584768e3bee1fca57a89e2195cf58
|
|
| BLAKE2b-256 |
e596de88376b9e05b540445011d1f938ab1715e99226b597f0a47a03e961e0e6
|
File details
Details for the file ligo_hires_gps_time-0.6.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ligo_hires_gps_time-0.6.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 312.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
820e5b8c838b0bbadc81d507c4630c43077c97cc15787c95d36bed3df604399b
|
|
| MD5 |
8dd004df5785e2caa9962541136b34a8
|
|
| BLAKE2b-256 |
6be3e7b79a77b3a0d4b6ddf754291676cdd4749bb19e39a8ef13dfd9e8583e73
|
File details
Details for the file ligo_hires_gps_time-0.6.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ligo_hires_gps_time-0.6.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 312.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e63cdfded995edd211526e7f22a41c2d338f61d93f0e908e7ac768f8cf1b0dcb
|
|
| MD5 |
9b258fde10133a3a40387705aaef5737
|
|
| BLAKE2b-256 |
03a9cb9fb21a1aa61aac193ebcf23d0458173a63955f75dacd51c2d926774a8a
|
File details
Details for the file ligo_hires_gps_time-0.6.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ligo_hires_gps_time-0.6.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 313.6 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be7c2e78b635c680a26210ed5324e63ee86e66ffca1bb95bc29adf950ba34216
|
|
| MD5 |
a0626a88ca62d178463cc8f8838bbf87
|
|
| BLAKE2b-256 |
aed181d0ca84350fdcde1f8faf697b957487ac30767484e2c5a652a2553e8304
|