Skip to main content

FitWidget

Struct FitWidget 

Source
pub struct FitWidget { /* private fields */ }
Expand description

A window widget to perform curve fitting on 1D data and display the result.

Implementations§

Source§

impl FitWidget

Source

pub fn new(render_state: &RenderState, plot_id: PlotId) -> Self

Create a new FitWidget with a backing Plot1D.

Source

pub fn set_fit_range(&mut self, range: Option<(f64, f64)>)

Set the fit range [xmin, xmax]; only points inside it are fitted (silx FitWidget xmin/xmax). Pass None to fit the whole curve.

Source

pub fn selected_choice(&self) -> FitModelChoice

The currently selected fit model choice.

Source

pub fn set_selected_choice(&mut self, choice: FitModelChoice)

Set the selected fit model choice.

Source

pub fn fit_background(&self) -> Background

The background theory subtracted before an iterative peak fit (silx FitWidget background combo).

Source

pub fn set_fit_background(&mut self, background: Background)

Set the background theory subtracted before an iterative peak fit. The analytical Linear / Gaussian-estimate choices ignore it; iterative peak models fit the background-subtracted residual and display the reconstructed total curve.

Source

pub fn param_constraints(&self) -> &[Constraint]

The per-parameter constraints applied to the current single-peak model (silx FitWidget parameter table). Empty until first synced.

Source

pub fn set_param_constraints(&mut self, constraints: Vec<Constraint>)

Set the per-parameter constraints for the current single-peak model. The vector is resynced to all-Free if its length stops matching the selected model’s parameter count.

Source

pub fn initial_params(&self) -> Option<&[f64]>

The editable initial parameters for the current single-peak model, once a fit has populated them (silx FitWidget parameter table value column).

Source

pub fn set_initial_params(&mut self, params: Option<Vec<f64>>)

Set the initial parameters the next single-peak fit starts from. Dropped if the length stops matching the selected model’s parameter count.

Source

pub fn iterative_result(&self) -> Option<&IterativeFitResult>

The most recent iterative-fit result (covariance / chi-square), if the last successful fit used an iterative peak model.

Source

pub fn is_open(&self) -> bool

Is the window currently open?

Source

pub fn set_open(&mut self, open: bool)

Open or close the window.

Source

pub fn set_data(&mut self, x: &[f64], y: &[f64])

Set the data to fit.

Source

pub fn perform_fit_choice(&mut self)

Perform the fit using the currently selected FitModelChoice.

Iterative peak models are refined with Levenberg-Marquardt and populate the results table (per-parameter error + reduced chi-square); the analytical Linear / Gaussian-estimate choices keep their original behaviour. Honors the configured fit range.

Source

pub fn perform_fit(&mut self)

Perform the fit using the currently selected function.

Source

pub fn show(&mut self, ctx: &Context)

Show the fit widget using the given egui context.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,