Lineshapes
Peak functions and other frequency/position-domain models.
Peak Functions
CurveFitModels.gaussian — Function
gaussian(p, x)Gaussian function with standard deviation parameterization.
Arguments
p: Parameters [A, x₀, σ] or [A, x₀, σ, y₀]A: Amplitudex₀: Center positionσ: Standard deviationy₀: Vertical offset (default: 0.0)
x: Independent variable
Use fwhm_to_sigma and sigma_to_fwhm to convert between σ and FWHM.
\[\begin{aligned} f(x) = A \exp\left(-\frac{(x - x_0)^2}{2\sigma^2}\right) + y_0 \end{aligned}\]
CurveFitModels.lorentzian — Function
lorentzian(p, x)Lorentzian (Cauchy) lineshape with FWHM parameterization.
Arguments
p: Parameters [A, x₀, Γ] or [A, x₀, Γ, y₀]A: Peak amplitude (value at x₀)x₀: Center positionΓ: Full width at half maximum (FWHM)y₀: Vertical offset (default: 0.0)
x: Independent variable
The integrated area is A × π × Γ / 2.
\[\begin{aligned} f(x) = \frac{A}{1 + \left(\frac{x - x_0}{\Gamma/2}\right)^2} + y_0 \end{aligned}\]
CurveFitModels.pseudo_voigt — Function
pseudo_voigt(p, ω)Pseudo-Voigt profile: a linear combination of area-normalized Gaussian and Lorentzian functions.
Note: Unlike gaussian and lorentzian which use peak-amplitude parameterization, pseudo_voigt uses area-normalized components. The parameter f₀ scales the total area, not the peak height.
Arguments
p: Parameters [f₀, ω₀, σ, α]f₀: Area scaling factorω₀: Center positionσ: Width parameter (HWHM for Lorentzian component)α: Mixing parameter (0 = pure Gaussian, 1 = pure Lorentzian)
ω: Independent variable (frequency)
\[\begin{aligned} f(\omega) = (1-\alpha) G(\omega) + \alpha L(\omega) \end{aligned}\]
where G and L are normalized Gaussian and Lorentzian functions.
Other Lineshapes
CurveFitModels.power_law — Function
power_law(p, x)Power law function for curve fitting.
Arguments
p: Parameters [A, n] or [A, n, y₀]A: Amplitude (prefactor)n: Exponenty₀: Vertical offset (default: 0.0)
x: Independent variable
\[\begin{aligned} f(x) = A x^n + y_0 \end{aligned}\]
CurveFitModels.logistic — Function
logistic(p, x)Logistic (sigmoid) function for curve fitting.
Arguments
p: Parameters [L, k, x₀] or [L, k, x₀, y₀]L: Maximum value (supremum of the curve)k: Steepness of the curvex₀: Midpoint (x-value of the sigmoid's center)y₀: Vertical offset (default: 0.0)
x: Independent variable
\[\begin{aligned} f(x) = \frac{L}{1 + e^{-k(x - x_0)}} + y_0 \end{aligned}\]
CurveFitModels.gaussian2d — Function
gaussian2d(p, coords)Two-dimensional Gaussian function for curve fitting.
Arguments
p: Parameters [A, x₀, σx, y₀, σy] or [A, x₀, σx, y₀, σy, z₀]A: Amplitudex₀: Center x-positionσ_x: Standard deviation in xy₀: Center y-positionσ_y: Standard deviation in yz₀: Vertical offset (default: 0.0)
coords: Tuple of (X, Y) coordinate matrices (from meshgrid) or matrix where each row is [x, y]
Returns a vector (flattened) for compatibility with CurveFit.jl.
\[\begin{aligned} f(x, y) = A \exp\left(-\frac{(x - x_0)^2}{2\sigma_x^2} - \frac{(y - y_0)^2}{2\sigma_y^2}\right) + z_0 \end{aligned}\]
https://en.wikipedia.org/wiki/Gaussianfunction#Two-dimensionalGaussian_function
Oscillator Models
Complex susceptibility functions for modeling dielectric response.
CurveFitModels.lorentz_oscillator — Function
lorentz_oscillator(p, ν)Complex Lorentzian susceptibility function (Lorentz oscillator model).
Arguments
p: Parameters [A, ν₀, Γ]A: Oscillator strengthν₀: Resonance frequencyΓ: Linewidth (damping)
ν: Frequency (independent variable)
\[\begin{aligned} \chi(\nu) = \frac{A}{\nu_0^2 - \nu^2 - i\Gamma\nu} \end{aligned}\]
The real and imaginary parts are dielectric_real and dielectric_imag, respectively.
CurveFitModels.dielectric_real — Function
dielectric_real(p, ν)Real part of complex Lorentzian susceptibility (Lorentz oscillator model).
This is equivalent to real(lorentz_oscillator(p, ν)).
Arguments
p: Parameters [A, ν₀, Γ]A: Oscillator strengthν₀: Resonance frequencyΓ: Linewidth (damping)
ν: Frequency (independent variable)
\[\begin{aligned} \chi_1(\nu) = \text{Re}\left[\frac{A}{\nu_0^2 - \nu^2 - i\Gamma\nu}\right] = \frac{A (\nu_0^2 - \nu^2)}{(\nu_0^2 - \nu^2)^2 + (\Gamma\nu)^2} \end{aligned}\]
CurveFitModels.dielectric_imag — Function
dielectric_imag(p, ν)Imaginary part of complex Lorentzian susceptibility (Lorentz oscillator model).
This is equivalent to imag(lorentz_oscillator(p, ν)).
Arguments
p: Parameters [A, ν₀, Γ]A: Oscillator strengthν₀: Resonance frequencyΓ: Linewidth (damping)
ν: Frequency (independent variable)
\[\begin{aligned} \chi_2(\nu) = \text{Im}\left[\frac{A}{\nu_0^2 - \nu^2 - i\Gamma\nu}\right] = \frac{A \Gamma \nu}{(\nu_0^2 - \nu^2)^2 + (\Gamma\nu)^2} \end{aligned}\]
Helper Functions
CurveFitModels.sigma_to_fwhm — Function
sigma_to_fwhm(σ)Convert Gaussian standard deviation to full width at half maximum.
FWHM = 2√(2ln2) × σ ≈ 2.355 × σ
CurveFitModels.fwhm_to_sigma — Function
fwhm_to_sigma(fwhm)Convert full width at half maximum to Gaussian standard deviation.
σ = FWHM / 2√(2ln2) ≈ FWHM / 2.355
CurveFitModels.gaussian_area — Function
gaussian_area(A, σ)Calculate the integrated area under a Gaussian with peak amplitude A and standard deviation σ.
Area = A × σ × √(2π)
CurveFitModels.lorentzian_area — Function
lorentzian_area(A, Γ)Calculate the integrated area under a Lorentzian with peak amplitude A and FWHM Γ.
Area = A × π × Γ / 2