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) 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