Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keplerian initializer now allows larger error in convergence #342

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}");
}
}
Loading