Skip to content

Commit

Permalink
Merge pull request #342 from nyx-space/bugfix/gh-340
Browse files Browse the repository at this point in the history
Keplerian initializer now allows larger error in convergence
  • Loading branch information
ChristopherRabotin authored Oct 16, 2024
2 parents 228bfe6 + d19d07a commit fc14d1b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions anise-gui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ impl eframe::App for UiApp {
ui.text_edit_singleline(&mut format!("{crc}"));

if label.ends_with("SPK") {
let num_summaries = self.almanac.spk_data[0].as_ref().unwrap().data_summaries().unwrap().len();
let num_summaries = self.almanac.spk_data[0].as_ref().unwrap().daf_summary().unwrap().num_summaries();
ui.label("Number of summaries");
ui.label(format!("{num_summaries}"));
} else if label.ends_with("PCK") {
let num_summaries = self.almanac.bpc_data[0].as_ref().unwrap().data_summaries().unwrap().len();
let num_summaries = self.almanac.bpc_data[0].as_ref().unwrap().daf_summary().unwrap().num_summaries();
ui.label("Number of summaries");
ui.label(format!("{num_summaries}"));
}
Expand Down
2 changes: 1 addition & 1 deletion anise/src/astro/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::errors::{MathError, PhysicsError};
use super::PhysicsResult;

/// Mean anomaly f64::EPSILON
pub const MA_EPSILON: f64 = 1e-16;
pub const MA_EPSILON: f64 = 1e-12;

/// Computes the true anomaly from the given mean anomaly for an orbit.
///
Expand Down
24 changes: 22 additions & 2 deletions anise/tests/astro/orbit.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
extern crate pretty_env_logger as pel;

use anise::astro::orbit::Orbit;
use anise::constants::frames::EARTH_J2000;
use anise::constants::frames::{EARTH_J2000, MOON_J2000};
use anise::constants::usual_planetary_constants::MEAN_EARTH_ANGULAR_VELOCITY_DEG_S;
use anise::math::angles::{between_0_360, between_pm_180};
use anise::math::Vector3;
use anise::prelude::*;
use anise::time::{Epoch, Unit};
use anise::time::{Epoch, TimeSeries, Unit};

use rstest::*;

Expand Down Expand Up @@ -835,3 +835,23 @@ fn b_plane_davis(almanac: Almanac) {
// The following is a regression test.
assert!(dbg!(orbit.hyperbolic_anomaly_deg().unwrap() - 149.610128737).abs() < 1e-9);
}

#[rstest]
fn gh_regression_340(almanac: Almanac) {
let moon_j2k = almanac.frame_from_uid(MOON_J2000).unwrap();

let start = Epoch::from_str("2024-10-16").unwrap();

let orbit = Orbit::keplerian(
6142.400, // sma
0.6, 57.7, 270.0, 270.0, 0.0, start, moon_j2k,
);

for epoch in TimeSeries::inclusive(
start,
Epoch::from_str("2024-10-17").unwrap(),
Unit::Minute * 1,
) {
assert!(orbit.at_epoch(epoch).is_ok(), "error on {epoch}");
}
}

0 comments on commit fc14d1b

Please sign in to comment.