Struct light_curve_feature::features::VillarFit

source ·
pub struct VillarFit { /* private fields */ }
Expand description

Villar function fit

Seven fit parameters and goodness of fit (reduced $\chi^2$) of the Villar function developed for supernovae classification:

$$ f(t) = c + \frac{A}{ 1 + \exp{\frac{-(t - t_0)}{\tau_\mathrm{rise}}}} \left\{ \begin{array}{ll} 1 - \frac{\nu (t - t_0)}{\gamma}, &t < t_0 + \gamma \\ (1 - \nu) \exp{\frac{-(t-t_0-\gamma)}{\tau_\mathrm{fall}}}, &t \geq t_0 + \gamma \end{array} \right. $$ where $A, \gamma, \tau_\mathrm{rise}, \tau_\mathrm{fall} > 0$, $\nu \in [0; 1)$.

Here we introduce a new dimensionless parameter $\nu$ instead of the plateau slope $\beta$ from the orioginal paper: $\nu \equiv -\beta \gamma / A$.

Note, that the Villar function is developed to be used with fluxes, not magnitudes.

  • Depends on: time, magnitude, magnitude error
  • Minimum number of observations: 8
  • Number of features: 8

Villar et al. 2019 DOI:10.3847/1538-4357/ab418c

Implementations§

source§

impl VillarFit

source

pub fn new<VLP>( algorithm: CurveFitAlgorithm, ln_prior: VLP, inits_bounds: VillarInitsBounds ) -> Self
where VLP: Into<VillarLnPrior>,

New VillarFit instance

algorithm specifies which optimization method is used, it is an instance of the CurveFitAlgorithm, currently supported algorithms are MCMC and LMSDER (a Levenberg–Marquard algorithm modification, requires gsl Cargo feature).

ln_prior is an instance of LnPrior and specifies the natural logarithm of the prior to use. Some curve-fit algorithms doesn’t support this and ignores the prior

source

pub fn default_algorithm() -> CurveFitAlgorithm

Default McmcCurveFit for VillarFit

source

pub fn default_ln_prior() -> VillarLnPrior

source

pub fn default_inits_bounds() -> VillarInitsBounds

source

pub const fn doc() -> &'static str

Trait Implementations§

source§

impl Clone for VillarFit

source§

fn clone(&self) -> VillarFit

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VillarFit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for VillarFit

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for VillarFit

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl EvaluatorInfoTrait for VillarFit

source§

fn get_info(&self) -> &EvaluatorInfo

Get feature evaluator meta-information
source§

fn size_hint(&self) -> usize

Size of vectors returned by eval(), get_names() and get_descriptions()
source§

fn min_ts_length(&self) -> usize

Minimum time series length required to successfully evaluate feature
source§

fn is_t_required(&self) -> bool

If time array used by the feature
source§

fn is_m_required(&self) -> bool

If magnitude array is used by the feature
source§

fn is_w_required(&self) -> bool

If weight array is used by the feature
source§

fn is_sorting_required(&self) -> bool

If feature requires time-sorting on the input TimeSeries
source§

impl<T> FeatureEvaluator<T> for VillarFit
where T: Float,

source§

fn eval(&self, ts: &mut TimeSeries<'_, T>) -> Result<Vec<T>, EvaluatorError>

Vector of feature values or EvaluatorError
source§

fn eval_or_fill(&self, ts: &mut TimeSeries<'_, T>, fill_value: T) -> Vec<T>

Returns vector of feature values and fill invalid components with given value
source§

fn check_ts_length( &self, ts: &TimeSeries<'_, T> ) -> Result<usize, EvaluatorError>

Checks if TimeSeries has enough points to evaluate the feature
source§

impl FeatureNamesDescriptionsTrait for VillarFit

source§

fn get_names(&self) -> Vec<&str>

Vector of feature names. The length and feature order corresponds to eval() output
source§

fn get_descriptions(&self) -> Vec<&str>

Vector of feature descriptions. The length and feature order corresponds to eval() output
source§

impl<T> FitDerivalivesTrait<T, NPARAMS> for VillarFit
where T: Float,

source§

fn derivatives(t: T, param: &[T; 7], jac: &mut [T; 7])

source§

impl FitFeatureEvaluatorGettersTrait<NPARAMS> for VillarFit

source§

fn get_algorithm(&self) -> &CurveFitAlgorithm

source§

fn ln_prior_from_ts<T: Float>( &self, ts: &mut TimeSeries<'_, T> ) -> LnPrior<NPARAMS>

source§

impl<T> FitFunctionTrait<T, NPARAMS> for VillarFit
where T: Float,

source§

fn f(t: T, values: &[T]) -> T

source§

impl<T> FitInitsBoundsTrait<T, NPARAMS> for VillarFit
where T: Float,

source§

fn init_and_bounds_from_ts( &self, ts: &mut TimeSeries<'_, T> ) -> FitInitsBoundsArrays<NPARAMS>

source§

impl<T, U> FitModelTrait<T, U, NPARAMS> for VillarFit
where T: Float + Into<U>, U: LikeFloat,

source§

fn model(t: T, param: &[U; 7]) -> U

source§

impl<U> FitParametersInternalDimlessTrait<U, NPARAMS> for VillarFit
where U: LikeFloat,

source§

impl FitParametersInternalExternalTrait<NPARAMS> for VillarFit

source§

fn convert_to_internal( norm_data: &NormalizedData<f64>, orig: &[f64; NPARAMS] ) -> [f64; NPARAMS]

source§

fn convert_to_external( norm_data: &NormalizedData<f64>, params: &[f64; NPARAMS] ) -> [f64; NPARAMS]

source§

impl FitParametersOriginalDimLessTrait<NPARAMS> for VillarFit

source§

fn orig_to_dimensionless( norm_data: &NormalizedData<f64>, orig: &[f64; 7] ) -> [f64; 7]

source§

fn dimensionless_to_orig( norm_data: &NormalizedData<f64>, norm: &[f64; 7] ) -> [f64; 7]

source§

impl<T> From<VillarFit> for Feature<T>
where T: Float,

source§

fn from(v: VillarFit) -> Feature<T>

Converts to this type from the input type.
source§

impl JsonSchema for VillarFit

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl Serialize for VillarFit

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> TryInto<VillarFit> for Feature<T>
where T: Float,

§

type Error = &'static str

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

fn try_into(self) -> Result<VillarFit, <Self as TryInto<VillarFit>>::Error>

Performs the conversion.

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<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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, Dst> ConvAsUtil<Dst> for T

source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
source§

impl<T> ConvUtil for T

source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
source§

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

§

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<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
source§

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

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,