galfits.profiles
Structural Profile Functions Module
This module provides implementations of various 2D surface brightness profiles used in galaxy modeling, including Sersic, exponential, Ferrer, edge-on disks, Gaussian rings, and Fourier-mode perturbations for spiral structure.
All functions are JAX-compatible for automatic differentiation and GPU acceleration.
Supported Profiles
Sersic: Generalized Sersic profile with arbitrary index n
Ferrer: Truncated profile for bars and rings
Edge-on disk: Vertical structure for edge-on galaxies
Gaussian ring: Ring-like structures (resonance rings)
Fourier modes: Spiral arms and non-axisymmetric features
Broken/Ring variants: Truncated and ring-like modifications
PSF: Point spread function modeling
Key Functions
sersic2D : 2D Sersic profile
Ferrer : Ferrer (truncated) profile
EdgeonDisk : Edge-on disk with vertical structure
GaussianRing : Gaussian ring profile
sersic2D_fourier : Sersic + Fourier spiral modes
R_3d : 3D deprojected radius calculation
R_fourier : Fourier-mode perturbations
Geometric Utilities
R_2d, R_3d : 2D and 3D radius calculations
xy_3d : Deproject coordinates accounting for inclination
xpyp : Rotate coordinates by position angle
alpha_tanh, hypotan : Smooth transition functions
All angles are in radians internally. Profiles return normalized surface brightness or can be scaled by total flux/mass normalization.
- galfits.profiles.EdgeonDisk(x, y, imnx, imny, PA, rs, hs, L)[source]
Edge-on exponential disk with vertical structure.
Models edge-on disk galaxies with exponential radial decline and sech²(z/hs) vertical profile. Uses modified Bessel function \(K_1\) for proper radiative transfer in edge-on geometry.
- Parameters:
x (float) – Center position in pixels.
y (float) – Center position in pixels.
imnx (int) – Image dimensions (width, height) in pixels.
imny (int) – Image dimensions (width, height) in pixels.
PA (float) – Position angle in radians.
rs (float) – Radial scale length in pixels.
hs (float) – Vertical scale height in pixels. Typical rs/hs ~ 5-10 for disk galaxies.
L (float) – Total integrated luminosity.
- Returns:
2D surface brightness map.
- Return type:
array_like, shape (imny, imnx)
Notes
Edge-on disk formula:
\[I(r,z) \propto \frac{r}{r_s} K_1\left(\frac{r}{r_s}\right) {\rm sech}^2\left(\frac{z}{h_s}\right)\]where \(K_1\) is modified Bessel function of second kind.
See also
sersic2DFor face-on or moderately inclined disks
References
van der Kruit & Searle 1981, A&A, 95, 105
- galfits.profiles.Ferrer(x, y, imnx, imny, axrat, PA, R_out, a, beta, L)[source]
Ferrer (truncated power-law) profile for bars and tidal features.
Models sharply truncated structures with flexible shape control.
- Parameters:
x (float) – Center position in pixels.
y (float) – Center position in pixels.
imnx (int) – Image dimensions (width, height) in pixels.
imny (int) – Image dimensions (width, height) in pixels.
axrat (float) – Axis ratio q = b/a (minor/major axis). Range (0, 1].
PA (float) – Position angle in radians.
R_out (float) – Outer truncation radius in pixels.
a (float) – Central concentration parameter (typical: 2-4).
beta (float) – Edge sharpness (typical: 0-2). \(\beta=0\) gives steepest edge.
L (float) – Total integrated luminosity.
- Returns:
2D surface brightness map.
- Return type:
array_like, shape (imny, imnx)
Notes
Ferrer profile formula:
\[I(R) \propto \left[1 - \left(\frac{R}{R_{\rm out}}\right)^{2-\beta}\right]^a\]for \(R < R_{\rm out}\), and \(I(R) = 0\) otherwise.
Common for modeling galactic bars, tidal tails, and shells. Smooth tanh transition prevents numerical issues at boundary.
References
Ferrer et al. 2012, A&A, 545, A59
- galfits.profiles.Ferrer_fourier(x, y, imnx, imny, axrat, PA, R_out, a, beta, L, r_in, r_out, alpha_rc, theta_out, m, am, theta_m, i_arm)[source]
- galfits.profiles.GaussianRing(x, y, imnx, imny, axrat, PA, r0, Sig, L)[source]
Narrow Gaussian ring profile.
I(R) ∝ exp[-(R-r0)²/(2σ²)]. Models narrow ring structures like Einstein rings, resonance rings, or circular shell features.
Parameters (in addition to standard x, y, imnx, imny, axrat, PA, L)
- r0float
Ring radius in pixels.
- Sigfloat
Ring width (σ of Gaussian) in pixels.
Notes
For broader rings with Sérsic-like profiles, use sersic2D_ring instead.
- galfits.profiles.GaussianRing_fourier(x, y, imnx, imny, axrat, PA, r0, Sig, L, r_in, r_out, alpha_rc, theta_out, m, am, theta_m, i_arm)[source]
- galfits.profiles.R_3d_fourier(x_p, y_p, PA, i, r_in, r_out, alpha_rc, theta_out, m, am, theta_m, i_arm)[source]
- galfits.profiles.sersic2D(x, y, imnx, imny, axrat, PA, Re, n, L)[source]
Generate 2D Sérsic surface brightness profile.
Creates elliptical Sérsic profile I(R) ∝ exp(-(R/Re)^(1/n)) for modeling bulges, disks, and other galaxy components. JIT-compiled for performance.
- Parameters:
x (float) – Center position in pixels (can be sub-pixel).
y (float) – Center position in pixels (can be sub-pixel).
imnx (int) – Image dimensions (width, height) in pixels. Static arguments for JIT compilation.
imny (int) – Image dimensions (width, height) in pixels. Static arguments for JIT compilation.
axrat (float) – Axis ratio q = b/a (minor/major axis). Range (0, 1]. q = 1 for circular, q → 0 for edge-on disk.
PA (float) – Position angle in radians (measured counter-clockwise from +x axis).
Re (float) – Effective (half-light) radius in pixels. Contains half the total luminosity.
n (float) –
Sérsic index controlling concentration.
n = 0.5: Gaussian profile
n = 1: Exponential disk
n = 4: de Vaucouleurs bulge
n > 4: Concentrated bulge/elliptical
L (float) – Total integrated luminosity (arbitrary units).
- Returns:
2D surface brightness map in flux units (not mag/arcsec^2).
- Return type:
array_like, shape (imny, imnx)
Notes
Sérsic profile formula:
\[I(R) = I_e \exp\left(-b_n\left[\left(\frac{R}{R_e}\right)^{1/n} - 1\right]\right)\]where \(b_n \approx 2n - 1/3\) ensures \(R_e\) encloses half the light.
The deprojected radius \(R\) accounts for ellipticity and inclination:
\[R^2 = x'^2 + (y'/q)^2\]where \((x', y')\) are rotated by PA and \(q\) = axis ratio.
Oversampling: If global oversample > 0, central pixel is sub-sampled for accurate peak flux (important for PSF convolution).
Special cases:
Exponential disk (n=1): \(I(R) \propto \exp(-R/h)\) with \(h = R_e/1.678\)
de Vaucouleurs (n=4): \(I(R) \propto \exp(-(R/R_e)^{1/4})\)
See also
sersic1D1D radial profile
sersic2D_brokenSérsic with truncation
sersic2D_ringSérsic with inner hole
FerrerTruncated profile for tidal features
Examples
>>> # Exponential disk >>> disk = sersic2D(x=50.0, y=50.0, imnx=100, imny=100, ... axrat=0.6, PA=jnp.pi/4, Re=15.0, n=1.0, L=100.0)
>>> # de Vaucouleurs bulge >>> bulge = sersic2D(x=50.0, y=50.0, imnx=100, imny=100, ... axrat=0.9, PA=0.0, Re=5.0, n=4.0, L=50.0)
References
- galfits.profiles.sersic2D_broken(x, y, imnx, imny, axrat, PA, Re, n, L, Rout)[source]
Sérsic profile with smooth outer truncation.
Same as sersic2D but with smooth exponential cutoff at Rout using tanh transition. Useful for modeling truncated disks or tidally stripped galaxies.
Additional Parameters
- Routfloat
Truncation radius in pixels. Flux smoothly drops to zero beyond Rout.
- galfits.profiles.sersic2D_brokenfourier(x, y, imnx, imny, axrat, PA, Re, n, L, r_in, r_out, alpha_rc, theta_out, m, am, theta_m, i_arm)[source]
Re,n: control the mass distribution of the arms i, PA galaxy projection r_in, r_out, alpha_rc, theta_out: rotation curve m, am, theta_m, i_arm: arm number, relative strength
- galfits.profiles.sersic2D_fourier(x, y, imnx, imny, axrat, PA, Re, n, L, r_in, r_out, alpha_rc, theta_out, m, am, theta_m, i_arm)[source]
Sérsic profile with Fourier-mode spiral arms.
Models spiral galaxies by modulating base Sérsic profile with cos(mφ) terms.
- Parameters:
x (standard Sérsic parameters) – See sersic2D documentation.
y (standard Sérsic parameters) – See sersic2D documentation.
imnx (standard Sérsic parameters) – See sersic2D documentation.
imny (standard Sérsic parameters) – See sersic2D documentation.
axrat (standard Sérsic parameters) – See sersic2D documentation.
PA (standard Sérsic parameters) – See sersic2D documentation.
Re (standard Sérsic parameters) – See sersic2D documentation.
n (standard Sérsic parameters) – See sersic2D documentation.
L (standard Sérsic parameters) – See sersic2D documentation.
r_in (float) – Inner radius where spiral pattern starts (pixels).
r_out (float) – Outer radius where spiral pattern ends (pixels).
alpha_rc (float) – Rotation curve power-law index (affects arm winding).
theta_out (float) – Azimuthal phase at r_out (controls arm pitch angle).
m (int) – Number of spiral arms (m=2 for grand-design, m>2 for multi-arm).
am (float) – Relative arm amplitude (0.1-0.5 typical). Larger = more prominent arms.
theta_m (float) – Phase offset of spiral pattern (radians).
i_arm (float) – Inclination of spiral plane (radians). Use for tilted spirals.
- Returns:
2D surface brightness map with spiral structure.
- Return type:
array_like, shape (imny, imnx)
Notes
Spiral modulation formula:
\[R_{\rm spiral} = R \times \left[1 + a_m \cos(m(\phi + \theta_m))\right]\]Logarithmic spiral pitch angle \(\approx \arctan(1/m)\). Grand-design spirals (m=2) have shallow pitch (~10-20°), multi-arm spirals (m>2) are tighter.
See also
sersic2DBase profile without spiral structure
References
Rix & Zaritsky 1995, ApJ, 447, 82
- galfits.profiles.sersic2D_ring(x, y, imnx, imny, axrat, PA, Re, n, L, Rin, width)[source]
Sérsic profile with inner hole (ring/shell morphology).
Models ring galaxies, shell structures, or centrally depleted systems. Flux smoothly suppressed inside Rin with transition width controlled by width parameter.
Additional Parameters
- Rinfloat
Inner hole radius in pixels.
- widthfloat
Transition width as fraction of Rin (0 = sharp, 0.1 = smooth).
See also
GaussianRingPure ring with Gaussian radial profile
- galfits.profiles.sersic2D_ringfourier(x, y, imnx, imny, axrat, PA, Re, n, L, r_in, r_out, alpha_rc, theta_out, m, am, theta_m, i_arm)[source]
Re,n: control the mass distribution of the arms i, PA galaxy projection r_in, r_out, alpha_rc, theta_out: rotation curve m, am, theta_m, i_arm: arm number, relative strength