Skip to content

Commit

Permalink
Merge pull request #15 from Sceki/fix_exception_handling
Browse files Browse the repository at this point in the history
Exception Handling Fix
  • Loading branch information
Sceki authored Oct 11, 2024
2 parents 6afed05 + 1632618 commit 9b93225
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 21 deletions.
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
nb_execution_mode = "force"

nb_execution_excludepatterns = [
"tle_propagation.ipynb"
"tle_propagation.ipynb",
"covariance_propagation.ipynb"
]

latex_engine = "xelatex"
Expand Down
25 changes: 18 additions & 7 deletions doc/notebooks/covariance_propagation.ipynb

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions doc/notebooks/covariance_transformation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "56ae5fb1",
"metadata": {},
"outputs": [],
"source": [
"import torch\n",
"import dsgp4\n",
"import numpy as np"
"import numpy as np\n",
"import warnings\n",
"warnings.filterwarnings('ignore', category=DeprecationWarning)"
]
},
{
Expand Down Expand Up @@ -60,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"id": "1ef62c01",
"metadata": {},
"outputs": [],
Expand All @@ -83,7 +85,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "c1f8708f",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -136,7 +138,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"id": "62e040d9",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -182,7 +184,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"id": "f06046e7",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -217,7 +219,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"id": "cebfb9a3",
"metadata": {},
"outputs": [
Expand All @@ -237,7 +239,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 7,
"id": "dc2d861c",
"metadata": {},
"outputs": [
Expand All @@ -258,7 +260,7 @@
" 1.57016478e-02, 9.25009651e-02]])"
]
},
"execution_count": 14,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -359,7 +361,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion dsgp4/tle.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def copy(self):
Returns:
`dsgp4.tle.TLE` object
"""
d = copy.deepcopy(self._data)
d = {k: (v.clone() if isinstance(v, torch.Tensor) else copy.deepcopy(v)) for k, v in self._data.items()}
return TLE(d)

def set_time(self, date_mjd):
Expand Down
10 changes: 8 additions & 2 deletions dsgp4/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,14 @@ def initialize_tle(tles,
xnodeo=xx[:,8],
satellite_batch=tles_batch,
)
except:
deep_space_counter+=1
except Exception as e:
_error_string="Error: deep space propagation not supported (yet). The provided satellite has \
an orbital period above 225 minutes. If you want to let us know you need it or you want to \
contribute to implement it, open a PR or raise an issue at: https://github.com/esa/dSGP4."
if str(e)==_error_string:
deep_space_counter+=1
else:
raise e
if deep_space_counter>0:
print("Warning: "+str(deep_space_counter)+" TLEs were not initialized because they are in deep space. Deep space propagation is currently not supported.")
return tle_elements, tles_batch
Expand Down

0 comments on commit 9b93225

Please sign in to comment.