How fireflyspectra/firefly_release works
Project type and purpose
• This is a scientific, command-line Python package (“FIREFLY”) for fitting stellar population spectral models to astronomical data (galaxies, star clusters).
• Purpose: read observed or simulated spectra, load template SSP (single-stellar-population) models and auxiliary files (dust maps, masks, mass-loss tables), perform iterative χ² minimisation fitting, and output stellar population properties (age, metallicity, E(B–V), mass, SFH, etc.).
File structure
Top-level directories:
• run/ → CLI entry-point scripts for different data sources (generic, SDSS, MaNGA) plus a reader for outputs
• python/ → core FIREFLY library modules (constants, dust handling, instrument setup, models, fitter, SF rate, estimations, setup)
• data/ → small auxiliary lookup files (dust maps, sky masks, mass-loss tables, resolution data)
• example_data/ → sample input spectra (ASCII, FITS) for testing
• stellar_population_models/ → heavyweight library of SSP templates (M11 Élodie, MILES, MARCS and MaStar)
README for additional insights
• Dependencies: numpy, scipy, matplotlib, astropy
• Usage: set environment variables (FF_DIR, PYTHONPATH, STELLARPOPMODELS_DIR) or rely on default relative paths
• Run commands:
• python run/firefly.py (generic)
• python run/firefly_sdss.py
• python run/firefly_manga.py
• Output reading: python run/read_firefly.py
Main components and their interactions
a. Components
1) CLI layer (“run/”)
2) Core library (“python/” modules)
3) Auxiliary data (“data/”)
4) Model templates (“stellar_population_models/”)
5) Example inputs (“example_data/”)
6) External libraries (NumPy, SciPy, Astropy, Matplotlib)
b. Relationships & data flow
• User invokes a script in run/ → it sets up environment & parameters → imports python/ modules
• python/firefly_setup.py locates data/ and stellar_population_models/
• python/firefly_instrument.py and python/firefly_dust.py load instrument resolution files and dust filter procedures from data/
• python/firefly_models.py loads SSP templates from stellar_population_models/
• python/firefly_fitter.py orchestrates the iterative χ² minimisation, calling constants, dust, instrument, models, library, estimations, SF rate modules
• python/firefly_estimations_3d.py and python/firefly_star_formation_rate.py compute derived properties and SFH
• Output files written (ASCII or FITS) to working directory
• run/read_firefly.py reads and parses output for analysis/plotting
c. Architectural patterns/principles
• Layered CLI → library → data
• Single-responsibility modules (dust, instrument, models, fitter, estimations)
• Directory-based configuration (environment variables or defaults)
• No external services; all local file I/O
d. Key technologies/frameworks
• Python 3 modular package
• Astro-specific I/O via Astropy (FITS)
• Numerical work via NumPy/SciPy
• Visualization via Matplotlib