Agent Skill
2/7/2026

galfits-manual

Galaxy imaging spectra fitting tool for multi-band image decomposition, SED modeling, and joint analysis. Covers .lyric config files, command-line arguments, and MCP interface.

W
weinaike
4GitHub Stars
2Views
npx skills add weinaike/galaxy_morphology_mcp

SKILL.md

Namegalfits-manual
DescriptionGalaxy imaging spectra fitting tool for multi-band image decomposition, SED modeling, and joint analysis. Covers .lyric config files, command-line arguments, and MCP interface.

name: galfits-manual description: Galaxy imaging spectra fitting tool for multi-band image decomposition, SED modeling, and joint analysis. Covers .lyric config files, command-line arguments, and MCP interface.

GalfitS Configuration Guide

This skill provides comprehensive guidance for writing GalfitS configuration files (.lyric format). GalfitS extends GALFIT to simultaneously fit multiple photometric bands with SED constraints.

Quick Start

To create a new GalfitS config file:

  1. Identify your fitting phase:

    • Phase 1: Image-only fitting (spatial parameters free, SED fixed)
    • Phase 2: SED-only fitting (spatial fixed, SED free)
    • Phase 3: Joint optimization (all parameters free)
  2. Configure data input (Region → Images → Spectra → Atlas)

  3. Define model components:

    • Profile components (P): Galaxy structural components with types specified by Pa2 parameter
      • sersic - Standard bulge/disk/bar profile
      • sersic_f - Fourier mode profile (spiral arms)
      • ferrer, edgeondisk, GauRing, const, Gaussian - Other profiles
    • Nuclei/AGN components (N): AGN with full SED model
    • Foreground stars (F): Stellar sources with blackbody SED
    • Galaxy components (G): Combine multiple Profile (P) components
  4. Set parameter constraints (optional)

  5. Run GalfitS with appropriate command-line options

Navigation

TopicFileDescription
Data Configurationdata-config.mdRegion (R1-R3), Images (Ia1-Ia15), Spectra (Sa1-Sa4), Atlas (Aa1-Aa7)
Model Componentsmodel-components/Galaxy, Profile (Sersic, Fourier), Nuclei/AGN, Foreground Star
Parameter Constraintsconstraints/MSR, MMR, SFH, AGN relations, parameter files, priors
Configuration Examplesexamples/Multi-band, SED-only, spectrum, joint fitting examples
Running GalfitSrunning-galfits.mdCommand-line arguments, fitting methods, usage examples

Component Type Quick Reference

GalfitS has TWO main categories of components. Understanding which category you need is the first step.


šŸ“Š Category 1: Data Components (Input Configuration)

Purpose: Define your observational data (images, spectra) before fitting.

ComponentPrefixParametersUse ForDocs
RegionRR1-R3Target name, coordinates, redshiftdata-config.md
ImageIIa1-Ia15Single-band image data, PSF, sigma, maskdata-config.md
SpectrumSSa1-Sa4Optical/IR spectrum datadata-config.md
AtlasAAa1-Aa7Group images/spectra for joint fittingdata-config.md

🌌 Category 2: Model Components (What You're Fitting)

Purpose: Define the physical components that make up your source.

Component Hierarchy

Model Components
│
ā”œā”€ā”€ šŸ”¹ Galaxy (G) ──────────────► Combines Profiles into ONE physical galaxy
│    └── contains Profile (P) components
│
ā”œā”€ā”€ šŸ”¹ Profile (P) ─────────────► Galaxy structural component (bulge, disk, bar...)
│    └── Type determined by Pa2 parameter
│
ā”œā”€ā”€ šŸ”¹ Nuclei/AGN (N) ──────────► AGN with full SED model (independent component)
│
└── šŸ”¹ Foreground Star (F) ────► Star in Milky Way (independent component)

Detailed Model Component Reference

ComponentPrefixParametersPurposeDocumentation
GalaxyGGa1-Ga7Container that combines multiple Profile (P) components into one physical galaxygalaxy.md
ProfilePPa1-Pa32Structural component (bulge, disk, bar). Type set by Pa2:See below ↓
Nuclei/AGNNNa1-Na27Central AGN with continuum, emission lines, torusnuclei-agn.md
Foreground StarFFa1-Fa8Milky Way star with blackbody SEDforeground-star.md

Profile (P) Sub-Types (determined by Pa2 parameter)

Profile TypePa2 ValueUse When You See...Documentation
SersicsersicElliptical galaxy, bulge, disk, bar, any axisymmetric structureprofile-sersic.md
Fourier Sersicsersic_fSpiral arms, non-axisymmetric featuresprofile-fourier.md
Ferrer BarferrerBar with flat inner coreprofile-other.md
Edge-on DiskedgeondiskGalaxy viewed edge-onprofile-other.md
Gaussian RingGauRingRing or lens structureprofile-other.md
GaussianGaussianUnresolved point sourceprofile-other.md
ConstantconstFlat backgroundprofile-other.md

šŸŽÆ Quick Decision Guide

What do you want to model?

Your GoalWhich Component?
Just the disk or elliptical (like a bulge) componentSingle Profile (P) component
A galaxy with bulge + diskGalaxy (G) containing 2+ Profile (P) components
BarProfile with Pa2) sersic and the Sersic index fixed to n=0.5
Spiral armsProfile with Pa2) sersic_f
An AGN / central black holeNuclei/AGN (N) component
A star in the fieldForeground Star (F) component
Multiple galaxiesMultiple Galaxy (G) components: Ga, Gb...
Galaxy + AGN togetherGalaxy (G) for host + Nuclei/AGN (N) for center

