From 1ec99a998b931fd339ccc3472423e3567097e7dc Mon Sep 17 00:00:00 2001 From: Christopher Rabotin Date: Sun, 8 Dec 2024 08:29:57 -0700 Subject: [PATCH] Fix OD residual plotting + clippy --- examples/04_lro_od/main.rs | 2 +- examples/04_lro_od/plot_od_rslt.py | 3 +-- src/dynamics/mod.rs | 6 +----- src/lib.rs | 3 --- src/md/opti/multipleshooting/multishoot.rs | 6 +++--- src/md/opti/raphson_finite_diff.rs | 2 +- src/md/opti/raphson_hyperdual.rs | 2 +- src/md/opti/targeter.rs | 2 +- src/od/process/export.rs | 4 ++-- src/propagators/instance.rs | 2 +- 10 files changed, 12 insertions(+), 20 deletions(-) diff --git a/examples/04_lro_od/main.rs b/examples/04_lro_od/main.rs index 6a92101b..69e61b91 100644 --- a/examples/04_lro_od/main.rs +++ b/examples/04_lro_od/main.rs @@ -256,7 +256,7 @@ fn main() -> Result<(), Box> { SNC3::from_diagonal(10 * Unit::Minute, &[1e-12, 1e-12, 1e-12]), ); - // We'll set up the OD process to reject measurements whose residuals are mover than 4 sigmas away from what we expect. + // We'll set up the OD process to reject measurements whose residuals are move than 3 sigmas away from what we expect. let mut odp = SpacecraftODProcess::ckf( setup.with(initial_estimate.state().with_stm(), almanac.clone()), kf, diff --git a/examples/04_lro_od/plot_od_rslt.py b/examples/04_lro_od/plot_od_rslt.py index 176d53f0..cf8b6e9b 100644 --- a/examples/04_lro_od/plot_od_rslt.py +++ b/examples/04_lro_od/plot_od_rslt.py @@ -15,7 +15,6 @@ def main(path: str): df = ( df.with_columns(pl.col("Epoch (UTC)").str.to_datetime("%Y-%m-%dT%H:%M:%S%.f")) .sort("Epoch (UTC)", descending=False) - .with_columns(df["Residual ratio"].fill_null(0.0).alias("Residual ratio")) ) all_msr_types = ["Range (km)", "Doppler (km/s)", "Azimuth (deg)", "Elevation (deg)"] @@ -40,7 +39,7 @@ def main(path: str): ) # Convert the Polars column to a NumPy array for compatibility with scipy and Plotly - residual_ratio = df["Residual ratio"].to_numpy() + residual_ratio = df["Residual ratio"].drop_nulls().to_numpy() # Create QQ plot qq = stats.probplot(residual_ratio) diff --git a/src/dynamics/mod.rs b/src/dynamics/mod.rs index a356a5ee..166bb6d7 100644 --- a/src/dynamics/mod.rs +++ b/src/dynamics/mod.rs @@ -39,11 +39,6 @@ pub mod orbital; use self::guidance::GuidanceError; pub use self::orbital::*; -/// The gravity module handles spherical harmonics only. It _must_ be combined with a OrbitalDynamics dynamics -/// -/// This module allows loading gravity models from [PDS](http://pds-geosciences.wustl.edu/), [EGM2008](http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/) and GMAT's own COF files. -// pub mod gravity; - /// The spacecraft module allows for simulation of spacecraft dynamics in general, including propulsion/maneuvers. pub mod spacecraft; pub use self::spacecraft::*; @@ -63,6 +58,7 @@ pub mod drag; pub use self::drag::*; /// Define the spherical harmonic models. +/// This module allows loading gravity models from [PDS](http://pds-geosciences.wustl.edu/), [EGM2008](http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/) and GMAT's own COF files. pub mod sph_harmonics; pub use self::sph_harmonics::*; diff --git a/src/lib.rs b/src/lib.rs index 0c7fcdfe..26b0c6f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,9 +51,6 @@ pub mod io; /// All the orbital determination and spacecraft navigation tools and functions. pub mod od; -/// Navigation submodule, relevant to both ground based navigation (orbit determination) and onboard navigation (part of the Guidance, Navigation and Control subsystem) -// pub mod nav; - /// All of the mission design and mission analysis tools and functions pub mod md; diff --git a/src/md/opti/multipleshooting/multishoot.rs b/src/md/opti/multipleshooting/multishoot.rs index c31ac95b..9e4145d0 100644 --- a/src/md/opti/multipleshooting/multishoot.rs +++ b/src/md/opti/multipleshooting/multishoot.rs @@ -59,7 +59,7 @@ pub struct MultipleShooting<'a, T: MultishootNode, const VT: usize, const OT pub all_dvs: Vec>, } -impl<'a, T: MultishootNode, const VT: usize, const OT: usize> MultipleShooting<'a, T, VT, OT> { +impl, const VT: usize, const OT: usize> MultipleShooting<'_, T, VT, OT> { /// Solve the multiple shooting problem by finding the arrangement of nodes to minimize the cost function. pub fn solve( &mut self, @@ -278,8 +278,8 @@ impl<'a, T: MultishootNode, const VT: usize, const OT: usize> MultipleShooti } } -impl<'a, T: MultishootNode, const VT: usize, const OT: usize> fmt::Display - for MultipleShooting<'a, T, VT, OT> +impl, const VT: usize, const OT: usize> fmt::Display + for MultipleShooting<'_, T, VT, OT> { #[allow(clippy::or_fun_call, clippy::clone_on_copy)] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/md/opti/raphson_finite_diff.rs b/src/md/opti/raphson_finite_diff.rs index 260fd045..288991c9 100644 --- a/src/md/opti/raphson_finite_diff.rs +++ b/src/md/opti/raphson_finite_diff.rs @@ -33,7 +33,7 @@ use snafu::{ensure, ResultExt}; #[cfg(not(target_arch = "wasm32"))] use std::time::Instant; -impl<'a, const V: usize, const O: usize> Targeter<'a, V, O> { +impl Targeter<'_, V, O> { /// Differential correction using finite differencing #[allow(clippy::comparison_chain)] pub fn try_achieve_fd( diff --git a/src/md/opti/raphson_hyperdual.rs b/src/md/opti/raphson_hyperdual.rs index eda4ca32..3663713c 100644 --- a/src/md/opti/raphson_hyperdual.rs +++ b/src/md/opti/raphson_hyperdual.rs @@ -30,7 +30,7 @@ use crate::utils::are_eigenvalues_stable; #[cfg(not(target_arch = "wasm32"))] use std::time::Instant; -impl<'a, const V: usize, const O: usize> Targeter<'a, V, O> { +impl Targeter<'_, V, O> { /// Differential correction using hyperdual numbers for the objectives #[allow(clippy::comparison_chain)] pub fn try_achieve_dual( diff --git a/src/md/opti/targeter.rs b/src/md/opti/targeter.rs index 389e4edf..2011e0b7 100644 --- a/src/md/opti/targeter.rs +++ b/src/md/opti/targeter.rs @@ -48,7 +48,7 @@ pub struct Targeter<'a, const V: usize, const O: usize> { pub iterations: usize, } -impl<'a, const V: usize, const O: usize> fmt::Display for Targeter<'a, V, O> { +impl fmt::Display for Targeter<'_, V, O> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut objmsg = String::from(""); for obj in &self.objectives { diff --git a/src/od/process/export.rs b/src/od/process/export.rs index 92001e9c..e1be1f04 100644 --- a/src/od/process/export.rs +++ b/src/od/process/export.rs @@ -42,8 +42,8 @@ use std::path::{Path, PathBuf}; use super::ODProcess; -impl<'a, MsrSize: DimName, Accel: DimName, Trk: TrackerSensitivity> - ODProcess<'a, SpacecraftDynamics, MsrSize, Accel, KF, Trk> +impl> + ODProcess<'_, SpacecraftDynamics, MsrSize, Accel, KF, Trk> where DefaultAllocator: Allocator + Allocator::Size> diff --git a/src/propagators/instance.rs b/src/propagators/instance.rs index c32fd2a0..962e1c32 100644 --- a/src/propagators/instance.rs +++ b/src/propagators/instance.rs @@ -60,7 +60,7 @@ where pub(crate) k: Vec::VecLength>>, } -impl<'a, D: Dynamics> PropInstance<'a, D> +impl PropInstance<'_, D> where DefaultAllocator: Allocator<::Size> + Allocator<::Size, ::Size>