---
title: 'GaLight: Galaxy Light Profile Analysis'
url: https://www.emergentmind.com/topics/galaxy-shapes-of-light-galight
type: topic
---

# GaLight: Galaxy Light Profile Analysis

Galaxy Shapes of Light (galight) refers to methodologies and software—most notably the open-source Python package GaLight—for quantitative characterization of the two-dimensional light distributions of galaxies. This encompasses detailed photometric decomposition into multiple stellar structures (e.g., bulge, disk, bar) and point sources (e.g., active galactic nuclei). GaLight achieves model fitting through parametric light-profile modeling, with integral automation for source detection, PSF estimation, noise characterization, and robust parameter inference schemes. These approaches are foundational for analyzing massive extragalactic surveys and dissecting galaxy structure in optical and near-infrared images [2111.08721].

## 1. Mathematical Framework for Light Profile Modeling

The primary model for galaxy surface-brightness profiles in GaLight is the Sersic function:
$$
I(R) = A\, \exp\left[ -k \left( \left(\frac{R}{R_e}\right)^{1/n} - 1 \right) \right]
$$
where $I(R)$ is the intensity at elliptical radius $R$, $A$ is the amplitude at $R=R_e$, $R_e$ is the effective (half-light) radius (along the semi-major axis), $n$ is the Sersic index (with $n=1$ representing an exponential disk and $n=4$ the de Vaucouleurs profile), $q$ is the axis ratio $b/a$, and $k$ is defined such that $R_e$ encloses half the total flux as per Ciotti & Bertin (1999).

Point sources, such as quasars or stars, are modeled as scaled Point-Spread Functions:
$$
I_\mathrm{psf}(x, y) = A_\mathrm{psf} \cdot \mathrm{PSF}(x-x_0, y-y_0)
$$
with $A_\mathrm{psf}$ the total flux and $(x_0,y_0)$ the source centroid. Other analytic profiles supported include Gaussian2D, Moffat, power-law, pseudo-Jaffe, and chameleon functions, all using lenstronomy conventions [2111.08721].

Noise is modeled as:
$$
\sigma_i^2 = \sigma_\mathrm{bkg}^2 + |d_i/(t_\mathrm{exp}\, G_\mathrm{eff})|
$$
where $\sigma_\mathrm{bkg}$ is the background RMS, $d_i$ the observed count, $t_\mathrm{exp}$ the exposure time, and $G_\mathrm{eff}$ the effective gain.

## 2. Automated Workflow Components and Data Handling

GaLight incorporates modular automation to minimize manual intervention in large-scale photometric analysis:
- **Cutout Extraction:** Automatically detects all sources in the field of view (photutils.detect_sources), then sets the minimal cutout size to fully encompass all neighbors and prevent contamination from edge effects.
- **PSF-Star Search:** Identifies suitable PSF stars by locating local maxima, fitting 2D profiles to measure FWHM, and rejecting objects outside intensity or FWHM thresholds. The user may choose the sharpest PSF or synthesize an empirical PSF from several stars.
- **Noise Map Estimation:** Calculates the background RMS by masking detected sources and fitting a Gaussian to the residual sky histogram; per-pixel Poisson noise is then added.
- **Source Detection & Initial Parameter Guessing:** Each detected source’s position, ellipticity, orientation, and approximate size are extracted to define elliptical apertures, setting initial Sersic parameters. Users can mask or simultaneously fit neighboring objects for blended systems [2111.08721].

## 3. Model Fitting, Likelihood Formalism, and Parameter Inference

Model fitting utilizes lenstronomy’s forward-modeling likelihood:
$$
\log \mathcal{L} = -\frac{1}{2} \sum_{i} \left[ \frac{(d_i - m_i)^2}{\sigma_i^2} + \ln(2\pi \sigma_i^2) \right]
$$
where $d_i$ is the observed pixel value, $m_i$ is the model prediction, and $\sigma_i$ is the total error. Fitting is accomplished via a hybrid optimization and sampling scheme:
- Particle Swarm Optimization (PSO) for initial estimation of non-linear parameter modes.
- MCMC (emcee) for posterior sampling, yielding credible intervals; convergence diagnostics such as acceptance fractions ($\sim0.2$), and Gelman–Rubin statistics ($\hat{r}\approx1$) are reported.

Output products include best-fit images, residual maps, 1D surface-brightness profiles, and marginalized posterior distributions for all non-linear structural parameters. Parameters such as effective radii $R_e$, Sersic index $n$, axis ratio $q$, position angle $\theta$, and centroids $(x_0, y_0)$ are recovered with uncertainties (1$\sigma$) from the posterior samples. Linear factors $A$ and $A_\mathrm{psf}$ are analytically optimized in each iteration to increase computational efficiency and minimize parameter degeneracies [2111.08721].

## 4. Application Areas and Empirical Results

