Examples¶
PyReduce includes example scripts for each supported instrument in the examples/ directory.
Running an Example¶
The UVES example is a good starting point:
# Download sample data
uv run reduce download UVES
# Run the example
uv run python examples/uves_example.py
Or use the CLI directly:
uv run reduce run UVES -t "HD[- ]?132205" --steps bias,flat,trace,science
Example Structure¶
Each example script follows the same pattern:
from pyreduce.pipeline import Pipeline
from pyreduce import datasets
# Define parameters
instrument = "UVES"
target = "HD132205"
night = "2010-04-01"
channel = "middle"
steps = ("bias", "flat", "trace", "science")
# Download/locate data
base_dir = datasets.UVES()
# Run pipeline
Pipeline.from_instrument(
instrument,
target,
night=night,
channel=channel,
steps=steps,
base_dir=base_dir,
plot=1,
).run()
Modifying Steps¶
Edit the steps tuple to control which reduction steps run:
steps = (
"bias",
"flat",
"trace",
# "curvature", # Skip curvature
# "scatter", # Skip scatter
"norm_flat",
"wavecal",
"science",
# "continuum", # Skip continuum
"finalize",
)
Steps not in the list but required as dependencies will be loaded from previous runs if the output files exist.
Available Examples¶
ESO Instruments¶
Example |
Description |
|---|---|
|
ESO UVES |
|
ESO HARPS |
|
HARPS-N (TNG) |
|
ESO XSHOOTER |
|
ESO CRIRES+ |
Space Telescopes¶
Example |
Description |
|---|---|
|
JWST NIRISS |
|
JWST MIRI |
Other Observatories¶
Example |
Description |
|---|---|
|
Keck NIRSPEC |
|
Lick APF |
|
McDonald Observatory |
|
NEID |
ELT Instruments (Simulated)¶
Example |
Description |
|---|---|
|
ELT METIS Long-Slit |
|
ELT METIS IFU |
|
ELT MICADO |
|
ELT MOSAIC NIR channel |
|
ELT MOSAIC VIS channels |
|
ELT ANDES R/IZ channels |
|
ELT ANDES all bands (U/B/V/R/IZ/Y/J/H) |
|
ELT ANDES YJH channels |
Advanced Usage¶
Example |
Description |
|---|---|
|
Using pre-computed slit function for single-pass extraction |
Templates¶
Example |
Description |
|---|---|
|
Template for adding new instruments |
|
Custom instrument example |