Skip to main content

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

1/// Returns the cross-spectral density magnitude and phase of the two input series.
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 Cpsd {
14    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
15    #[serde(rename = "x")]
16    x: Box<super::NumericSeries>,
17    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
18    #[serde(rename = "y")]
19    y: Box<super::NumericSeries>,
20    #[builder(
21        default,
22        custom(
23            type = impl
24            Into<Option<super::StftOptions>>,
25            convert = |v|v.into().map(Box::new)
26        )
27    )]
28    #[serde(rename = "stftOptions", skip_serializing_if = "Option::is_none", default)]
29    stft_options: Option<Box<super::StftOptions>>,
30    #[builder(default, into)]
31    #[serde(
32        rename = "magnitudeScaling",
33        skip_serializing_if = "Option::is_none",
34        default
35    )]
36    magnitude_scaling: Option<super::MagnitudeScaling>,
37    #[builder(default, into)]
38    #[serde(
39        rename = "outputFrequencyType",
40        skip_serializing_if = "Option::is_none",
41        default
42    )]
43    output_frequency_type: Option<super::OutputFrequencyType>,
44    #[builder(default, into)]
45    #[serde(rename = "unwrapPhase", skip_serializing_if = "Option::is_none", default)]
46    unwrap_phase: Option<bool>,
47    #[builder(default, into)]
48    #[serde(
49        rename = "outputPhaseUnit",
50        skip_serializing_if = "Option::is_none",
51        default
52    )]
53    output_phase_unit: Option<super::OutputPhaseUnit>,
54}
55impl Cpsd {
56    /// Constructs a new instance of the type.
57    #[inline]
58    pub fn new(x: super::NumericSeries, y: super::NumericSeries) -> Self {
59        Self::builder().x(x).y(y).build()
60    }
61    #[inline]
62    pub fn x(&self) -> &super::NumericSeries {
63        &*self.x
64    }
65    #[inline]
66    pub fn y(&self) -> &super::NumericSeries {
67        &*self.y
68    }
69    #[inline]
70    pub fn stft_options(&self) -> Option<&super::StftOptions> {
71        self.stft_options.as_ref().map(|o| &**o)
72    }
73    /// The scaling to apply to the output magnitude. Defaults to MAGNITUDE_DB_10 if not specified.
74    #[inline]
75    pub fn magnitude_scaling(&self) -> Option<&super::MagnitudeScaling> {
76        self.magnitude_scaling.as_ref().map(|o| &*o)
77    }
78    /// The type of the output frequency. Defaults to LINEAR if not specified. Changing the output frequency type
79    /// may also rescale the magnitude of the output in order to ensure the density of the output is consistent.
80    #[inline]
81    pub fn output_frequency_type(&self) -> Option<&super::OutputFrequencyType> {
82        self.output_frequency_type.as_ref().map(|o| &*o)
83    }
84    /// Unwrap the phase of the output. Defaults to true if not specified.
85    #[inline]
86    pub fn unwrap_phase(&self) -> Option<bool> {
87        self.unwrap_phase.as_ref().map(|o| *o)
88    }
89    /// The unit of the output phase. Defaults to RADIANS if not specified.
90    #[inline]
91    pub fn output_phase_unit(&self) -> Option<&super::OutputPhaseUnit> {
92        self.output_phase_unit.as_ref().map(|o| &*o)
93    }
94}