Skip to content

ronaldolaishram/cigale-gui

Repository files navigation

PCIGALE GUI

A cross-platform graphical interface for PCIGALE (Python Code Investigating GALaxy Emission) SED fitting.

Author: Ronaldo Laishram Website: www.ronaldolaishram.com License: MIT


Features

  • Cross-platform support (Windows, macOS, Linux)
  • Visual directory browser and manual path entry
  • Automatic conda environment detection and activation
  • File validation before running PCIGALE
  • One-click SED fitting execution
  • Basic plots: Mass-SFR, UVJ color-color diagrams
  • Advanced plots: sSFR, star formation history, dust attenuation, fit quality
  • Best-fit SED PDF generation with automatic config checking
  • Publication-quality outputs (300 DPI, PNG + PDF)
  • Configuration file for persistent settings
  • Comprehensive logging
  • Sample data included for testing

Quick Start

Before launching: If you want to use a conda environment to run PCIGALE, edit config.ini and set:

use_conda = true
conda_env = your_environment_name

Otherwise, keep the default settings (conda disabled). Alternatively, you can also configure this after launching from the GUI sidebar settings.

macOS

Double-click: PCIGALE_GUI.command

Windows

Double-click: PCIGALE_GUI.bat

Linux

./PCIGALE_GUI.sh

The application will open in your default browser at http://localhost:8501


Try It Now with Sample Data

The application includes sample galaxy photometry data so you can test it immediately:

  1. Launch the GUI (see Quick Start above)
  2. In the GUI, navigate to the example_data/ directory
  3. Select cigale_input.txt as your input file
  4. Select pcigale.ini as your configuration file
  5. Run PCIGALE and generate plots

Sample Data Details:

  • 22 galaxies with Subaru HSC photometry (g, r, i, z, y bands)
  • Pre-configured PCIGALE parameter file included
  • See example_data/README.txt for more information

Requirements

System Requirements

  • Python 3.7 or later
  • PCIGALE installed (see installation instructions below)
  • Streamlit (auto-installed if missing)
  • Conda/Miniconda (recommended for environment management)

PCIGALE Installation

Important: This GUI and the included example data are designed for PCIGALE v2022.1. If you have a newer version (e.g., 2025), the examples may need adjustment, or you can install v2022.1 alongside your current version.

Option 1: Install PCIGALE v2022.1 (Recommended for Examples)

Download v2022.1:

Installation Steps:

# Download and extract
wget https://gitlab.lam.fr/cigale/cigale/-/archive/v2022.1/cigale-v2022.1.tar.gz
tar -xzf cigale-v2022.1.tar.gz
cd cigale-v2022.1

# Install in conda environment (recommended)
conda create -n pcigale_env python=3.9
conda activate pcigale_env
python setup.py install

# Or install system-wide
pip install .

Option 2: Install Latest Version

If you prefer the latest version of PCIGALE:

Verify Installation

# Check PCIGALE version
pcigale --version

# Test PCIGALE
pcigale --help

Official Resources


Configuration

Edit config.ini to customize behavior:

[Environment]
use_conda = true
conda_env = your_env_name    # Replace with your conda environment name

[Server]
port = 8501
auto_open_browser = true

[Plotting]
plot_dpi = 300
plot_format = both
show_uvj_boundaries = true

Project Structure

PCIGALE_GUI/
├── PCIGALE_GUI.command       # macOS launcher
├── PCIGALE_GUI.bat            # Windows launcher
├── PCIGALE_GUI.sh             # Linux launcher
├── PCIGALE_GUI.desktop        # Linux desktop entry
├── pcigale_gui.py             # Main application
├── config.ini                 # Configuration file
├── README.md                  # This file
├── DIRECTORY_STRUCTURE.txt    # Detailed directory map
├── docs/                      # Documentation files
│   ├── READ_ME_FIRST.txt
│   ├── FIRST_TIME_SETUP.txt
│   ├── INSTALL.md
│   └── ...
├── scripts/                   # Launch scripts
│   ├── launch_pcigale_gui.sh
│   └── launch_pcigale_gui.bat
├── config/                    # Configuration examples
│   ├── config_default.ini
│   └── config_ronaldo.ini
├── plotters/                  # Standalone plotting tools
│   ├── plot_mass_sfr.py
│   └── plot_uvj_diagram.py
├── example_data/              # Sample data for testing
│   ├── README.txt
│   ├── cigale_input.txt
│   ├── pcigale.ini
│   └── pcigale.ini.spec
└── logs/                      # Application logs
    └── pcigale_gui.log

Usage

1. Launch the GUI

Double-click the launcher for your operating system.

2. Select Working Directory

Two ways to select your PCIGALE project folder:

Option 1: Manual Entry Tab

  • Type or paste the full path to your directory

Option 2: Browse Directories Tab

  • Navigate visually through your file system
  • Quick access buttons: Home, Documents, Desktop
  • Click folder names to navigate into them
  • Click "Select" button next to a folder to choose it
  • Use "Up" button to go to parent directory

