3D maneuvers and docstrings - #599
Conversation
|
The reason why Python 3.5 tests are failing is because of numba/llvmlite#471. Options:
Note that this is not actually a problem: it just makes the installation more cumbersome (ah, the good old times without wheels...). |
|
My sorry attempt to fix this in a quick way failed. Will continue in another PR, sorry for the noise. |
Still having test errors Adapt to black Adapt to tox
| t_trans2 = (np.pi * np.sqrt((r_i * (R + Rs) / 2) ** 3 / k)).decompose() | ||
| r_i = orbit_i.r | ||
| v_i = orbit_i.v | ||
| h_i = norm(cross(r_i.to(u.m), v_i.to(u.m / u.s)) * u.m ** 2 / u.s) |
There was a problem hiding this comment.
| h_i = norm(cross(r_i.to(u.m), v_i.to(u.m / u.s)) * u.m ** 2 / u.s) | |
| h_i = norm(cross(r_i.to(u.m), v_i.to(u.m / u.s))) |
There was a problem hiding this comment.
I tried to supress those units as suggested but then the tests did not passed, since the following exception is raised:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-15-1ae6b7d64845> in <module>
1 orbit_i = Orbit.circular(Earth, alt=191.34411 * u.km, inc=0*u.deg)
----> 2 hohmann(orbit_i, r_f=35781.34857*u.km + Earth.R)
<ipython-input-14-a8a7f89cc4a4> in hohmann(orbit_i, r_f)
29
30 #h_i = norm((cross(r_i.to(u.m), v_i.to(u.m / u.s)))) * u.m ** 2 / u.s
---> 31 h_i = norm(cross(r_i.to(u.m), v_i.to(u.m / u.s)))
32 print(h_i)
33 p = h_i ** 2 / k.to(u.m**3 / u.s**2)
~/Documentos/Github/poliastro/src/poliastro/util.py in norm(vec)
79
80 """
---> 81 return norm_fast(vec.value) * vec.unit
82
83
AttributeError: 'numpy.ndarray' object has no attribute 'value'
There was a problem hiding this comment.
Oops, perhaps * u.m ** 2 / u.s has to be outside of the parentheses?
There was a problem hiding this comment.
There we go! The thing was with the core functions. Do you think it would be interesting to implement them (rv_pqw, pqw2ijk, cross) in the high level api, like for example the util.norm function?
There was a problem hiding this comment.
Maybe! Let's leave that for a future PR :)
One last try
Codecov Report
@@ Coverage Diff @@
## master #599 +/- ##
==========================================
+ Coverage 84.95% 85.03% +0.08%
==========================================
Files 51 51
Lines 2360 2386 +26
Branches 181 183 +2
==========================================
+ Hits 2005 2029 +24
Misses 308 308
- Partials 47 49 +2
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #599 +/- ##
==========================================
+ Coverage 84.95% 85.03% +0.08%
==========================================
Files 51 51
Lines 2360 2386 +26
Branches 181 183 +2
==========================================
+ Hits 2005 2029 +24
Misses 308 308
- Partials 47 49 +2
Continue to review full report at Codecov.
|
|
Thanks a lot @jorgepiloto! It took a lot of time but it was worth it 🎉 |
|
@jorgepiloto I notice we didn't add any new tests to this pull request. Can you please find an example of a Hohmann transfer that could not be done before it, that now works? |
This PR enables to compute the different maneuvers (Hohmann and Bielliptic) no matter the inclination of the orbit. Also the corresponding docstrings have been included for each function.
I reopened due to an strange error in previous PR.