Skip to content

Commit

Permalink
fix: astrodynamics notebooks (#116)
Browse files Browse the repository at this point in the history
* feat: fix astrodynamics notebooks

* feat: update Visualization notebook
  • Loading branch information
vishwa2710 authored May 7, 2024
1 parent 0d4421d commit d8310c5
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 414 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
"tags": []
},
"source": [
"# Validation Plots "
"## Validation Plots "
]
},
{
Expand Down Expand Up @@ -4325,7 +4325,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
},
{
Expand Down Expand Up @@ -8156,7 +8156,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
}
],
Expand Down Expand Up @@ -8184,4 +8184,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
"tags": []
},
"source": [
"# Validation Plots "
"## Validation Plots "
]
},
{
Expand Down Expand Up @@ -4324,7 +4324,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
},
{
Expand Down Expand Up @@ -8154,7 +8154,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
}
],
Expand Down Expand Up @@ -8182,4 +8182,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
"tags": []
},
"source": [
"# Validation Plots "
"## Validation Plots "
]
},
{
Expand Down Expand Up @@ -4324,7 +4324,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
},
{
Expand Down Expand Up @@ -8154,7 +8154,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
}
],
Expand Down Expand Up @@ -8182,4 +8182,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
"tags": []
},
"source": [
"# Validation Plots "
"## Validation Plots "
]
},
{
Expand Down Expand Up @@ -4338,7 +4338,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
},
{
Expand Down Expand Up @@ -8168,7 +8168,7 @@
" )\n",
" )\n",
"\n",
"figure.show()"
"figure.show(\"svg\")"
]
}
],
Expand Down Expand Up @@ -8196,4 +8196,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
63 changes: 5 additions & 58 deletions notebooks/Astrodynamics/Orbit Computation/Access Computation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"\n",
"import plotly.graph_objs as go\n",
"\n",
"from ostk.mathematics.objects import RealInterval\n",
"from ostk.mathematics.object import RealInterval\n",
"\n",
"from ostk.physics import Environment\n",
"from ostk.physics.unit import Length\n",
Expand All @@ -43,18 +43,18 @@
"from ostk.physics.time import DateTime\n",
"from ostk.physics.time import Time\n",
"from ostk.physics.coordinate.spherical import LLA\n",
"from ostk.physics.coordinate.spherical import AER\n",
"from ostk.physics.coordinate import Position\n",
"from ostk.physics.coordinate import Frame\n",
"from ostk.physics.environment.object.celestial import Earth\n",
"\n",
"from ostk.astrodynamics import Trajectory\n",
"from ostk.astrodynamics.trajectory import Orbit\n",
"from ostk.astrodynamics.trajectory.orbit.model import Kepler\n",
"from ostk.astrodynamics.trajectory.orbit.model.kepler import COE\n",
"from ostk.astrodynamics.trajectory.orbit.model import SGP4\n",
"from ostk.astrodynamics.trajectory.orbit.model.sgp4 import TLE\n",
"from ostk.astrodynamics.access import Generator as AccessGenerator"
"from ostk.astrodynamics.access import Generator as AccessGenerator\n",
"from ostk.astrodynamics.utilities import compute_trajectory_geometry\n",
"from ostk.astrodynamics.utilities import compute_time_lla_aer_state"
]
},
{
Expand Down Expand Up @@ -764,62 +764,9 @@
"metadata": {},
"outputs": [],
"source": [
"def compute_lla(state):\n",
" lla = LLA.cartesian(\n",
" state.get_position()\n",
" .in_frame(Frame.ITRF(), state.get_instant())\n",
" .get_coordinates(),\n",
" earth.get_equatorial_radius(),\n",
" earth.get_flattening(),\n",
" )\n",
"\n",
" return [\n",
" float(lla.get_latitude().in_degrees()),\n",
" float(lla.get_longitude().in_degrees()),\n",
" float(lla.get_altitude().in_meters()),\n",
" ]\n",
"\n",
"\n",
"def compute_aer(instant, from_lla, to_position):\n",
" nedFrame = earth.get_frame_at(from_lla, Earth.FrameType.NED)\n",
"\n",
" fromPosition_NED = from_position.in_frame(nedFrame, instant)\n",
" sunPosition_NED = to_position.in_frame(nedFrame, instant)\n",
"\n",
" aer = AER.from_position_to_position(fromPosition_NED, sunPosition_NED, True)\n",
"\n",
" return [\n",
" float(aer.get_azimuth().in_degrees()),\n",
" float(aer.get_elevation().in_degrees()),\n",
" float(aer.get_range().in_meters()),\n",
" ]\n",
"\n",
"\n",
"def compute_time_lla_aer_state(state):\n",
" instant = state.get_instant()\n",
"\n",
" lla = compute_lla(state)\n",
" aer = compute_aer(\n",
" instant,\n",
" from_lla,\n",
" state.get_position().in_frame(Frame.ITRF(), state.get_instant()),\n",
" )\n",
"\n",
" return [instant, lla[0], lla[1], lla[2], aer[0], aer[1], aer[2]]\n",
"\n",
"\n",
"def compute_trajectory_geometry(aTrajectory, anInterval):\n",
" return [\n",
" compute_lla(state)\n",
" for state in aTrajectory.get_states_at(\n",
" anInterval.generate_grid(Duration.minutes(1.0))\n",
" )\n",
" ]\n",
"\n",
"\n",
"def compute_access_geometry(access):\n",
" return [\n",
" compute_time_lla_aer_state(state)\n",
" compute_time_lla_aer_state(state, from_lla, environment)\n",
" for state in satellite_orbit.get_states_at(\n",
" access.get_interval().generate_grid(Duration.seconds(1.0))\n",
" )\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"\n",
"from tqdm.notebook import tqdm\n",
"\n",
"from ostk.mathematics.objects import RealInterval\n",
"from ostk.mathematics.object import RealInterval\n",
"\n",
"from ostk.physics import Environment\n",
"from ostk.physics.coordinate import Position\n",
Expand Down
Loading

0 comments on commit d8310c5

Please sign in to comment.