Your working directory should contain:

  • pcigale.ini (configuration)
  • pcigale.ini.spec (specifications)
  • Input catalog (e.g., cigale_input.txt)

Tip: Use the included example_data/ directory to test the application first!

3. Verify Files

Click "Check Files" to verify all required files exist.

4. Run PCIGALE

  • Click "Run PCIGALE Check" to validate configuration
  • Click "Run PCIGALE Fitting" to execute SED fitting

5. Generate Plots

After fitting completes, the GUI offers multiple plotting options:

Basic Plots:

  • Mass vs SFR diagram (main sequence)
  • UVJ color-color diagram with selection boundaries

Advanced Galaxy Properties:

  • Specific SFR vs Mass (galaxy activity)
  • Star Formation History diagnostic (recent vs long-term SFR)
  • Dust Attenuation vs SFR (A_V analysis)
  • Fit Quality check (chi-square distribution)

Best-Fit SEDs:

  • Individual galaxy SED PDFs (if save_best_sed = True in config)

All plots are automatically saved to the out/ directory in both PNG (300 DPI) and PDF formats.

Quick Actions:

  • "Plot Both Diagrams" - Generate Mass-SFR and UVJ at once
  • "Generate All Advanced Plots" - Create all 4 advanced diagnostic plots
  • Individual buttons for each plot type

SED Plot Generation:

  • The GUI automatically checks if save_best_sed = True in your pcigale.ini
  • If enabled, you can generate PDF plots of best-fit SEDs for each galaxy
  • If disabled, the GUI shows instructions on how to enable it
  • Simply set save_best_sed = True in pcigale.ini and re-run fitting

Conda Environment

The application automatically detects and activates conda environments.

If using conda:

  1. Set use_conda = true in config.ini
  2. Specify your conda environment name in conda_env
  3. The launcher will activate it automatically

If not using conda:

  1. Set use_conda = false in config.ini
  2. Ensure PCIGALE is available in your system PATH

You can also toggle this in the GUI sidebar.


Troubleshooting

Streamlit Installation Fails

If automatic installation fails:

# With conda
conda activate your_env_name
pip install streamlit

# Without conda
pip3 install --user streamlit

PCIGALE Command Not Found

If PCIGALE is not installed, follow the installation instructions in the Requirements section above.

To verify installation:

# With conda
conda activate pcigale_env
pcigale --version
pcigale --help

# Verify installation path
which pcigale

If installed but not found:

  • Make sure your conda environment is activated
  • Check if PCIGALE is in your PATH
  • Try reinstalling PCIGALE following the official documentation: https://cigale.lam.fr/documentation/

Port Already in Use

If port 8501 is busy, edit config.ini:

[Server]
port = 8502

Log Files

Check logs/pcigale_gui.log for detailed error messages.


Standalone Plotters

All plotting scripts can be run independently from the command line:

Basic Plots

# Mass-SFR plot
python plotters/plot_mass_sfr.py

# UVJ diagram
python plotters/plot_uvj_diagram.py
python plotters/plot_uvj_diagram.py --boundary  # with boundaries

Advanced Galaxy Properties

# Generate all advanced plots
python plotters/plot_galaxy_properties.py

# Generate specific plots
python plotters/plot_galaxy_properties.py --plot ssfr
python plotters/plot_galaxy_properties.py --plot sfh dust quality

# Custom input/output
python plotters/plot_galaxy_properties.py \
    --input /path/to/results.fits \
    --output /path/to/output

# Show plots interactively
python plotters/plot_galaxy_properties.py --show

Available plot types:

  • ssfr - Specific SFR vs stellar mass
  • sfh - Star formation history diagnostic
  • dust - Dust attenuation vs SFR
  • quality - Fit quality check (chi-square)
  • all - Generate all plots (default)

See plotters/README.md for detailed documentation.


Distribution

To share this application:

  1. Copy the entire PCIGALE_GUI folder (includes all subdirectories)
  2. Ensure config.ini uses default settings (or use config/config_default.ini)
  3. Send to users via zip, git, or file sharing
  4. Users can test immediately with the included example_data/
  5. Users double-click the launcher for their OS
  6. No additional setup required

See docs/DISTRIBUTION_CHECKLIST.md for detailed distribution instructions.


About PCIGALE

PCIGALE (Python Code Investigating GALaxy Emission) is a powerful tool for modeling galaxy spectral energy distributions (SEDs). It enables astronomers to derive physical properties of galaxies (stellar mass, star formation rate, dust attenuation, etc.) by fitting their observed photometry.

Official Links

Version Compatibility

This GUI and included examples are tested with PCIGALE v2022.1:

If you're using a newer version (2025+), the examples should still work, but you may need to regenerate the pcigale.ini.spec file.

Citation

If you use PCIGALE in your research, please cite:


License

MIT License

Copyright (c) 2026 Ronaldo Laishram

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Contact

Ronaldo Laishram Website: www.ronaldolaishram.com

For PCIGALE-specific questions, consult the official documentation.


Version: 1.0.0 Last Updated: January 2026

About

A cross-platform graphical interface for PCIGALE (Python Code Investigating GALaxy Emission) SED fitting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors