Skip to content

Commit 76f6752

Browse files
Merge remote-tracking branch 'refs/remotes/origin/feat/gh-396-moar-serde' into feat/gh-396-moar-serde
2 parents 39268dd + ff1d8e2 commit 76f6752

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/od/ground_station/mod.rs

+29-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use indexmap::{IndexMap, IndexSet};
2424
use snafu::ensure;
2525

2626
use super::msr::MeasurementType;
27-
use super::noise::StochasticNoise;
27+
use super::noise::{GaussMarkov, StochasticNoise};
2828
use super::{ODAlmanacSnafu, ODError, ODTrajSnafu, TrackingDevice};
2929
use crate::io::ConfigRepr;
3030
use crate::od::NoiseNotConfiguredSnafu;
@@ -119,6 +119,34 @@ impl GroundStation {
119119
self
120120
}
121121

122+
/// Returns a copy of this ground station with the measurement type noises' constant bias set to the provided value.
123+
pub fn with_msr_bias_constant(
124+
mut self,
125+
msr_type: MeasurementType,
126+
bias_constant: f64,
127+
) -> Result<Self, ODError> {
128+
if self.stochastic_noises.is_none() {
129+
self.stochastic_noises = Some(IndexMap::new());
130+
}
131+
132+
let stochastics = self.stochastic_noises.as_mut().unwrap();
133+
134+
let this_noise = stochastics
135+
.get_mut(&msr_type)
136+
.ok_or(ODError::NoiseNotConfigured {
137+
kind: format!("{msr_type:?}"),
138+
})
139+
.unwrap();
140+
141+
if this_noise.bias.is_none() {
142+
this_noise.bias = Some(GaussMarkov::ZERO);
143+
}
144+
145+
this_noise.bias.unwrap().constant = Some(bias_constant);
146+
147+
Ok(self)
148+
}
149+
122150
/// Computes the azimuth and elevation of the provided object seen from this ground station, both in degrees.
123151
/// This is a shortcut to almanac.azimuth_elevation_range_sez.
124152
pub fn azimuth_elevation_of(

tests/orbit_determination/simulator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fn continuous_tracking_cov_test(tracking_data: TrackingDataArc) {
200200
println!("{arc_downsample}");
201201
assert_eq!(
202202
arc_downsample.len(),
203-
arc_tdm.len() / 10,
203+
arc_tdm.len() / 10 + 1,
204204
"downsampling has wrong sample count"
205205
);
206206

0 commit comments

Comments
 (0)