How amase-project/amasedrp works
1. Repository purpose
- amasedrp is a Python data-reduction pipeline package, likely for astronomical/CCD or CMOS imaging and spectroscopy, given the presence of bias/dark calibration, bad pixel maps, and ThAr line-list data.
- The architecture is centered on reusable reduction modules plus a script entrypoint that runs a configured pipeline.
2. Top-level package layout
- The main code lives under amasedrp/, split into:
- reduction/ for processing stages
- utils/ for shared support code
- script/ for command-line execution
- data/ for bundled reference assets
- example/ for sample pipeline configuration and output artifacts
3. Pipeline orchestration boundary
- amasedrp/script/run_drp.py is the likely execution entrypoint.
- The YAML files in amasedrp/example/ (ImgPipeline.yml, ImgPipeline_quick.yml) suggest the pipeline is configuration-driven, with the script reading a config to decide which reduction steps to run.
- This is the clearest boundary between user-facing invocation and the internal processing modules.
4. Image calibration subsystem
- amasedrp/reduction/ImgCal/ contains image calibration logic.
- MakeMasterBias.py and MakeMasterDark.py indicate creation of master calibration frames from raw inputs.
- preprocessing.py likely handles frame-level preparation such as masking, subtraction, correction, or normalization before higher-level reduction.
- This subsystem is focused on image-domain calibration rather than spectral extraction.
5. Spectral calibration subsystem
- amasedrp/reduction/SpecCal/ exists as a separate reduction area, indicating a second major branch for spectroscopy-related processing.
- The tree does not show implementation files here, so the package boundary is present even if the detailed stages are not visible in the listing.
- For an architecture diagram, this should be shown as a distinct downstream branch from the main reduction pipeline.
6. Shared data abstractions
- amasedrp/utils/CMOSData/CMOSData.py likely provides a core data model or helper class for sensor/image data handling.
- This appears to be a shared utility layer used by calibration and reduction modules rather than a standalone pipeline stage.
- If diagramming boundaries, place this beneath the reduction modules as a common data/service abstraction.
7. Logging and operational support
- amasedrp/utils/log.py provides logging utilities.
- This is an operational cross-cutting concern used across pipeline stages to track progress, errors, and outputs.
- It is likely consumed by the script entrypoint and the calibration/reduction modules.
8. Bundled reference assets
- amasedrp/data/ThAr.list is a spectral reference line list, typically used in wavelength calibration.
- amasedrp/data/bad_pixel_map.fits is a sensor-quality mask/reference file used during image cleanup or preprocessing.
- These are static inputs that support reduction logic and should be drawn as read-only reference data feeding into the pipeline.
9. Example configuration and expected outputs
- amasedrp/example/stats.tab appears to be sample output or diagnostic statistics.
- The example YAML files show how to configure the reduction run, and the tabular file suggests the pipeline emits summary stats or QC artifacts.
- This folder is useful for understanding the runtime contract: config in, calibrated products and statistics out.
10. Package initialization and modularity
- Each package/subpackage has __init__.py, so the code is organized as importable Python modules.
- setup.config indicates packaging/build configuration, implying the project is meant to be installed as a Python package and run as a scriptable tool.
11. Likely data flow
- Raw sensor frames enter via the run script and pipeline config.
- Image calibration stages use reference data such as the bad pixel map and generate master calibration frames.
- Preprocessed frames then flow into image or spectral reduction paths.
- Spectral calibration likely consumes processed science frames and reference line data such as ThAr.list.
- Diagnostics/statistics are emitted alongside or after the main reduced products.
12. Architectural boundaries to emphasize
- There is a clear separation between:
- orchestration (script/)
- processing logic (reduction/)
- shared utilities (utils/)
- static reference data (data/)
- sample configs and outputs (example/)
- This is a good basis for an architecture diagram showing a configuration-driven pipeline with shared utilities and external reference inputs.
13. What is not evident from the tree
- No web layer, database, message queue, or cloud service integration is visible.
- The project appears to be a local/offline scientific processing package rather than a service-oriented application.
- Any diagram should stay focused on file-based inputs/outputs and Python module boundaries.
Main entry points: run_drp.py Run DRP · ImgCal Image Cal · preprocessing.py Preprocess · CMOSData.py CMOS Data
Components 17
Orchestration
User-facing pipeline entrypoint and runtime config.
- Run DRP · Command-line pipeline runner.
amasedrp/script/run_drp.py - Script Pkg · Script package boundary.
amasedrp/script
Reduction
Core image and spectral processing stages.
- Image Cal · Image-domain calibration and preprocessing.
amasedrp/reduction/ImgCal - Master Bias · Builds master bias frames.
amasedrp/reduction/ImgCal/MakeMasterBias.py - Master Dark · Builds master dark frames.
amasedrp/reduction/ImgCal/MakeMasterDark.py - Preprocess · Frame-level cleanup and correction steps.
amasedrp/reduction/ImgCal/preprocessing.py - Spec Cal · Spectroscopy calibration boundary.
amasedrp/reduction/SpecCal - Reduction Pkg · Top-level reduction package boundary.
amasedrp/reduction/__init__.py
Utilities
Shared data model and operational helpers.
Assets
Bundled reference data and example pipeline files.
- Img Pipeline · Full example pipeline configuration.
amasedrp/example/ImgPipeline.yml - Quick Pipeline · Short example pipeline configuration.
amasedrp/example/ImgPipeline_quick.yml - Stats Output · Sample tabular statistics artifact.
amasedrp/example/stats.tab - ThAr Lines · Spectral line list for calibration.
amasedrp/data/ThAr.list - Bad Pixels · Static bad-pixel mask.
amasedrp/data/bad_pixel_map.fits - Data Pkg · Bundled reference data package boundary.
amasedrp/data
Connections 26
- Run DRP → Img Pipeline: reads · Pipeline execution is driven by YAML configuration.
- Run DRP → Quick Pipeline: reads · Alternate quick-run configuration.
- Run DRP → Image Cal: orchestrates · Entry script dispatches image reduction stages.
- Run DRP → Spec Cal: orchestrates · Entry script can dispatch spectral calibration steps.
- Run DRP → Logging: uses · Runtime progress and error reporting.
- Img Pipeline → Master Bias: enables · Configuration may activate master bias generation.
- Img Pipeline → Master Dark: enables · Configuration may activate master dark generation.
- Img Pipeline → Preprocess: configures · Configuration drives preprocessing options.
- Quick Pipeline → Preprocess: configures · Quick pipeline targets a reduced preprocessing path.
- Image Cal → Master Bias: contains · Calibration subsystem includes bias building.
- Image Cal → Master Dark: contains · Calibration subsystem includes dark building.
- Image Cal → Preprocess: contains · Calibration subsystem includes preprocessing.
- Preprocess → CMOS Data: uses · Preprocessing operates on shared CMOS data structures.
- Preprocess → Bad Pixels: reads · Uses sensor mask/reference data during cleanup.
- Master Bias → CMOS Data: uses · Bias combination works on common sensor data objects.
- Master Dark → CMOS Data: uses · Dark combination works on common sensor data objects.
- Spec Cal → ThAr Lines: reads · Spectral calibration consumes ThAr line references.
- Spec Cal → CMOS Data: uses · Spectral steps share the common data model.
- Reduction Pkg → Image Cal: exposes · Reduction package exposes image calibration subsystem.
- Reduction Pkg → Spec Cal: exposes · Reduction package exposes spectral calibration subsystem.
- Utils Pkg → CMOS Data: exposes · Utilities package exposes the shared data abstraction.
- Utils Pkg → Logging: exposes · Utilities package exposes logging support.
- Data Pkg → ThAr Lines: bundles · Reference line list is packaged with the project.
- Data Pkg → Bad Pixels: bundles · Bad-pixel map is packaged with the project.
- Script Pkg → Run DRP: contains · Script package contains the pipeline entrypoint.
- Run DRP → Stats Output: emits · Pipeline produces diagnostic/statistical output.