From 49f18849407a69c233bbc680b6abfb607456e4ef Mon Sep 17 00:00:00 2001 From: Sceki Date: Tue, 9 Jul 2024 10:23:27 +0200 Subject: [PATCH 1/2] exit Kepler equation iteration if tolerance reach --- dsgp4/sgp4.py | 3 +++ dsgp4/sgp4_batched.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/dsgp4/sgp4.py b/dsgp4/sgp4.py index be7ae86..cd869d4 100644 --- a/dsgp4/sgp4.py +++ b/dsgp4/sgp4.py @@ -130,7 +130,10 @@ def sgp4(satellite, tsince): tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5 tem5=torch.where(tem5>=0.95, 0.95, tem5) tem5=torch.where(tem5<=-0.95, -0.95, tem5) + #we need to break if abs value of tem5 is less than 1e-12: eo1 = eo1 + tem5 + if torch.all(torch.abs(tem5) < 1e-12): + break # short period preliminary quantities ecose = axnl*coseo1 + aynl*sineo1 diff --git a/dsgp4/sgp4_batched.py b/dsgp4/sgp4_batched.py index b04ef2d..4820b35 100644 --- a/dsgp4/sgp4_batched.py +++ b/dsgp4/sgp4_batched.py @@ -139,6 +139,8 @@ def sgp4_batched(satellite_batch, tsince): tem5=torch.where(tem5>=0.95, 0.95, tem5) tem5=torch.where(tem5<=-0.95, -0.95, tem5) eo1 = eo1 + tem5 + if torch.all(torch.abs(tem5) < 1e-12): + break # short period preliminary quantities ecose = axnl*coseo1 + aynl*sineo1 From 69446910b542b515dbb389c94fe732a205fb6dfd Mon Sep 17 00:00:00 2001 From: Sceki Date: Tue, 9 Jul 2024 11:33:02 +0200 Subject: [PATCH 2/2] version --- dsgp4/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsgp4/__init__.py b/dsgp4/__init__.py index 7396994..af11457 100644 --- a/dsgp4/__init__.py +++ b/dsgp4/__init__.py @@ -1,4 +1,4 @@ -__version__ = '1.0.0' +__version__ = '1.0.1' import torch torch.set_default_dtype(torch.float64)