-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adapt python bindings for tabulated orbit model (#102)
* fix: adapt python bindings for tabulated * feat: add some more tests * chore: clean up test * feat: missed a spot --------- Co-authored-by: Remy Derollez <remy@loftorbital.com> Co-authored-by: vishwa shah <vishwa@loftorbital.com>
- Loading branch information
1 parent
aa6f077
commit cfe9de1
Showing
6 changed files
with
115 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,79 @@ | ||
# Apache License 2.0 | ||
# Apache License 2.0 | ||
|
||
import pytest | ||
|
||
import numpy | ||
from ostk.physics import Environment | ||
from ostk.physics.units import Length, Angle | ||
from ostk.physics.time import Scale, Instant, DateTime | ||
|
||
import ostk.physics as physics | ||
from ostk.astrodynamics.trajectory import Orbit, State | ||
from ostk.astrodynamics.trajectory.orbit.models import SGP4 | ||
from ostk.astrodynamics.trajectory.orbit.models.sgp4 import TLE | ||
|
||
import ostk.astrodynamics as astrodynamics | ||
|
||
Length = physics.units.Length | ||
Angle = physics.units.Angle | ||
Scale = physics.time.Scale | ||
Instant = physics.time.Instant | ||
Interval = physics.time.Interval | ||
DateTime = physics.time.DateTime | ||
Position = physics.coordinate.Position | ||
Velocity = physics.coordinate.Velocity | ||
Frame = physics.coordinate.Frame | ||
Environment = physics.Environment | ||
@pytest.fixture | ||
def earth(): | ||
return Environment.default().access_celestial_object_with_name("Earth") | ||
|
||
Trajectory = astrodynamics.Trajectory | ||
Model = astrodynamics.trajectory.Model | ||
Orbit = astrodynamics.trajectory.Orbit | ||
Pass = astrodynamics.trajectory.orbit.Pass | ||
Kepler = astrodynamics.trajectory.orbit.models.Kepler | ||
COE = astrodynamics.trajectory.orbit.models.kepler.COE | ||
SGP4 = astrodynamics.trajectory.orbit.models.SGP4 | ||
TLE = astrodynamics.trajectory.orbit.models.sgp4.TLE | ||
State = astrodynamics.trajectory.State | ||
Access = astrodynamics.Access | ||
|
||
earth = Environment.default().access_celestial_object_with_name("Earth") | ||
class TestOrbit: | ||
def test_trajectory_orbit_constructors(self, earth): | ||
# Construct Two-Line Element set | ||
tle = TLE( | ||
"1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994", | ||
"2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316", | ||
) | ||
|
||
# Construct orbit using SGP4 model | ||
orbit = Orbit(SGP4(tle), earth) | ||
|
||
def test_trajectory_orbit_constructors(): | ||
# Construct Two-Line Element set | ||
tle = TLE( | ||
"1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994", | ||
"2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316", | ||
) | ||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
|
||
# Construct orbit using SGP4 model | ||
orbit = Orbit(SGP4(tle), earth) | ||
# Construct get state at current epoch | ||
state: State = orbit.get_state_at(Instant.now()) | ||
|
||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
assert state is not None | ||
assert isinstance(state, State) | ||
|
||
# Construct get state at current epoch | ||
state: State = orbit.get_state_at(Instant.now()) | ||
def test_trajectory_orbit_circular(self, earth): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
inclination = Angle.degrees(45.0) | ||
|
||
assert state is not None | ||
assert isinstance(state, State) | ||
orbit: Orbit = Orbit.circular(epoch, altitude, inclination, earth) | ||
|
||
@pytest.mark.skip | ||
def test_trajectory_orbit_equatorial(self, earth): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
eccentricity = 0.1 | ||
|
||
def test_trajectory_orbit_circular(): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
inclination = Angle.degrees(45.0) | ||
orbit: Orbit = Orbit.equatorial(epoch, altitude, eccentricity, earth) | ||
|
||
orbit: Orbit = Orbit.circular(epoch, altitude, inclination, earth) | ||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
|
||
@pytest.mark.skip | ||
def test_trajectory_orbit_circular_equatorial(self, earth): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
|
||
@pytest.mark.skip | ||
def test_trajectory_orbit_equatorial(): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
eccentricity = 0.1 | ||
orbit: Orbit = Orbit.circular_equatorial(epoch, altitude, earth) | ||
|
||
orbit: Orbit = Orbit.equatorial(epoch, altitude, eccentricity, earth) | ||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
|
||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
@pytest.mark.skip | ||
def test_trajectory_orbit_sun_synchronous(self, earth): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
|
||
orbit: Orbit = Orbit.sun_synchronous(epoch, altitude, earth) | ||
|
||
@pytest.mark.skip | ||
def test_trajectory_orbit_circular_equatorial(): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
|
||
orbit: Orbit = Orbit.circular_equatorial(epoch, altitude, earth) | ||
|
||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
|
||
|
||
@pytest.mark.skip | ||
def test_trajectory_orbit_sun_synchronous(): | ||
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC) | ||
altitude = Length.kilometers(500.0) | ||
|
||
orbit: Orbit = Orbit.sun_synchronous(epoch, altitude, earth) | ||
|
||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() | ||
assert orbit is not None | ||
assert isinstance(orbit, Orbit) | ||
assert orbit.is_defined() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters