Hi folks, I'm using poliastro as a propagator to compare two satellite position paths and compare angles. How does one plot time vs vector magnitude?
Or remove the 'type' so I can use regular plotting tools?
Hi @cpbridges, thanks for your interest in poliastro!
I guess you don't need an OrbitPlotter for this. The challenge would be extracting the time history, which you could do writing something like this:
from astropy import units as u
from astropy.time import TimeDelta
from poliastro.twobody.propagation import propagate # The Orbit.propagate method hides some information
from poliastro.examples import iss
tofs = TimeDelta([10, 20, 30] * u.s, format="sec")
coords = propagate(iss, tofs)
# coords.get_xyz() gives the vector
# coords.x
# coords.y
# coords.z
import matplotlib.pyplot as plt
plt.plot(tofs.value, coords.x, tofs.value, coords.y, tofs.value, coords.z)
Please let us know if this is what you had in mind.
Hi @astrojuanlu - this is it!
I was doing something like:
for i in range(1, 90):
state = sat.propagate(i * u.min)
But clearly I need to rearrange this. I'll post my final solution today and close.
Thank you! Best wishes, Chris
Awesome! Let us know if you have any other questions 馃殌
Actually @astrojuanlu - I'm trying to do the vector magnitudes like:
satrange = state1.get_xyz() - state2.get_xyz()
satrange_mag = []
for i in range(0, 1000):
satrange_mag.append( np.linalg.norm(satrange[:,i]) )
satrange_mag2 = np.transpose(satrange_mag)
But am getting:
UnitConversionError: 'km' (length) and '' (dimensionless) are not convertible
...
TypeError: only dimensionless scalar quantities can be converted to Python scalars
I'm sure I've seen a poliastro vector mag function...
Perhaps you mean poliastro.util.norm?
Yes! I did this though:
satrange_mag = []
for i in range(0, 1000):
satrange_mag.append( np.linalg.norm(satrange[:,i]) )
There's def something more elegant in python I should be doing.
Now I'm just trying to resolve frames - going from J2000 to LME2000 around the Moon.
I see LME2000 is Moon Mean (Earth?) Equator of J2000. I don't think that this frame is defined in Astropy, _but_ I think it should be equivalent to poliastro.frames.equatorial.MoonICRS. And I suppose J2000 means either GCRS, so you should be able to transform between one and the other: https://docs.astropy.org/en/stable/coordinates/