Skip to content

ivh/PyReduce

Repository files navigation

CI Documentation Status Python 3.13+

PyReduce

A data reduction pipeline for echelle spectrographs (HARPS, UVES, XSHOOTER, CRIRES+, JWST/NIRISS, and more).

Based on the REDUCE package. See the papers:

Installation

# Using uv (recommended)
uv add pyreduce-astro

# Or pip
pip install pyreduce-astro

For development:

git clone https://github.com/ivh/PyReduce
cd PyReduce
uv sync

Quick Start

# Download sample data
uv run reduce download UVES

# Run reduction
uv run reduce run UVES HD132205 --steps bias,flat,trace,science

# Or run individual steps
uv run reduce bias UVES HD132205
uv run reduce flat UVES HD132205

Or use the Python API:

from pyreduce.pipeline import Pipeline

Pipeline.from_instrument(
    instrument="UVES",
    target="HD132205",
    night="2010-04-01",
    channel="middle",
).run()

Plotting

Control plotting with environment variables:

# Save plots to files (headless/CI)
PYREDUCE_PLOT=1 PYREDUCE_PLOT_DIR=/tmp/plots PYREDUCE_PLOT_SHOW=off uv run reduce run ...

# Show all plots at end (browser via webagg)
MPLBACKEND=webagg PYREDUCE_PLOT=1 PYREDUCE_PLOT_SHOW=defer uv run reduce run ...

See How To for details.

Documentation

Full documentation at ReadTheDocs.

Output

PyReduce creates .fits files (standard FITS with binary table extension). Headers include original keywords plus PyReduce-specific ones prefixed with e_.

About

A Python port of the popular IDL data reduction package REDUCE.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 10