Below is a copy of the example Plotting in 3D. I can run the just fine in Firefox. However, when I copy the code to Jupyter Notebook and attempt to run the same code (shown below), I get the errors below.
Have I missed something? Please advise.
Sam Dupree.
'''
import numpy as np
from poliastro.examples import iss
from poliastro.examples import molniya
from poliastro.constants import J2000
from poliastro.examples import *
from poliastro.plotting import *
import plotly.io as pio
pio.renderers.default = "notebook_connected"
churi.plot(interactive=True, use_3d=True)
frame = OrbitPlotter3D()
frame.plot(churi)
frame.plot_body_orbit(Earth, J2000)
frame = OrbitPlotter3D()
frame.plot(molniya)
frame.plot(iss)
eros = Orbit.from_sbdb("eros")
frame = OrbitPlotter3D()
frame.plot_body_orbit(Earth, J2000)
frame.plot(eros, label="eros")
from poliastro.ephem import Ephem
from poliastro.util import time_range
date_launch = time.Time("2011-11-26 15:02", scale="utc").tdb
date_arrival = time.Time("2012-08-06 05:17", scale="utc").tdb
earth = Ephem.from_body(
Earth, time_range(date_launch, end=date_arrival, periods=50)
)
frame = OrbitPlotter3D()
frame.set_attractor(Sun)
frame.plot_body_orbit(Earth, J2000, label=Earth)
ValueError Traceback (most recent call last)
18
19 frame.plot(churi)
---> 20 frame.plot_body_orbit(Earth, J2000)
21
22 frame = OrbitPlotter3D()
~/opt/anaconda3/lib/python3.8/site-packages/poliastro/plotting/core.py in plot_body_orbit(self, body, epoch, label, color, trail)
96
97 """
---> 98 super().plot_body_orbit(body, epoch, label=label, color=color, trail=trail)
99
100 if not self._figure._in_batch_mode:
~/opt/anaconda3/lib/python3.8/site-packages/poliastro/plotting/_base.py in plot_body_orbit(self, body, epoch, label, color, trail)
265 # Do not return the result of self._plot
266 # This behavior might be overriden by subclasses
--> 267 self._plot_body_orbit(body, epoch, label=label, color=color, trail=trail)
268
269 def plot_ephem(self, ephem, epoch=None, *, label=None, color=None, trail=False):
~/opt/anaconda3/lib/python3.8/site-packages/poliastro/plotting/_base.py in _plot_body_orbit(self, body, epoch, label, color, trail)
169 period = get_mean_elements(body, epoch).period
170
--> 171 label = generate_label(epoch, label or str(body))
172 epochs = time_range(
173 epoch, periods=self._num_points, end=epoch + period, scale="tdb"
~/opt/anaconda3/lib/python3.8/site-packages/poliastro/plotting/util.py in generate_label(epoch, label)
18 def generate_label(epoch, label):
19 epoch = epoch.copy()
---> 20 epoch.out_subfmt = "date_hm"
21 label_ = f"{epoch.iso}"
22 if label:
~/opt/anaconda3/lib/python3.8/site-packages/astropy/time/core.py in out_subfmt(self, val)
620 def out_subfmt(self, val):
621 # Setting the out_subfmt property here does validation of val
--> 622 self._time.out_subfmt = val
623 del self.cache
624
~/opt/anaconda3/lib/python3.8/site-packages/astropy/time/formats.py in out_subfmt(self, subfmt)
181 def out_subfmt(self, subfmt):
182 # Validate subfmt value for this class, raises ValueError if not.
--> 183 self._select_subfmts(subfmt)
184 self._out_subfmt = subfmt
185
~/opt/anaconda3/lib/python3.8/site-packages/astropy/time/formats.py in _select_subfmts(cls, pattern)
394 if len(subfmts) == 0 and pattern != '*':
395 if len(cls.subfmts) == 0:
--> 396 raise ValueError(f'subformat not allowed for format {cls.name}')
397 else:
398 subfmt_names = [x[0] for x in cls.subfmts]
ValueError: subformat not allowed for format jyear_str
'''
Hello @OrbitalMechanic, Please check my reply here and check issue #1091 ... This has been reported previously as well
Hello @OrbitalMechanic To summarize:
Based on yourpip freeze output from an earlier issue, you have astropy==4.2 installed. Just downgrade to astropy==4.0 and it should work.
This is the most common issue we had in recent times :)
Hi @OrbitalMechanic , thanks for another diligent report! Indeed, as @Yash-10 has pointed out downgrading astropy should fix the issue, until we make a new release. We will do it in the coming weeks hopefully.
Does poliastro ver. 0.15.0 now support astropy ver. 4.2.x?
Does poliastro ver. 0.15.0 support astropy ver. 4.2.x?
Sam Dupree.
On April/03/2021 13:07:13, Juan Luis Cano RodrÃguez wrote:
>
Hi @OrbitalMechanic https://github.com/OrbitalMechanic , thanks for
another diligent report! Indeed, as @Yash-10
https://github.com/Yash-10 has pointed out downgrading astropy
should fix the issue, until we make a new release. We will do it in
the coming weeks hopefully.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/poliastro/poliastro/issues/1145#issuecomment-812894903,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABEO354OBB253D3RF2P2A2TTG5DMDANCNFSM42DIDOGA.
Hi @OrbitalMechanic! Yes, poliastro should work with Astropy 4.2. Could you please check, and report here if you find any issues?