nyx_space/mc/dispersion.rs
1/*
2 Nyx, blazing fast astrodynamics
3 Copyright (C) 2018-onwards Christopher Rabotin <christopher.rabotin@gmail.com>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
17*/
18
19use crate::md::StateParameter;
20use serde::{Deserialize, Serialize};
21use typed_builder::TypedBuilder;
22
23#[cfg(feature = "python")]
24use pyo3::prelude::*;
25
26/// A dispersions configuration, allows specifying min/max bounds (by default, they are not set)
27#[derive(Copy, Clone, Debug, TypedBuilder, Serialize, Deserialize)]
28#[cfg_attr(feature = "python", pyclass)]
29pub struct StateDispersion {
30 pub param: StateParameter,
31 #[builder(default, setter(strip_option))]
32 pub mean: Option<f64>,
33 #[builder(default, setter(strip_option))]
34 pub std_dev: Option<f64>,
35}
36
37impl StateDispersion {
38 pub fn zero_mean(param: StateParameter, std_dev: f64) -> Self {
39 Self {
40 param,
41 std_dev: Some(std_dev),
42 mean: Some(0.0),
43 }
44 }
45}