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}
41impl Psd {
42    /// Constructs a new instance of the type.
43    #[inline]
44    pub fn new(input: super::NumericSeries) -> Self {
45        Self::builder().input(input).build()
46    }
47    #[inline]
48    pub fn input(&self) -> &super::NumericSeries {
49        &*self.input
50    }
51    #[inline]
52    pub fn stft_options(&self) -> Option<&super::StftOptions> {
53        self.stft_options.as_ref().map(|o| &**o)
54    }
55    /// The scaling to apply to the output magnitude. Defaults to MAGNITUDE_DB_10 if not specified.
56    #[inline]
57    pub fn magnitude_scaling(&self) -> Option<&super::MagnitudeScaling> {
58        self.magnitude_scaling.as_ref().map(|o| &*o)
59    }
60    /// The type of the output frequency. Defaults to LINEAR if not specified. Changing the output frequency unit
61    /// may also rescale the magnitude of the output in order to ensure the density of the output is consistent.
62    #[inline]
63    pub fn output_frequency_type(&self) -> Option<&super::OutputFrequencyType> {
64        self.output_frequency_type.as_ref().map(|o| &*o)
65    }
66}