Skip to content

Commit

Permalink
Fix OD residual plotting + clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed Dec 8, 2024
1 parent 9c22b15 commit 1ec99a9
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion examples/04_lro_od/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ fn main() -> Result<(), Box<dyn Error>> {
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,
Expand Down
3 changes: 1 addition & 2 deletions examples/04_lro_od/plot_od_rslt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"]
Expand All @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions src/dynamics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand All @@ -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::*;

Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/md/opti/multipleshooting/multishoot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct MultipleShooting<'a, T: MultishootNode<OT>, const VT: usize, const OT
pub all_dvs: Vec<SVector<f64, VT>>,
}

impl<'a, T: MultishootNode<OT>, const VT: usize, const OT: usize> MultipleShooting<'a, T, VT, OT> {
impl<T: MultishootNode<OT>, 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,
Expand Down Expand Up @@ -278,8 +278,8 @@ impl<'a, T: MultishootNode<OT>, const VT: usize, const OT: usize> MultipleShooti
}
}

impl<'a, T: MultishootNode<OT>, const VT: usize, const OT: usize> fmt::Display
for MultipleShooting<'a, T, VT, OT>
impl<T: MultishootNode<OT>, 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 {
Expand Down
2 changes: 1 addition & 1 deletion src/md/opti/raphson_finite_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<const V: usize, const O: usize> Targeter<'_, V, O> {
/// Differential correction using finite differencing
#[allow(clippy::comparison_chain)]
pub fn try_achieve_fd(
Expand Down
2 changes: 1 addition & 1 deletion src/md/opti/raphson_hyperdual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<const V: usize, const O: usize> Targeter<'_, V, O> {
/// Differential correction using hyperdual numbers for the objectives
#[allow(clippy::comparison_chain)]
pub fn try_achieve_dual(
Expand Down
2 changes: 1 addition & 1 deletion src/md/opti/targeter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<const V: usize, const O: usize> 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 {
Expand Down
4 changes: 2 additions & 2 deletions src/od/process/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ use std::path::{Path, PathBuf};

use super::ODProcess;

impl<'a, MsrSize: DimName, Accel: DimName, Trk: TrackerSensitivity<Spacecraft, Spacecraft>>
ODProcess<'a, SpacecraftDynamics, MsrSize, Accel, KF<Spacecraft, Accel, MsrSize>, Trk>
impl<MsrSize: DimName, Accel: DimName, Trk: TrackerSensitivity<Spacecraft, Spacecraft>>
ODProcess<'_, SpacecraftDynamics, MsrSize, Accel, KF<Spacecraft, Accel, MsrSize>, Trk>
where
DefaultAllocator: Allocator<MsrSize>
+ Allocator<MsrSize, <Spacecraft as State>::Size>
Expand Down
2 changes: 1 addition & 1 deletion src/propagators/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
pub(crate) k: Vec<OVector<f64, <D::StateType as State>::VecLength>>,
}

impl<'a, D: Dynamics> PropInstance<'a, D>
impl<D: Dynamics> PropInstance<'_, D>
where
DefaultAllocator: Allocator<<D::StateType as State>::Size>
+ Allocator<<D::StateType as State>::Size, <D::StateType as State>::Size>
Expand Down

0 comments on commit 1ec99a9

Please sign in to comment.