In [1]:
import escape as esc

esc.require("0.9.8")
import numpy as np
Loading material database from /home/dkor/Data/Development/workspace_escape/escape-core/python/src/escape/scattering/../data/mdb/materials.db

Peak functors¶

The following peak functors are available:

Pseudo-Voigt Peaks¶

A combination of Gaussian and Lorentzian profiles controlled by mixing parameter η

  • pvoigt: Height-normalized pseudo-Voigt peak

    • $f(x) = η \cdot L(x) + (1-η) \cdot G(x)$ where $L(x)$ is Lorentzian and $G(x)$ is Gaussian profile
  • apvoigt: Area-normalized pseudo-Voigt peak

    • $f(x) = \frac{A}{\int [η \cdot L(x) + (1-η) \cdot G(x)] dx} \cdot [η \cdot L(x) + (1-η) \cdot G(x)]$

Gaussian Peaks¶

Standard normal distribution shape

  • gaussian: Height-normalized Gaussian

    • $f(x) = h \exp\left(-4\ln(2)\frac{(x-x_0)^2}{w^2}\right)$
  • agaussian: Area-normalized Gaussian

    • $f(x) = \frac{A}{w\sqrt{\pi/(4\ln(2))}} \exp\left(-4\ln(2)\frac{(x-x_0)^2}{w^2}\right)$
  • split_gaussian: Asymmetric Gaussian with different widths

    • $f(x) = h \exp\left(-4\ln(2)\frac{(x-x_0)^2}{w_L^2}\right)$ for $x < x_0$
    • $f(x) = h \exp\left(-4\ln(2)\frac{(x-x_0)^2}{w_R^2}\right)$ for $x \geq x_0$

Lorentzian Peaks¶

Cauchy distribution with broader tails than Gaussian

  • lorentzian: Height-normalized Lorentzian

    • $f(x) = \frac{h}{1 + 4\left(\frac{x-x_0}{w}\right)^2}$
  • alorentzian: Area-normalized Lorentzian

    • $f(x) = \frac{2A}{\pi w \left[1 + 4\left(\frac{x-x_0}{w}\right)^2\right]}$

Pearson VII Peaks¶

Flexible peak shape that can vary between Gaussian and Lorentzian

  • pearson7: Height-normalized Pearson VII
    • $f(x) = \frac{h}{\left[1 + 4\left(\frac{x-x_0}{w}\right)^2\right]^m}$

where:

  • $h$ is peak height
  • $A$ is integrated area
  • $x_0$ is peak center
  • $w$ is full width at half maximum (FWHM)
  • $η$ is pseudo-Voigt mixing parameter (0 ≤ η ≤ 1)
  • $m$ is Pearson VII shape parameter
  • $w_L$, $w_R$ are left/right FWHM for split Gaussian
In [2]:
# Create x values for plotting
x = np.linspace(-10, 10, 1000)
X = esc.var("X")

# Create parameters for peaks
area = esc.par("area", 1.0)
height = esc.par("height", 1.0)
center = esc.par("center", 0.0, userlim=[-3, 3])
fwhm = esc.par("fwhm", 1.0)
eta = esc.par("eta", 0.5)  # Mixing parameter between Gaussian and Lorentzian

# Create height-normalized pseudo-Voigt peak
pvoigt_peak = esc.pvoigt("pvoigt", X, height, center, fwhm, eta)

# Create area-normalized pseudo-Voigt peak
apvoigt_peak = esc.apvoigt("apvoigt", X, area, center, fwhm, eta)

w1 = pvoigt_peak.show()
w2 = apvoigt_peak.show()

esc.show(w1, w2)
Out[2]:
In [3]:
# Create height-normalized Gaussian peak
gaussian_peak = esc.gaussian("gaussian", X, height, center, fwhm)

# Create area-normalized Gaussian peak
agaussian_peak = esc.agaussian("agaussian", X, area, center, fwhm)

esc.show(gaussian_peak.show(), agaussian_peak.show())
Out[3]:
In [4]:
# Create parameters for split Gaussian
fwhm_left = esc.par("fwhm_left", 1.5)  # Width on left side
fwhm_right = esc.par("fwhm_right", 3.0)  # Width on right side

# Create split Gaussian peak with different widths on each side
split_gauss = esc.split_gaussian(
    "split_gaussian", X, height, center, fwhm_left, fwhm_right
)

split_gauss.show()
Out[4]:
In [5]:
# Create height-normalized Lorentzian peak
lorentzian_peak = esc.lorentzian("lorentzian", X, height, center, fwhm)

# Create area-normalized Lorentzian peak
alorentzian_peak = esc.alorentzian("alorentzian", X, area, center, fwhm)

esc.show(lorentzian_peak.show(), alorentzian_peak.show())
Out[5]:
In [6]:
# Create parameters for Pearson VII peaks
shape = esc.par("shape", 1.0)  # Shape parameter controlling peak tails

# Create height-normalized Pearson VII peak
pearson7_peak = esc.pearson7("pearson7", X, height, center, fwhm, shape)

pearson7_peak.show()
Out[6]:
In [ ]:
 
In [ ]:
 
In [ ]: