Skip to main content

TrueVoigt

Struct TrueVoigt 

Source
pub struct TrueVoigt;
Expand description

True Voigt profile (Gaussian ⊗ Lorentzian) via the Faddeeva function.

A · Re[w(z)] / Re[w(z₀)], with z = ((x−c) + iγ)/(σ√2) and z₀ = iγ/(σ√2), so amplitude is the peak height (A at x=c).

Parameters (in order): [amplitude, center, sigma, gamma]

  • sigma is the Gaussian standard deviation, gamma the Lorentzian HWHM. γ→0 ⇒ Gaussian; σ→0 ⇒ Lorentzian. Distinct from the voigt/pseudo_voigt key, which is the linear pseudo-Voigt approximation.

Trait Implementations§

Source§

impl Model for TrueVoigt

Source§

fn jacobian(&self, x: &[f64], params: &[f64]) -> Vec<f64>

Analytical Jacobian of the true Voigt profile.

Uses the Faddeeva derivative identity: dw(z)/dz = −2z·w(z) + 2i/√π, which gives (treating z_r and z_i as independent real parameters):

∂Re[w]/∂z_r = Re[dw/dz] = −2(z_r·w_r − z_i·w_i) ∂Re[w]/∂z_i = −Im[dw/dz] = 2(z_r·w_i + z_i·w_r) − 2/√π

where (w_r, w_i) = faddeeva_complex(z_r, z_i).

For the profile f = A·w_r / peak0 (with peak0 = Re[w(0, z_i)]):

∂f/∂A = w_r / peak0 ∂f/∂c = A / peak0 · dwr_dzr · (−inv) [∂z_r/∂c = −inv] ∂f/∂σ and ∂f/∂γ use the quotient rule because peak0 also changes.

§Accuracy note

The HAW approximation has ≈1e-6 accuracy; the Jacobian inherits that floor, so the self-consistency test uses tolerance 1e-5 (10× the default analytic budget). This is a justified relaxation, not a correctness gap.

Source§

fn eval(&self, x: &[f64], params: &[f64]) -> f64

Evaluate the model at coordinate x with the given params. Read more
Source§

fn jacobian_into(&self, x: &[f64], params: &[f64], out: &mut [f64])

Fill a pre-allocated slice with Jacobian values (one entry per parameter). Read more
Source§

fn param_names(&self) -> Vec<Cow<'static, str>>

Ordered parameter names, matching the layout expected by eval and jacobian. Read more
Source§

fn eval_slice_into(&self, xs: &[f64], params: &[f64], out: &mut [f64])

Batch evaluation of a 1-D model: fill out[i] = eval([xs[i]], params). Read more
Source§

fn jac_slice_into(&self, xs: &[f64], params: &[f64], out: &mut [f64])

Batch Jacobian for a 1-D model: fill out in row-major layout [i * params.len() + j] = d(model)/d(params[j]) at xs[i]. Read more
Source§

fn n_dims(&self) -> usize

Number of coordinate dimensions consumed from x. Defaults to 1.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.