General Functions

Common functions and lineshapes for spectroscopy.

Models.exponentialFunction
exponential(x, p = [f_0, τ])

Exponential decay function with amplitude $f_0$, and decay constant τ.

\[\begin{aligned} f(x; f_0, \tau) = f_0 e^{-x / \tau} \end{aligned}\]

Exponential decay

source
Models.findpeaksMethod
localmax(y::AbstractVector; height = 0.0)

Find the local maxima of a vector and return their indices. Optionally, a subset of peaks can be selected by specifying peak properties.

source
Models.gaussianFunction
gaussian(x, p = [A, μ, σ])

Gaussian function with amplitude $A$, center $μ$, and width $σ$.

\[\begin{aligned} f(x; A, \mu, \sigma) = \frac{A}{\sigma \sqrt{2\pi}} e^{-(x - \mu)^2 / (2 \sigma^2)} \end{aligned}\]

Gaussian function

source
Models.gaussian2dFunction
gaussian2d(x, y, p = [A, x_0, σ_x, y_0, σ_y])

Two-dimensional Gaussian function centered at $(x_0, y_0)$ and x-width $σ_x$ and y-width $σ_y$, and amplitude $A$.

\[\begin{aligned} f(x, y; A, x_0, \sigma_x, y_0, \sigma_y) = A \exp\left(-\left( \frac{(x - x_0)^2}{2 \sigma_x^2} + \frac{(y - y_0)^2}{2 \sigma_y^2} \right)\right) \end{aligned}\]

Two-dimensional Gaussian function

source
Models.pseudo_voigtMethod
pseudo_voigt(ω, p)

Weighted sum of a Lorentzian and a Gaussian function with the same center ω_0 and amplitude f_0.

p = [f0, ω0, σ, α]

source
Models.squared_errorsMethod
squared_errors(p, f, X, Y)

Takes a function, f, and its parameters, p and sums the squared errors given x-data and y-data X and Y, respectively.

\[\begin{aligned} \text{err} = \sum_{i=1}^{n} \left( Y_i(X) - \hat{Y}_i \right)^2 \end{aligned}\]

source