Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot propagate orbits around custom bodies #654

Closed
Juanlu001 opened this issue Apr 29, 2019 · 3 comments

Comments

@Juanlu001
Copy link
Member

commented Apr 29, 2019

Even after fixing the case of sampling #649, orbits around custom bodies still can't be propagated:

>>> from poliastro.twobody import Orbit
>>> from poliastro.bodies import Moon
>>> from astropy import units as u
>>> orb = Orbit.from_vectors(Moon, [-17621.48704193,   9218.72943252, -10947.19144579] * u.km, [ -6985.91793854, -13970.02807282,  -7272.34554685] * u.km / u.day)
>>> orb
2211 x 22792 km x 36.0 deg orbit around Moon (☾) at epoch J2000.000 (TT)
>>> orb.sample(3)
/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py:1082: UserWarning:

No frame found for attractor Moon (☾), returning only cartesian coordinates instead

<CartesianRepresentation (x, y, z) in km
    [(  1738.77087758, -814.03020271,   1096.10391796),
     (-17926.29064628, 8392.44675468, -11300.55584963),
     (  1738.77087758, -814.03020271,   1096.10391796)]
 (has differentials w.r.t.: 's')>
>>> orb.propagate(orb.period / 2)
Traceback (most recent call last):
  File "/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/frames.py", line 337, in get_frame
    frames = _FRAME_MAPPING[attractor]
KeyError: Moon (☾)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py", line 913, in propagate
    if "obstime" in self.frame.frame_attributes:
  File "/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py", line 101, in frame
    self._frame = get_frame(self.attractor, self._plane, self.epoch)
  File "/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/frames.py", line 340, in get_frame
    "Frames for orbits around custom bodies are not yet supported"
NotImplementedError: Frames for orbits around custom bodies are not yet supported

To fix this, we should:

  1. Add a test, similar to #650, but using .propagate instead of .sample
  2. Try a similar logic to propagate orbits without frames
@aerophile

This comment has been minimized.

Copy link

commented May 3, 2019

Hi, can I try this resolving this one ?

@Juanlu001

This comment has been minimized.

Copy link
Member Author

commented May 3, 2019

@aerophile all yours :)

@Juanlu001 Juanlu001 self-assigned this May 5, 2019

@Juanlu001

This comment has been minimized.

Copy link
Member Author

commented May 5, 2019

Sorry, assigning this to myself as it's critical for our "customers" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.