From 722681ea0b157c0b0bbde121cac711d83f7cdc5c Mon Sep 17 00:00:00 2001
From: Christopher Rabotin <christopher.rabotin@gmail.com>
Date: Wed, 16 Oct 2024 00:20:42 -0600
Subject: [PATCH 1/2] Fix summary count in gui

---
 anise-gui/src/ui.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/anise-gui/src/ui.rs b/anise-gui/src/ui.rs
index 2a0dfbe9..a1799d8a 100644
--- a/anise-gui/src/ui.rs
+++ b/anise-gui/src/ui.rs
@@ -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}"));
                                         }

From d19d07a0b2d9a73b91ed83bc97668fd8b30659a2 Mon Sep 17 00:00:00 2001
From: Christopher Rabotin <christopher.rabotin@gmail.com>
Date: Wed, 16 Oct 2024 00:31:28 -0600
Subject: [PATCH 2/2] Fix #340

---
 anise/src/astro/utils.rs   |  2 +-
 anise/tests/astro/orbit.rs | 24 ++++++++++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/anise/src/astro/utils.rs b/anise/src/astro/utils.rs
index ba55ad06..46f06f5e 100644
--- a/anise/src/astro/utils.rs
+++ b/anise/src/astro/utils.rs
@@ -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.
 ///
diff --git a/anise/tests/astro/orbit.rs b/anise/tests/astro/orbit.rs
index bf6af2a9..cc70ca88 100644
--- a/anise/tests/astro/orbit.rs
+++ b/anise/tests/astro/orbit.rs
@@ -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::*;
 
@@ -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}");
+    }
+}