Skip to content

Commit

Permalink
Updated the gradient_based_optimization tutorial with my understandin…
Browse files Browse the repository at this point in the history
…g of what is going on with an explanation at a level that an engineer with a bachelors in comp sci understands

- Added/updated comments for the gradient_based_optimization tutorial
- Shamelessly added my name to the bottom of that tutorial so that I have something to point to for the time spend with leadership. Feel free to delete it if my explanation is terrible :-p
- Added comments to initl.py
- Removed unused variables in initl.py (ex method as an argument)

Signed-off-by: Grant Curell [email protected]
  • Loading branch information
grantcurell committed Apr 29, 2024
1 parent 85449c0 commit 8b4c56b
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 150 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ dmypy.json
cython_debug/

.vscode

.idea/
138 changes: 113 additions & 25 deletions doc/notebooks/gradient_based_optimization.ipynb

Large diffs are not rendered by default.

173 changes: 104 additions & 69 deletions doc/notebooks/tle_object.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.355175Z",
"start_time": "2024-04-29T14:44:39.530116Z"
}
},
"source": [
"import dsgp4"
]
],
"outputs": [],
"execution_count": 1
},
{
"cell_type": "markdown",
Expand All @@ -38,8 +43,23 @@
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.362812Z",
"start_time": "2024-04-29T14:44:40.356711Z"
}
},
"source": [
"#let us assume we have the following two lines for the TLE, plus the first line that indicates the satellite name:\n",
"tle_lines = []\n",
"tle_lines.append('0 TIMATION 1')\n",
"tle_lines.append('1 2847U 67053E 24063.46171465 .00000366 00000-0 27411-3 0 9994')\n",
"tle_lines.append('2 2847 69.9643 216.8651 0003597 77.7866 282.3646 14.02285835897007')\n",
"\n",
"#let us construct the TLE object\n",
"tle=dsgp4.tle.TLE(tle_lines)\n",
"print(tle)"
],
"outputs": [
{
"name": "stdout",
Expand All @@ -53,17 +73,7 @@
]
}
],
"source": [
"#let us assume we have the following two lines for the TLE, plus the first line that indicates the satellite name:\n",
"tle_lines = []\n",
"tle_lines.append('0 TIMATION 1')\n",
"tle_lines.append('1 2847U 67053E 24063.46171465 .00000366 00000-0 27411-3 0 9994')\n",
"tle_lines.append('2 2847 69.9643 216.8651 0003597 77.7866 282.3646 14.02285835897007')\n",
"\n",
"#let us construct the TLE object\n",
"tle=dsgp4.tle.TLE(tle_lines)\n",
"print(tle)"
]
"execution_count": 2
},
{
"cell_type": "markdown",
Expand All @@ -74,8 +84,32 @@
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.368784Z",
"start_time": "2024-04-29T14:44:40.364047Z"
}
},
"source": [
"#let's print all TLE elements:\n",
"print(\"TLE elements:\")\n",
"print(f\"Satellite catalog number: {tle.satellite_catalog_number}\")\n",
"print(f\"Classification: {tle.classification}\")\n",
"print(f\"International designator: {tle.international_designator}\")\n",
"print(f\"Epoch year: {tle.epoch_year}\")\n",
"print(f\"Epoch day: {tle.epoch_days}\")\n",
"print(f\"First time derivative of the mean motion: {tle._ndot}\")\n",
"print(f\"Second time derivative of the mean motion: {tle._nddot}\")\n",
"print(f\"BSTAR drag term: {tle._bstar}\")\n",
"print(f\"Element set number: {tle.element_number}\")\n",
"print(f\"Inclination [rad]: {tle._inclo}\")\n",
"print(f\"Right ascension of the ascending node [rad]: {tle._nodeo}\")\n",
"print(f\"Eccentricity [-]: {tle._ecco}\")\n",
"print(f\"Argument of perigee [rad]: {tle._argpo}\")\n",
"print(f\"Right ascension of ascending node [rad]: {tle._nodeo}\")\n",
"print(f\"Mean anomaly [rad]: {tle._mo}\")\n",
"print(f\"Mean motion [rad/min]: {tle._no_kozai}\")"
],
"outputs": [
{
"name": "stdout",
Expand All @@ -101,26 +135,7 @@
]
}
],
"source": [
"#let's print all TLE elements:\n",
"print(\"TLE elements:\")\n",
"print(f\"Satellite catalog number: {tle.satellite_catalog_number}\")\n",
"print(f\"Classification: {tle.classification}\")\n",
"print(f\"International designator: {tle.international_designator}\")\n",
"print(f\"Epoch year: {tle.epoch_year}\")\n",
"print(f\"Epoch day: {tle.epoch_days}\")\n",
"print(f\"First time derivative of the mean motion: {tle._ndot}\")\n",
"print(f\"Second time derivative of the mean motion: {tle._nddot}\")\n",
"print(f\"BSTAR drag term: {tle._bstar}\")\n",
"print(f\"Element set number: {tle.element_number}\")\n",
"print(f\"Inclination [rad]: {tle._inclo}\")\n",
"print(f\"Right ascension of the ascending node [rad]: {tle._nodeo}\")\n",
"print(f\"Eccentricity [-]: {tle._ecco}\")\n",
"print(f\"Argument of perigee [rad]: {tle._argpo}\")\n",
"print(f\"Right ascension of ascending node [rad]: {tle._nodeo}\")\n",
"print(f\"Mean anomaly [rad]: {tle._mo}\")\n",
"print(f\"Mean motion [rad/min]: {tle._no_kozai}\")"
]
"execution_count": 3
},
{
"cell_type": "markdown",
Expand All @@ -131,19 +146,12 @@
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Semi-major axis [km]: 7264.027802311157\n",
"Apogee radius [km]: 888.5036731116484\n",
"Perigee radius [km]: 883.2779315106654\n"
]
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.374357Z",
"start_time": "2024-04-29T14:44:40.370687Z"
}
],
},
"source": [
"#let's first define the Earth radius according to WSG-84:\n",
"r_earth=dsgp4.util.get_gravity_constants('wgs-84')[2].numpy()*1e3\n",
Expand All @@ -154,7 +162,19 @@
"#let's extract the TLE apogee & perigee altitudes:\n",
"print(f\"Apogee radius [km]: {tle.apogee_alt(r_earth).numpy()*1e-3}\")\n",
"print(f\"Perigee radius [km]: {tle.perigee_alt(r_earth).numpy()*1e-3}\")"
]
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Semi-major axis [km]: 7264.027802311157\n",
"Apogee radius [km]: 888.5036731116484\n",
"Perigee radius [km]: 883.2779315106654\n"
]
}
],
"execution_count": 4
},
{
"cell_type": "markdown",
Expand All @@ -167,9 +187,12 @@
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.378261Z",
"start_time": "2024-04-29T14:44:40.375410Z"
}
},
"source": [
"tle_dictionary=dict(\n",
" satellite_catalog_number=43437,\n",
Expand All @@ -189,12 +212,23 @@
" raan=4.3618,\n",
" mean_anomaly=4.5224,\n",
" b_star=0.0001)"
]
],
"outputs": [],
"execution_count": 5
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.381821Z",
"start_time": "2024-04-29T14:44:40.379062Z"
}
},
"source": [
"#now the same API as above applies:\n",
"tle = dsgp4.tle.TLE(tle_dictionary)\n",
"print(tle)"
],
"outputs": [
{
"name": "stdout",
Expand All @@ -207,11 +241,7 @@
]
}
],
"source": [
"#now the same API as above applies:\n",
"tle = dsgp4.tle.TLE(tle_dictionary)\n",
"print(tle)"
]
"execution_count": 6
},
{
"cell_type": "markdown",
Expand All @@ -230,8 +260,16 @@
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-29T14:44:40.385322Z",
"start_time": "2024-04-29T14:44:40.382613Z"
}
},
"source": [
"tles=dsgp4.tle.load('example.tle')\n",
"print(tles)"
],
"outputs": [
{
"name": "stdout",
Expand All @@ -253,10 +291,7 @@
]
}
],
"source": [
"tles=dsgp4.tle.load('example.tle')\n",
"print(tles)"
]
"execution_count": 7
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 8b4c56b

Please sign in to comment.