GaLight has demonstrated robust performance in a variety of contexts:
- **Quasar Host Decomposition:** Successful decomposition of HST/WFC3 imaging for $1<z<2$ quasar hosts, allowing isolation of stellar and AGN components [2111.08721].
- **Deep Wide-Field Surveys:** Structural parameter extraction for approximately 1.5 million galaxies in Subaru/HSC data, including dual AGN candidates and local AGN baselines.
- **Automated Processing:** Runtimes are typically $\sim$1–2 minutes for PSO minimization (100–200 iterations, 50–100 particles) and $\sim$5–10 minutes for MCMC (50 walkers, 500–1000 steps) per target on modern CPUs.
- **Parameter Reliability:** Empirical uncertainties are consistent with simulated and Monte Carlo evaluations for Sersic/disc- and bulge-like profiles (Sersic $n$ fits accurate to $\sigma_n\sim0.5$ for disks, $\sim1.5$ for spheroids under high S/N) [2111.08721].

Case studies have extended to both inactive and active galaxies, with all results reproducible via open-source code and detailed online documentation.

## 5. Relation to Isophotal and Morphological Analysis

Parametric modeling with GaLight complements traditional isophotal shape analysis, such as those performed using IRAF ellipse or non-parametric diagnostics:
- **Isophotal Shape Parameters:** Fourier decomposition of intensity along fitted isophotes enables quantification of deviations from pure ellipses, notably via $a_4/a$ (disky/boxy) and $a_3/a$ terms. Boxy isophotes ($a_4/a<0$) are associated with bright, merger-dominated spheroids, while disky isophotes ($a_4/a>0$) correspond to fainter, rotationally supported systems [1407.5120].
- **Morphological Classes and Sersic Index:** Empirical analysis finds a transition at Sersic $n\sim2$ between clumpy/multimodal (n<2) and compact spheroidal (n>2) systems, supporting structural inferences from parametric fits [1005.3006].
- **Ellipticity and Concentration:** Automated Sersic modeling recovers global ellipticity and half-light radii, while concentration indices and isophotal parameters offer non-parametric cross validation.

A synthesis of these methods allows for systematic study of radial variations in structural parameters, including the decoupling between inner spheroid and outer envelope formation history in early-type galaxies [1407.5120].

## 6. Software Architecture and Community Resources

GaLight is written in Python and leverages lenstronomy for image modeling and posterior sampling. Key modules include:
- `galight.data_process.DataProcess` for pre-processing, cutouts, and masking,
- `galight.fitting_specify.FittingSpecify` for model configuration and prior handling,
- `galight.fitting_process.FittingProcess` for execution of optimization and MCMC runs.

Dependencies are exclusively on standard astronomical and numerical Python libraries, including numpy, scipy, astropy, matplotlib, photutils, and lenstronomy (≥1.3.0, with PSF-uncertainty support from 1.9.0 onwards). The package is distributed under the MIT license, with source code, documentation, and example notebooks accessible at https://galight.readthedocs.io/en/latest/ [2111.08721].

Typical usage follows the workflow:
```python
from galight.data_process import DataProcess
dp = DataProcess(fits_image='science.fits', target_pos=(RA,Dec), zp=25.0, exptime=1200, gain=2.0)
dp.generate_target_materials()
dp.PSF = dp.find_PSF()
from galight.fitting_specify import FittingSpecify
fs = FittingSpecify(data_process=dp)
fs.prepare_fitting_seq(point_source_num=1)
from galight.fitting_process import FittingProcess
fp = FittingProcess(fs, savename='galight_test')
fp.run(algorithm_list=['PSO','MCMC'])
```

Direct linkage to visualization and residual analysis facilitates quality control and diagnostic inspection for large extragalactic datasets.

## 7. Context, Limitations, and Implications

GaLight and similar model-fitting pipelines provide scalable, reproducible frameworks for galaxy structural decomposition, essential for extragalactic astronomy, AGN-galaxy coevolution studies, and time-domain or cosmological analyses. However, systematic limitations remain:
- Model fidelity is inherently limited by the parametric forms chosen (e.g., single/broken Sersic, additional components) and by PSF errors.
- Asymmetry, clumpiness, and substructure are not directly constrained by simple Sersic models, motivating parallel use of non-parametric and isophotal analyses [1005.3006, 1407.5120].
- For faint, low-S/N, or poorly resolved sources, biases in recovered parameters remain significant, especially for components near the PSF scale.

A plausible implication is that advances such as deeper imaging (e.g., JWST), higher-quality PSFs, and integrated approaches combining model-based and isophotal/classification techniques will continue to refine understanding of the multi-scale structure and evolutionary history of galaxies. Further development and application of GaLight are anticipated as next-generation imaging surveys expand in depth and areal coverage [2111.08721].

Source: https://www.emergentmind.com/topics/galaxy-shapes-of-light-galight