lris2-drp
is a data reduction pipeline for LRIS2 flat-field images.
It performs flat-field normalization, correction, slit tracing, and QA visualization using a Prefect-based workflow engine.
- Installation
- Setting Up Your Package
- Running the DRP
- Output Files
- Configuration Tips
- Python 3.10 or higher
pip
setuptools
>= 42- FITS images from LRIS2
git clone https://github.com/caltech/lris2-drp.git
cd lris2-drp
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -e .[dev]
This package is built using PEP 517/518 with pyproject.toml
.
To install only the core dependencies:
pip install -e .
Optional developer tools (like black
, flake8
, pytest
) can be installed via:
pip install -e .[dev]
To batch-process a folder of flat-field FITS files:
from lris2_drp.flows import batch_process_all_flats
batch_process_all_flats(
input_dir="/path/to/flats",
output_dir="/path/to/results",
)
This will process up to 2 files in parallel (configurable) using Prefect’s ConcurrentTaskRunner
.
Each file goes through:
- Normalization
- Flat-field correction
- Slit tracing
- QA plot generation
- FITS header augmentation
For each input FITS file, the following will be written to the output directory:
<filename>/
├── flat_corrected.fits # Flat-field corrected image
├── flat_norm_qa.png # QA plot of normalized flat
└── slit_trace.txt # Slit trace positions
The corrected FITS file includes a FLATCOR
keyword in the header:
FLATCOR = 'True' / Flat-field correction applied
Additional keywords track reduction steps (optional to expand).
To change the number of files processed in parallel, set max_workers
in ConcurrentTaskRunner
:
@flow(task_runner=ConcurrentTaskRunner(max_workers=4))
def batch_process_all_flats(...):
Output filenames and directory structure can be customized in:
save_trace_solution()
save_corrected_fits()
generate_qa_plot()