-
-
Notifications
You must be signed in to change notification settings - Fork 282
Conversation
Codecov Report
@@ Coverage Diff @@
## master #717 +/- ##
==========================================
+ Coverage 86.09% 86.14% +0.04%
==========================================
Files 52 52
Lines 2640 2648 +8
Branches 221 221
==========================================
+ Hits 2273 2281 +8
Misses 310 310
Partials 57 57
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments!
orbit = Orbit.from_classical(attractor, a, ecc, _a, _a, _a, nu) | ||
orbit_M = orbit.M | ||
|
||
assert_allclose(orbit_M.value, expected_mean_anomaly.value, rtol=1e-2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an assert_quantity_allclose
in Astropy that you can use https://astropy.readthedocs.io/en/stable/api/astropy.tests.helper.assert_quantity_allclose.html
orbit = Orbit.from_classical(attractor, a, ecc, _a, _a, _a, nu) | ||
orbit_h_mom = orbit.h_mom | ||
|
||
assert_allclose(orbit_h_mom.value, expected_ang_mom.value, rtol=1e-2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
nu = 120 * u.deg | ||
|
||
orbit = Orbit.from_classical(attractor, a, ecc, _a, _a, _a, nu) | ||
orbit_h_mom = orbit.h_mom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of h_mom
, what about h_mag
(of "magnitude")?
orbit = Orbit.from_classical(attractor, a, ecc, _a, _a, _a, nu) | ||
orbit_t_p = orbit.t_p | ||
|
||
assert_allclose(orbit_t_p.value, expected_t_p.value, rtol=1e-2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
src/poliastro/twobody/orbit.py
Outdated
@property | ||
def h_mom(self): | ||
"""Angular momentum. """ | ||
h_mom = np.linalg.norm(self.h_vec) * u.km ** 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using np.linalg.norm
, you can use poliastro.util.norm
, which respects the units
src/poliastro/twobody/orbit.py
Outdated
@@ -216,12 +216,29 @@ def h_vec(self): | |||
h_vec = np.cross(self.r.to(u.km).value, self.v.to(u.km / u.s)) * u.km ** 2 / u.s | |||
return h_vec | |||
|
|||
@property | |||
def h_mom(self): | |||
"""Angular momentum. """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that this is the specific angular momentum. In mechanics, they call "specific" to the magnitudes without mass, like this case, see https://www.wikiwand.com/en/Specific_relative_angular_momentum
Merging, thanks! |
Adds 3 orbit properties:
Angular momentum
Mean anomaly
Time elapsed from last perifocal passage
Tests taken from Curtis, H. D. (2005). Orbital mechanics for engineering students, p115, Example 3.1