Skip to main content

Tool-native spectral pipeline runtime with stage-aware profiles and artifact tracing.

Project description

AstroSpecFlow

AstroSpecFlow is a Python package for running a LAMOST-style one-dimensional spectral redshift reduction workflow. It provides a command-line interface, Python APIs, optional CUDA acceleration hooks, and an optional MySQL publication sink for deployment environments that store reduced spectra in a database.

The package is designed for site deployment. It does not ship private FITS files, template libraries, database credentials, output artifacts, or deployment-specific paths. Operators provide those resources through command line flags, environment variables, or a local config file that is not committed to git.

Install

From a source checkout:

python3 -m pip install -e '.[dev]'

After installation:

python3 -c "import astrospecflow; print(astrospecflow.__version__)"
astrospecflow-reduce1d --help

Importing astrospecflow is intentionally lightweight. It must not compile or load CUDA extensions, read FITS files, search template directories, or connect to MySQL. Those resources are checked only when a user explicitly runs the pipeline.

Configuration

Copy the example config and edit it for the local deployment:

cp configs/astrospecflow.example.toml astrospecflow.local.toml

Do not commit astrospecflow.local.toml or .env; both are ignored by git.

Configuration precedence is:

  1. CLI flags
  2. ASTROSPECFLOW_* environment variables
  3. --config / ASTROSPECFLOW_CONFIG local TOML file
  4. documented package defaults

The MySQL host, port, user, password, database, table, SSL settings, FITS root, template root, output directory, CUDA device, and batch size are deployment settings. They must be provided by the operator and are not embedded in the package.

Quickstart

Run a no-database smoke test:

astrospecflow-reduce1d /path/to/spec-file-1.fits /path/to/spec-file-2.fits \
  --device cpu \
  --batch-size 2 \
  --artifact /path/to/local-output/smoke-no-mysql.json

Run with a local config file:

astrospecflow-reduce1d --config astrospecflow.local.toml \
  /path/to/spec-file-1.fits \
  --artifact /path/to/local-output/config-smoke.json

Run with MySQL output:

astrospecflow-reduce1d --config astrospecflow.local.toml \
  /path/to/spec-file-1.fits /path/to/spec-file-2.fits \
  --write-mysql \
  --artifact /path/to/local-output/mysql-smoke.json

If required MySQL fields are missing, the CLI fails before the long reduction starts and reports which fields must be configured.

CUDA Policy

The 0.1.0 release line is a Python orchestration package. CUDA acceleration is optional and depends on a local extension build that matches the deployment host's CUDA, PyTorch, and GPU architecture. A missing CUDA extension should not break package import, documentation builds, or CPU smoke tests.

Validation

Local release checks:

python3 scripts/release/audit_release_surface.py
PYTHONPATH=src pytest -q
python -m sphinx -b html docs docs/_build/html
python -m build
python -m twine check --strict dist/*
bash scripts/release/validate_pypi_candidate.sh

A wheel is the built package file that pip normally installs. An sdist is the source distribution archive. twine check validates package metadata and README rendering before upload to TestPyPI or PyPI.

Deployment promotion can add a fixed regression set. In this repository, release32 means a site-owned validation set of 32 FITS files, typically about 8000 spectra, used to compare end-to-end throughput and MySQL publication fields. It is not required for ordinary installation or quickstart usage.

PyPI

Build locally:

python -m build
python -m twine check --strict dist/*

TestPyPI verification, when credentials are available:

python -m twine upload --repository testpypi dist/*
python3 -m venv /tmp/astrospecflow-testpypi
/tmp/astrospecflow-testpypi/bin/python -m pip install \
  --index-url https://test.pypi.org/simple/ --no-deps astrospecflow

Real PyPI publication requires a PyPI API token or GitHub Trusted Publishing. After publication, users can install with:

python3 -m pip install astrospecflow

Documentation

Build docs locally:

python -m sphinx -b html docs docs/_build/html

Start with docs/index.rst, docs/install.rst, docs/quickstart.rst, docs/configuration.rst, docs/resource_contract.rst, docs/cuda_extension.rst, docs/mysql_sink.rst, docs/validation.rst, and docs/troubleshooting.rst.

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

astrospecflow-0.1.0.tar.gz (403.7 kB view details)

Uploaded Source

Built Distribution

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

astrospecflow-0.1.0-py3-none-any.whl (434.8 kB view details)

Uploaded Python 3

File details

Details for the file astrospecflow-0.1.0.tar.gz.

File metadata

  • Download URL: astrospecflow-0.1.0.tar.gz
  • Upload date:
  • Size: 403.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for astrospecflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 631b9d425b3e7f5d18b937a0aac02ea588a6dd551a389da07b8fd43187d2d050
MD5 a406c17400538ad21cce772d4f170e00
BLAKE2b-256 266a60b149ec3432873d20de154e6398ab990e426c2497097f3fe288ccfeb5fb

See more details on using hashes here.

File details

Details for the file astrospecflow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: astrospecflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 434.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for astrospecflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a5f136ef3ba5d3b922bd89562f4026e1a52e4d609d250d75fe0b60d44d89707
MD5 3b6171eae2ac2bece0dc8ec13af866bc
BLAKE2b-256 5ffa153c43ee453ff910474f70fc4a727aba51fafc55b238ece34c2a09de798c

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