Hello, I am a aeropace engineering master student and I was trying to use the poliastro environment to perform a project for one of my classes.
I was trying to use the code to implement the J2 perturbation (the code I found here) when I encountered the following error:
TypeError Traceback (most recent call last)
<ipython-input-3-5de11052fd1e> in <module>
15 tofs = TimeDelta(np.linspace(0 * u.h, 100000 * u.s, num=2000))
16
---> 17 rr = propagate(
18 orbit,
19 tofs,
~\anaconda3\lib\site-packages\poliastro\twobody\propagation.py in propagate(orbit, time_of_flight, method, rtol, **kwargs)
465 pass
466
--> 467 rr, vv = method(
468 orbit.attractor.k,
469 orbit.r,
TypeError: cowell() got an unexpected keyword argument 'ad'
This happened not only for the J2 perturbation but I also tried with the 3rd body code and got the same result. Maybe it is a problem with my poliastro version (I have the 0.15.dev0) because I checked with a friends computer and everything worked for him.
Thank you in advance and sorry for any incoveniences. :)
Hello @ana-cp, Thank you for using Poliastro.
I would like to bring to your notice that the cowell() function defined here is undergoing some changes, in the development version, to incorporate a faster implementation. The current implementation doesn't take into account the argument ad.
I would suggest that you install, the 1.14.0 version of the library & please try to re-run the examples again. Kindly let us know for any further assistance 馃槃
Welcome @ana-cp , and thanks @DhruvSondhi for chiming in! The documentation you linked is the stable version, which works with poliastro 0.14.0:
https://docs.poliastro.space/en/stable/examples/Natural%20and%20artificial%20perturbations.html
But, if you want to use the development version (master branch on GitHub), you will need to check out this instead:
https://docs.poliastro.space/en/latest/examples/Natural%20and%20artificial%20perturbations.html
Notice that cowell doesn't receive ad anymore, but a function that describes the two-body motion:
def f(t0, state, k):
du_kep = func_twobody(t0, state, k)
ax, ay, az = atmospheric_drag_exponential(
t0,
state,
k,
R=R,
C_D=C_D,
A_over_m=A_over_m,
H0=H0,
rho0=rho0,
)
du_ad = np.array([0, 0, 0, ax, ay, az])
return du_kep + du_ad
rr = propagate(
orbit,
tofs,
method=cowell,
f=f,
)
Let us know if this fixes the issue :)
Hello @astrojuanlu and @DhruvSondhi, thank you for your assistance and for your fast answer!
I tried using the development version for my problem but it did not work as I got a different error; so I downloaded the previous version of poliastro (0.14.0) as you suggested and then it worked. Thank you a lot and sorry for any inconvenience! :)
Most helpful comment
Hello @astrojuanlu and @DhruvSondhi, thank you for your assistance and for your fast answer!
I tried using the development version for my problem but it did not work as I got a different error; so I downloaded the previous version of poliastro (
0.14.0) as you suggested and then it worked. Thank you a lot and sorry for any inconvenience! :)