Skip to main content

Project Map

This page maps how the modules of the AstroSpectro repository depend on each other and which entry point drives which part. For the directory layout and the role of each folder, see Project Structure; for the order in which data flows through the modules, see Data Lifecycle. The map was built from the import statements and module docstrings of the repository.


Module dependency graph​

Arrows read "imports / calls".

tools/visualizer.py (AstroVisualizer, used by app.py) sits beside this chain: it imports preprocessor, feature_engineering, classifier, peak_detector and utils. spectra_manager.py drives dr5_downloader.py from notebooks.

src/pipeline — the processing and training chain​

ModuleMain objectsDepends on
master.pyMasterPipeline (orchestration, dashboard, session reports)dataset_builder, generate_catalog_from_fits, gaia_crossmatcher, processing, classifier; wandb_config on demand
processing.pyProcessingPipelinepreprocessor, peak_detector, feature_engineering, utils
preprocessor.pySpectraPreprocessor, ProcessedSpectrumutils (inverse-variance helpers)
peak_detector.pyPeakDetector, matches_to_dataframe, matches_to_seriesNumPy, SciPy only
feature_engineering.pyFeatureEngineer, SpectralLineLibrary, Gaia and photometric compositesutils
classifier.pySpectralClassifier, CollinearityFilter, ThresholdTunedClassifierscikit-learn, XGBoost
wandb_config.pyshould_use_wandb, init_wandb_runwandb (optional)

src/pipeline/master (1).py is an older copy of master.py and is not imported by anything.

src/tools — data management and visualisation​

ModuleRole
dr5_downloader.pyResumable download of LAMOST DR5 spectra
spectra_manager.pyNotebook-facing wrapper around the downloader, plus clean-up and backup of data/raw/
dataset_builder.pySelection of unused spectra and the trained-spectra ledger
generate_catalog_from_fits.pyFITS headers → catalogue CSV
gaia_crossmatcher.pyGaia DR3 enrichment
visualizer.pyAstroVisualizer: spectrum, line and model figures, built on preprocessor, feature_engineering, classifier, peak_detector

src/dimred — the dimensionality-reduction package (PHY-3500)​

dimred/__init__.py is a façade: it re-exports the public objects so notebooks use from dimred import … without depending on file names.

The package reads the feature CSV and the Gaia catalogue produced by the pipeline but does not import src/pipeline modules; xgboost_bridge only loads a serialised classifier to project its predictions onto the UMAP space. The arrows above show the data flow between components in a typical notebook, not Python imports; __init__.py is the only module that imports the others.

Notebooks and entry points​

Entry pointPurpose
notebooks/00_master_pipeline.ipynbMaster notebook: batch → catalogue → features → training
notebooks/01_download_spectra.ipynbSpectra download
notebooks/02_tools_and_visuals.ipynbExploration and figures
notebooks/03_scientific_validation.ipynbPhysical validation
notebooks/04_shap_interpretability.ipynbSHAP analysis
notebooks/dimred/phy3500_01_pca.ipynb, …02_umap_tsne.ipynb, …03_autoencoder.ipynbPHY-3500 dimensionality-reduction analyses
app.pyImports AstroVisualizer and setup_project_env
scripts/Environment setup and clean-up scripts