Skip to main content

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

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct Psd {
13    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
14    #[serde(rename = "input")]
15    input: Box<super::NumericSeries>,
16    #[builder(
17        default,
18        custom(
19            type = impl
20            Into<Option<super::StftOptions>>,
21            convert = |v|v.into().map(Box::new)
22        )
23    )]
24    #[serde(rename = "stftOptions", skip_serializing_if = "Option::is_none", default)]
25    stft_options: Option<Box<super::StftOptions>>,
26    #[builder(default, into)]
27    #[serde(
28        rename = "magnitudeScaling",
29        skip_serializing_if = "Option::is_none",
30        default
31    )]
32    magnitude_scaling: Option<super::MagnitudeScaling>,
33    #[builder(default, into)]
34    #[serde(
35        rename = "outputFrequencyType",
36        skip_serializing_if = "Option::is_none",
37        default
38    )]
39    output_frequency_type: Option<super::OutputFrequencyType>,
40    #[builder(
41        default,
42        custom(
43            type = impl
44            Into<Option<super::FrequencySummarizationStrategy>>,
45            convert = |v|v.into().map(Box::new)
46        )
47    )]
48    #[serde(
49        rename = "summarizationStrategy",
50        skip_serializing_if = "Option::is_none",
51        default
52    )]
53    summarization_strategy: Option<Box<super::FrequencySummarizationStrategy>>,
54}
55impl Psd {
56    /// Constructs a new instance of the type.
57    #[inline]
58    pub fn new(input: super::NumericSeries) -> Self {
59        Self::builder().input(input).build()
60    }
61    #[inline]
62    pub fn input(&self) -> &super::NumericSeries {
63        &*self.input
64    }
65    #[inline]
66    pub fn stft_options(&self) -> Option<&super::StftOptions> {
67        self.stft_options.as_ref().map(|o| &**o)
68    }
69    /// The scaling to apply to the output magnitude. Defaults to MAGNITUDE_DB_10 if not specified.
70    #[inline]
71    pub fn magnitude_scaling(&self) -> Option<&super::MagnitudeScaling> {
72        self.magnitude_scaling.as_ref().map(|o| &*o)
73    }
74    /// The type of the output frequency. Defaults to LINEAR if not specified. Changing the output frequency unit
75    /// may also rescale the magnitude of the output in order to ensure the density of the output is consistent.
76    #[inline]
77    pub fn output_frequency_type(&self) -> Option<&super::OutputFrequencyType> {
78        self.output_frequency_type.as_ref().map(|o| &*o)
79    }
80    /// Strategy to downsample the output frequency spectrum.
81    #[inline]
82    pub fn summarization_strategy(
83        &self,
84    ) -> Option<&super::FrequencySummarizationStrategy> {
85        self.summarization_strategy.as_ref().map(|o| &**o)
86    }
87}