A comprehensive astronomical photometry pipeline built with Streamlit, featuring local astrometric plate solving, multi-catalog cross-matching, and advanced photometric analysis capabilities.
- Multi-aperture photometry: Automatic aperture photometry with multiple radii (1.1×, 1.3× FWHM)
- PSF photometry: Effective Point Spread Function (ePSF) modeling.
- Background estimation: Advanced 2D background modeling with SExtractor algorithm
- Source detection: DAOStarFinder and Sep with configurable detection thresholds
- FWHM estimation: Automatic seeing measurement with Gaussian profile fitting
- Local plate solving: Integration with Astrometry.net via
stdpipefor blind astrometric solving - WCS refinement: Advanced astrometric refinement using standard pipe tools
- Header validation: Automatic WCS header fixing and validation
- Coordinate systems: Support for multiple coordinate reference frames
- Catalogs integration: Automatic cross-matching with standard star catalogs
- Zero-point calculation: Robust photometric calibration with outlier rejection
- Multiple filter bands: Support for GAIA, synthetic, PanStarrs et SkyMapper photometry bands
- GAIA DR3: Stellar parameters, proper motions, and photometry
- SIMBAD: Object identifications and classifications
- Astro-Colibri: Transient and variable source alerts
- SkyBoT: Solar system object identification
- AAVSO VSX: Variable star catalog
- Milliquas: Quasar and AGN catalog
- 10 Parsec Catalog: Nearby stars (within 10 pc)
- Cosmic ray removal: Automatic L.A.Cosmic algorithm implementation via astroscrappy
- Image enhancement: Multiple visualization modes (ZScale, histogram equalization)
- Quality filtering: Automated source quality assessment with S/N-based flags
- Error propagation: Comprehensive photometric error calculation with zero-point uncertainty
- Transient Detection: Identification of transient candidates using survey templates
- Interactive web interface: Streamlit-based GUI with real-time processing
- Parameter configuration: Adjustable detection and photometry parameters
- Progress tracking: Real-time status updates and logging
- Results visualization: Interactive plots and Aladin Lite v3 sky viewer integration
- Python 3.12+
- Astrometry.net local installation (
solve-fieldbinary must be in PATH) - Index files for Astrometry.net appropriate for your field of view
The required packages are listed in the pyproject.toml file. You can install them using pip:
pip install -e .This will install the project in editable mode and all the dependencies.
- Astrometry.net: Required for local plate solving (accessed via
stdpipe)# Ubuntu/Debian sudo apt-get install astrometry.net # macOS with Homebrew brew install astrometry-net
You must start the backend server before launching the frontend. Two modes are supported:
- FastAPI (recommended, modern):
# Windows PowerShell .venv\Scripts\Activate.ps1 python -m uvicorn api.main:app --reload --host 127.0.0.1 --port 8000 # Or use run_all_cmd.bat for one-click launch run_all_cmd.bat
- Legacy Flask backend:
python backend.py
In a new terminal (with the virtual environment activated):
streamlit run frontend.py
# OR
streamlit run pages/app.pyVisit the URL printed by Streamlit (usually http://localhost:8501).
Create an account or login with existing credentials. You can also run in anonymous mode if the backend is not configured.
Set your observatory location and parameters in the sidebar (name, latitude, longitude, elevation).
Upload your astronomical image to the main area. Supported extensions: .fits, .fit, .fts, .fits.gz, .fts.gz.
Adjust analysis parameters as needed (seeing, detection threshold, border mask, filter band, etc.) and run the photometry pipeline. Results and logs will be available for download as a ZIP archive.
- Name: Observatory identifier
- Latitude/Longitude: Geographic coordinates (decimal degrees)
- Elevation: Height above sea level (meters)
- Estimated Seeing (FWHM): Initial estimate in arcseconds
- Detection Threshold: Source detection sigma threshold
- Border Mask: Pixel border exclusion size
- Filter Band: GAIA or synthetic magnitude band for calibration
- Max Calibration Mag: Faintest magnitude for calibration stars
- Astrometry Check: Toggle to force a plate solve/WCS refinement
- Photometry Catalog: CSV and VOTable with multi-aperture and PSF photometry
- Background Model: 2D background and RMS maps (FITS)
- PSF Model: Empirical PSF (FITS)
- WCS Header: Astrometric solution (TXT)
- WCS-Solved FITS: Original image with updated WCS header (when astrometry is performed)
- Plots: FWHM, magnitude distributions, zero-point calibration
- Log File: Detailed processing log
- Enable Transient Finder: Activates the transient search pipeline
- Reference Survey: Survey to use for template comparison (e.g., PanSTARRS)
The pipeline uses stdpipe as a Python wrapper around a local Astrometry.net installation for robust astrometric solutions:
- Source Detection: Automated star detection using photutils
- Blind Matching:
stdpipe.astrometry.blind_match_objectsfor initial WCS - Parameter Optimization: Automatic scale and position hint extraction from header if available
- Solution Validation: Coordinate range and transformation validation
The pipeline generates comprehensive output files, available as a ZIP download:
- Photometry Catalog (CSV and VOTable): Complete source catalog with multi-aperture and PSF photometry
- Log File: Detailed processing log with timestamps
- Background Model (FITS): 2D background and RMS maps
- PSF Model (FITS): Empirical PSF (or Gaussian fallback) for the field
- Plots: FWHM analysis, magnitude distributions, zero-point calibration
- WCS Header (TXT): Updated astrometric solution
- WCS-Solved FITS: Original image with refined WCS embedded in header (saved to
rpp_data/fits/)
- Background:
photutils.Background2DwithSExtractorBackground - Detection:
photutils.DAOStarFinderwith configurable parameters - PSF Modeling:
photutils.EPSFBuilderwith Gaussian fallback - Photometry: Circular apertures and PSF fitting
- Astrometry:
stdpipe/ Astrometry.net - Cosmic Rays:
astroscrappy(L.A.Cosmic)
- Caching: Streamlit caching for improved performance
- Memory Management: Efficient handling of large FITS files
Firefox Aladin Lite Issues: Firefox may have compatibility issues with Aladin Lite v3 due to WebAssembly loading.
- Refresh the page: Sometimes resolves the issue.
- Clear Firefox cache: Clear cookies and cached web content.
- Alternative browsers: Use Chrome, Edge, or Safari for best Aladin Lite compatibility.
Plate Solving Fails:
- Ensure
solve-fieldis in your system PATH. - Check that astrometry.net index files are installed for your image scale.
- Verify sufficient stars in the field (>5-10 recommended).
No Catalog Matches:
- Check internet connectivity for catalog queries (GAIA, SIMBAD, etc.).
- Verify coordinate system and field center are correct.
- New Storage Structure:
- FITS file storage moved from
data/fits/torpp_data/fits/(same level asrpp_results/) - WCS-solved FITS files are now saved both in the ZIP archive and to
rpp_data/fits/ - Permanent copy in
rpp_data/fits/is overwritten when the same file is reprocessed
- FITS file storage moved from
- WCS-Solved FITS Export:
- New
save_fits_with_wcs()utility function saves original image with updated WCS header - Automatically triggered after successful astrometry solving
- New
- Database Tracking System:
- New tables track WCS-solved FITS files and result ZIP archives per user
- Many-to-many relationship: one FITS file can be linked to multiple analysis runs
- Migration script
scripts/migrate_add_wcs_zip_tables.pyfor existing databases - Query functions to retrieve user's analysis history
- Improved Quality Filtering:
- Magnitude error threshold reduced from 2.0 to 1.5 for stricter quality control
- Added absolute value handling for occasional negative error values
- Testing:
- New test suite
tests/test_database.pywith 35 tests for database functionality
- New test suite
- Photometry Calculation Improvements:
- Fixed critical PSF S/N calculation (was using
sqrt(flux_err)instead offlux_err) - Removed S/N rounding to preserve precision and avoid divide-by-zero errors
- Added proper error propagation for calibrated magnitudes:
σ_mag_calib = √(σ_mag_inst² + σ_zp²) - S/N now uses background-corrected flux for more accurate estimation
- Added quality flags for photometry: 'good' (S/N≥5), 'marginal' (3≤S/N<5), 'poor' (S/N<3)
- Fixed critical PSF S/N calculation (was using
- Documentation: Comprehensive mathematical documentation of S/N and magnitude error formulas
- Testing: New unit test suite for photometric calculations (
tests/test_photometry.py)
- Python 3.12 Compatibility: Project upgraded to require Python 3.12 with verified dependency resolution
- Enhanced Dependency Management: Updated to latest stable versions:
- astropy 7.1.1
- astropy-iers-data 0.2025.11.3.0.38.37
- aiohttp 3.11.18
- certifi 2025.1.31
- Improved astrometry support: Via
stdpipeintegration for robust local plate solving - Transient Detection (Beta): Identification of transient candidates using template comparison and catalog filtering
- Multi-catalog cross-matching: GAIA DR3, SIMBAD, SkyBoT, AAVSO VSX, Milliquas, 10 Parsec Catalog, and Astro-Colibri integration
- Python 3.12 Compatibility: Project upgraded to require Python 3.12 with verified dependency resolution
- Enhanced Dependency Management: Updated to latest stable versions (astropy 7.1.1, aiohttp 3.11.18, certifi 2025.1.31)
- Integrated
stdpipefor robust local astrometric solving via Astrometry.net - Added Transient Finder (Beta) utilizing
stdpipeimage subtraction and catalog filtering - Added 10 Parsec Catalog to multi-catalog cross-matching pipeline
- Improved PSF Photometry with empirical ePSF and Gaussian fallback mechanisms
- Automatic Cosmic Ray rejection enabled by default using
astroscrappy(L.A.Cosmic algorithm) - UI/UX enhancements: Astrometry check toggle, Aladin Lite v3 integration for interactive sky viewing
- Refactored header handling and WCS creation for improved stability and accuracy
- Please open issues or pull requests for bugs, feature requests or improvements.
- Tests and clear reproducible examples are appreciated for complex changes.
This project is licensed under the MIT License - see the LICENSE for details.