Skip to main content

Astronomical utilities for PANOPTES

Project description

PANOPTES Utilities

PANOPTES Logo


GHA Status codecov Documentation Status PyPI version

Utility functions for use within the Project PANOPTES ecosystem and for general astronomical processing.

This library defines a number of modules that contain useful functions as well as a few services.

Install

To install type:

pip install panoptes-utils

Full options for install:

pip install "panoptes-utils[config,docs,images,telemetry]"

See the full documentation at: https://panoptes-utils.readthedocs.io

Dependencies

There are a few system dependencies depending on what functionality you will be using.

In particular, the plate solving requires astrometry.net and the appropriate index files.

Use the following on a debian-based system (e.g. Ubuntu) to easily install all dependencies:

apt-get update && apt-get install --no-install-recommends --yes \
  libffi-dev libssl-dev \
  astrometry.net astrometry-data-tycho2 \
  dcraw exiftool libcfitsio-dev libcfitsio-bin \
  libfreetype6-dev libpng-dev libjpeg-dev libffi-dev

Command Line

The panoptes-utils command provides subcommands for image processing, configuration management, and telemetry. Use panoptes-utils --help or panoptes-utils <subcommand> --help for full option details.

image — Image processing

Convert and plate-solve astronomical images:

# Watch a directory and auto-process new files
panoptes-utils image watch <path>

# Convert a CR2 to FITS
panoptes-utils image cr2 to-fits <file.cr2>

# Plate-solve a FITS file
panoptes-utils image fits solve <file.fits>

config — Configuration server

Requires the config extra (pip install "panoptes-utils[config]").

Start a local key-value configuration server backed by a YAML file:

# Start the server
panoptes-utils config run --config-file <path-to-file.yaml>

# Read a value (returns entire config if no key given)
panoptes-utils config get location.elevation

# Update a value
panoptes-utils config set name "My Observatory"

# Stop the server
panoptes-utils config stop
Variable Description Default
PANOPTES_CONFIG_HOST Config server host address localhost
PANOPTES_CONFIG_PORT Config server port 6563
PANOPTES_CONFIG_FILE YAML config file to load (CLI only)

telemetry — Telemetry server

Requires the telemetry extra (pip install "panoptes-utils[telemetry]").

Start a telemetry server for recording and querying observatory events:

# Start the server
panoptes-utils telemetry run

# Display current readings (add --follow for live updates)
panoptes-utils telemetry current --follow

# Stop the server
panoptes-utils telemetry stop
Variable Description Default
PANOPTES_TELEMETRY_HOST Telemetry server host address localhost
PANOPTES_TELEMETRY_PORT Telemetry server port 6562
PANOPTES_TELEMETRY_SITE_DIR Directory for rotated NDJSON site logs telemetry

The public telemetry model is intentionally simple: there is one telemetry feed, and start_run() optionally activates a run context. When a run is active, subsequent events are automatically associated with that run and stamped with meta["run_id"].

Example local workflow with Python:

from panoptes.utils.telemetry import TelemetryClient

client = TelemetryClient()

print(client.ready())

# Before start_run(), events are recorded without any active run context.
client.post_event("weather", {"sky": "clear", "wind_mps": 2.1}, meta={"source": "demo"})

# start_run() activates the run context for subsequent events.
client.start_run(run_id="001")
event = client.post_event("status", {"state": "running"})
print(event["meta"]["run_id"])
client.stop_run()

# Or let the server create the next run automatically.
next_run = client.start_run()
print(next_run["run_id"], next_run["run_dir"])

print(client.current()["current"])

client.stop_run()
client.shutdown()

For server internals and HTTP API examples, see the Telemetry Server documentation.

Development with UV

This project uses UV for fast Python package and environment management with modern PEP 735 dependency groups.

Prerequisites:

Basic workflow:

  • Create and sync a dev environment with all dependencies:

    # Install all optional extras and dev dependencies (recommended for development)
    uv sync --all-extras --group dev
    
    # Or install only base dependencies
    uv sync
    
    # Activate the virtual environment
    source .venv/bin/activate
    # or run commands without activating using `uv run ...`
    
  • Install specific dependency groups as needed:

    # Install testing dependencies
    uv sync --group testing
    
    # Install linting tools
    uv sync --group lint
    
    # Install all dev dependencies (includes testing + lint)
    uv sync --group dev
    
  • Install specific optional extras as needed (choose any):

    # Examples: config, images, docs, examples
    uv sync --extra config --extra images --extra docs
    
    # Or install all extras
    uv sync --all-extras
    
  • Run tests:

    # All tests with coverage, using pytest options from pyproject.toml
    uv run pytest
    
    # Single test file
    uv run pytest tests/test_utils.py
    
  • Lint / style checks:

    # Lint with Ruff
    uv run ruff check .
    
    # Auto-fix linting issues
    uv run ruff check --fix .
    
    # Format code with Ruff
    uv run ruff format .
    
    # Check formatting without making changes
    uv run ruff format --check .
    
  • Build the package (wheel and sdist):

    uv build
    
  • Run the CLI locally (Typer app):

    uv run panoptes-utils --help
    
  • Versioning: Version is derived from git tags via setuptools-scm. To produce a new version, create and push a tag (e.g., v0.1.0).

[Testing]

To test the software, prefer running via UV so the right environment and options are used:

uv run pytest

By default all tests will be run. If you want to run one specific test, give the specific filename as an argument to pytest:

uv run pytest tests/test_mount.py

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

panoptes_utils-0.3.2.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

panoptes_utils-0.3.2-py3-none-any.whl (87.0 kB view details)

Uploaded Python 3

File details

Details for the file panoptes_utils-0.3.2.tar.gz.

File metadata

  • Download URL: panoptes_utils-0.3.2.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for panoptes_utils-0.3.2.tar.gz
Algorithm Hash digest
SHA256 e5ef89f9a96c09c6b39e0d61c917fd971270b532d2ea9f8c22bdb638f9fad513
MD5 7bc6b174813e4b40cdfc7fab059f3ff0
BLAKE2b-256 cb48315414011f848601f255a9dee65af959b16467983dacc72ec96f4e71e2c7

See more details on using hashes here.

File details

Details for the file panoptes_utils-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: panoptes_utils-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 87.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for panoptes_utils-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ced4bed55c7a31ae3faf3c5e9bd9fb357baabfd719a19a21e6f37a6a20594ba7
MD5 5d75e65d572c13581503795a8c589e5a
BLAKE2b-256 80934d83c9635ca502b95186f5a3f75b54ee09d7835399596182e9c38070157f

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