pub struct DualPearson {
pub head_fraction: f64,
pub head: PearsonIv,
pub tail: PearsonIv,
}Expand description
A dual-Pearson profile R f_head + (1 - R) f_tail (Tasch et al. 1989).
Fields§
§head_fraction: f64Fraction R in the head component, in [0, 1].
head: PearsonIvHead component.
tail: PearsonIvTail component.
Implementations§
Source§impl DualPearson
impl DualPearson
Sourcepub fn moments(&self) -> (f64, f64, f64, f64)
pub fn moments(&self) -> (f64, f64, f64, f64)
Mean, standard deviation, skewness and kurtosis of the mixture, from the components’ moments.
Sourcepub fn fit(hist: &Histogram) -> Result<DualPearsonFit, PearsonError>
pub fn fit(hist: &Histogram) -> Result<DualPearsonFit, PearsonError>
Fit a dual-Pearson profile to a histogram (for example the depth histogram of stopped ions).
Method. The bins are rescaled to z = (x - μ) / σ with the mean
and standard deviation of the in-range bin centres. The nine
parameters are mapped to unconstrained variables (the logit of R;
for each component the mean, ln σ, atanh(γ/4) and
ln(β - β_IV(γ))), so every trial point is a valid pair of Pearson IV
densities with |γ| < 4. The objective is the Neyman chi-square
Σ (c_i - N P_i)^2 / max(c_i, 1) over the in-range bins, with P_i
the model mass of bin i by three-point Gauss-Legendre quadrature and
N the histogram total (so mass outside the range counts against the
model). It is minimised by Nelder-Mead from two fixed starting points
(a head at the overall moments with R = 0.9, and a tail one standard
deviation deeper or shallower), each restarted once from its best
point, with a cap of 6000 evaluations per run. The lowest objective
wins; if the single Pearson IV from the histogram’s moments is better,
it is returned as a degenerate dual (R = 1, both components equal).
The result is a deterministic function of the histogram (no random numbers, fixed iteration order). It is a least-squares representation, not a unique decomposition: different parameter sets can describe the same profile almost equally well, and the split into “head” and “tail” is only physically meaningful when the histogram resolves it.
Trait Implementations§
Source§impl Clone for DualPearson
impl Clone for DualPearson
Source§fn clone(&self) -> DualPearson
fn clone(&self) -> DualPearson
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DualPearson
Source§impl Debug for DualPearson
impl Debug for DualPearson
Source§impl<'de> Deserialize<'de> for DualPearson
impl<'de> Deserialize<'de> for DualPearson
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DualPearson
impl PartialEq for DualPearson
Source§impl Serialize for DualPearson
impl Serialize for DualPearson
impl StructuralPartialEq for DualPearson
Auto Trait Implementations§
impl Freeze for DualPearson
impl RefUnwindSafe for DualPearson
impl Send for DualPearson
impl Sync for DualPearson
impl Unpin for DualPearson
impl UnsafeUnpin for DualPearson
impl UnwindSafe for DualPearson
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more