Skip to main content

nominal_api/conjure/objects/scout/compute/api/
time_series_curve_fit.rs

1/// Fits a curve to a series vs its timestamps.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct TimeSeriesCurveFit {
14    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
15    #[serde(rename = "series")]
16    series: Box<super::NumericSeries>,
17    #[builder(custom(type = super::TimeSeriesFitOptions, convert = Box::new))]
18    #[serde(rename = "options")]
19    options: Box<super::TimeSeriesFitOptions>,
20}
21impl TimeSeriesCurveFit {
22    /// Constructs a new instance of the type.
23    #[inline]
24    pub fn new(
25        series: super::NumericSeries,
26        options: super::TimeSeriesFitOptions,
27    ) -> Self {
28        Self::builder().series(series).options(options).build()
29    }
30    /// The series to fit. Timestamps will be used as x values and data as y values. The leftmost (earliest)
31    /// timestamp will be used as the value of 0, and all other timestamps will be relative to that.
32    #[inline]
33    pub fn series(&self) -> &super::NumericSeries {
34        &*self.series
35    }
36    #[inline]
37    pub fn options(&self) -> &super::TimeSeriesFitOptions {
38        &*self.options
39    }
40}