Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
phase_unwrap_series.rs

1/// Removes discontinuities from a wrapping signal (e.g. phase or heading) by adding whole
2/// multiples of `period` whenever the step between consecutive samples exceeds half the
3/// period. Output length equals
4/// input length.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    conjure_object::private::DeriveWith
11)]
12#[serde(crate = "conjure_object::serde")]
13#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct PhaseUnwrapSeries {
17    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
18    #[serde(rename = "input")]
19    input: Box<super::NumericSeries>,
20    #[builder(custom(type = super::DoubleConstant, convert = Box::new))]
21    #[serde(rename = "period")]
22    period: Box<super::DoubleConstant>,
23}
24impl PhaseUnwrapSeries {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(input: super::NumericSeries, period: super::DoubleConstant) -> Self {
28        Self::builder().input(input).period(period).build()
29    }
30    #[inline]
31    pub fn input(&self) -> &super::NumericSeries {
32        &*self.input
33    }
34    /// The wrapping period of the signal (e.g. 2*pi for radians, 360 for degrees). A jump
35    /// between consecutive samples greater than `period/2` in magnitude is corrected by
36    /// adding/subtracting a whole multiple of `period`.
37    #[inline]
38    pub fn period(&self) -> &super::DoubleConstant {
39        &*self.period
40    }
41}