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/// A dispersions configuration, allows specifying min/max bounds (by default, they are not set)
24#[derive(Copy, Clone, TypedBuilder, Serialize, Deserialize)]
25pub struct StateDispersion {
26 pub param: StateParameter,
27 #[builder(default, setter(strip_option))]
28 pub mean: Option<f64>,
29 #[builder(default, setter(strip_option))]
30 pub std_dev: Option<f64>,
31}
32
33impl StateDispersion {
34 pub fn zero_mean(param: StateParameter, std_dev: f64) -> Self {
35 Self {
36 param,
37 std_dev: Some(std_dev),
38 mean: Some(0.0),
39 }
40 }
41}