šŸ“ Component Letter Rules

Important: Letters (a, b, c...) are user-defined, NOT fixed to types.

āŒ Wrongāœ… Correct
Pa = Sersic<br>Pb = Fourier<br>Pc = AGNPa2) determines type:<br>- Pa2) sersic → Sersic<br>- Pa2) sersic_f → Fourier<br>- Use Na prefix for AGN

Example:

# All three are Sersic profiles, just with different parameters
Pa1) bulge    Pa2) sersic
Pb1) disk     Pb2) sersic     ← Same type!
Pc1) bar      Pc2) sersic     ← Same type (but Pc6 fixed to 0.5)!
Pd1) spiral   Pd2) sersic_f     ← Different type (Fourier)

# AGN is a DIFFERENT component type (N prefix, not P)
Na1) AGN      (not Pa1)       ← Separate component type

Parameter Format Reminder

All parameters use: [value, min, max, step, vary]

Phase-Specific Configuration

PhaseIa15 (Use SED)Spatial (Pa3-Pa8)SED (Pa9-Pa16)
10vary=1vary=0
21vary=0vary=1
31vary=1vary=1

Running GalfitS

Basic Command

galfits config.lyric --work ./output

For detailed command-line arguments, fitting methods, and usage examples, see running-galfits.md.

Quick Reference

TaskCommand
Quick fitgalfits config.lyric --work ./output
Bayesian analysisgalfits config.lyric --work ./output --fit_method dynesty --nlive 200
Refine previousgalfits config.lyric --work ./output --readpar previous.params
With constraintsgalfits config.lyric --work ./output --priorpath priors.txt

Common Issues & Solutions

IssueSolution
Parameter hits limitExpand min/max bounds
Band misalignmentSet Ia13) 1 and adjust Ia14) shift ranges
Off-center residualAdd new component at that position
Circular center residualAdd bulge/AGN component
Bar-like residualAdd bar component (set Pa2) sersic)
Fitting fails to convergeSee running-galfits.md for troubleshooting

File Structure

your-config/
ā”œā”€ā”€ SKILL.md                    # This file - main entry point
ā”œā”€ā”€ running-galfits.md          # Command-line arguments & usage
ā”œā”€ā”€ data-config.md              # Data input configuration
ā”œā”€ā”€ model-components/           # Model component documentation
│   ā”œā”€ā”€ index.md                # Component overview
│   ā”œā”€ā”€ galaxy.md               # Galaxy configuration
│   ā”œā”€ā”€ profile-sersic.md       # Sersic profile
│   ā”œā”€ā”€ profile-fourier.md      # Fourier Sersic profile
│   ā”œā”€ā”€ profile-other.md        # Other profile types
│   ā”œā”€ā”€ nuclei-agn.md           # Nuclei/AGN configuration
│   ā”œā”€ā”€ foreground-star.md      # Foreground star configuration
│   └── parameter-format.md     # Parameter format and combining
ā”œā”€ā”€ constraints/                # Parameter constraints & priors
│   ā”œā”€ā”€ index.md                # Constraints overview
│   ā”œā”€ā”€ parameter-files.md      # .params and .constrain file usage
│   ā”œā”€ā”€ mass-size-relation.md   # MSR prior for size-mass correlation
│   ā”œā”€ā”€ mass-metallicity-relation.md  # MMR prior for stellar mass-metallicity
│   ā”œā”€ā”€ sfh-constraints.md      # Star formation history priors
│   ā”œā”€ā”€ agn-constraints.md      # AGN-specific constraints
│   ā”œā”€ā”€ gaussian-priors.md      # GP parameter for Gaussian priors
│   └── energy-balance.md       # EB parameter for dust-stellar energy balance
ā”œā”€ā”€ examples/                   # Configuration examples
│   ā”œā”€ā”€ index.md                # Examples overview
│   ā”œā”€ā”€ multi-band-imaging.md   # Multi-band bulge-disk decomposition
│   ā”œā”€ā”€ pure-sed-fitting.md     # Photometric SED fitting
│   ā”œā”€ā”€ spectrum-fitting.md     # AGN/host spectrum decomposition
│   ā”œā”€ā”€ imaging-spectrum-joint.md  # Joint imaging+spectra fitting
│   └── grism-imaging.md        # Grism data analysis (placeholder)
└── templates/                  # Config templates (optional)

Usage

To use this configuration guide, refer to the detailed documentation files:

  • Data Configuration: data-config.md - Region, Images, Spectra, Atlas
  • Model Components: model-components/ - Galaxy, Profile, Nuclei/AGN, Foreground Star
  • Parameter Constraints: constraints/ - Parameter files, MSR, MMR, SFH, AGN, priors
  • Configuration Examples: examples/ - Multi-band, SED-only, spectrum fitting
  • Running GalfitS: running-galfits.md - Command-line options, fitting methods

Model Components Quick Links

Constraints Quick Links


Skills Info
Original Name:galfits-manualAuthor:weinaike