Skip to main content

Command line tool for Rubin Observatory CBP calibration system logic timers

Project description

cbptimer

This is a command line utility for use with logic timer units used in the calibration system for the colimated beam projector (CBP) at the Rubin Observatory. The utility leverages pigpio to generate CSV logs of μ-second ticks corresponding to edge events on the timer unit TTL trigger inputs.

Logic Timer Design

The logic timer modules are built on the Raspberry Pi 4b platform, running AlmaLinux 9. An Adafruit Ultimate GPS Hat module is included to provide GPS-assisted stabilization of the Raspberry Pi clock when GPS reception is available.

A 5V TTL trigger interface is also built out in the prototyping area of the GPS hat. This utilizes a 74LVC245 for 5V to 3.3V level conversion, and provides jumperable 10K pull up/down and jumperable ground lift on the TTL side. The level-converted trigger input is wired through to Pi GPIO 16 via the hat.

Principle of Operation

The pigpio daemon uses the Raspberry Pi hardware DMA engine to sample GPIOs every 5μs (by default). It queues events recording observed edges, attaching timestamps from the system μ-second clock. The Python side of pigpio then reads this queue at its leisure and generates Python callbacks which are used to write out CSV records. The logged timestamps which are passed to the callbacks are the ones recorded by the daemon, and are not derived from the Python callback time.

This arrangement should be sufficient for millisecond-accurate timing. If it is necessary to tighten this further, we could consider configuring pigpio for a higher sample frequency (it can get down to a 1μs sample period) and/or cutting over to a real-time Linux kernel.

Usage

This package is published on PyPI, so should be installable via:

pip install lsst-cbptimer

It is assumed that you will have previously installed pigpio (libraries and daemon) as a system-level dependency. Once installed:

usage: cbptimer [-h] [--edge {rising,falling,either}] [--duration DURATION] [--outfile OUTFILE] [--version]

Log trigger events from CBP calibration logic timer

optional arguments:
  -h, --help            show this help message and exit
  --edge {rising,falling,either}
                        which types of triggers to log (default: rising)
  --duration DURATION   duration to monitor/log, in seconds (default: infinite; ^C or SIGINT to exit)
  --outfile OUTFILE     where to log (default: stdout)
  --version             show program's version number and exit

Developer Quickstart

It is recommended to develop within a virtual environment. The package can be installed in pip "editable" mode via:

pip install -e .[dev]

The [dev] option here will ensure automatic installation of additional Python development support packages (mypy, ruff, build). Linting and autoformatting can be accomplished via:

ruff check .
ruff format .

Type hinting may be checked via:

mypy src

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

lsst-cbptimer-0.0.1.tar.gz (431.5 kB view details)

Uploaded Source

Built Distribution

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

lsst_cbptimer-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file lsst-cbptimer-0.0.1.tar.gz.

File metadata

  • Download URL: lsst-cbptimer-0.0.1.tar.gz
  • Upload date:
  • Size: 431.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for lsst-cbptimer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 40ce384eadde6141954428b53f4f21c441f39aa9c417e3f6422e3cdbb88a3d64
MD5 93deb1ac038a755b96d1bb5ec6dc6f59
BLAKE2b-256 ab40a8be6c286a04c09823690341e3eecdfe54a32993c5f6f0d05750abbf26ca

See more details on using hashes here.

File details

Details for the file lsst_cbptimer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lsst_cbptimer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for lsst_cbptimer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3897d44b4c874e78797994697f6c600e010228c5631c6b6b71600c35efdf092e
MD5 731d722659d56792b8ee14b9b2934592
BLAKE2b-256 0f0692f74afac78b522a632628d3dc8c3c3eee54d27ef41bca97e925ab468d53

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