Issue with the examples
Opened this issue · 3 comments
Hi,
I tried to run plot_animation.py but the programs bugs at the first place line 68 with .fit and says that fit() got an unexpected keyword argument 'obs_std'. If I comment this argument it runs but the animation doesn't work (I just got one figure) and the program never stops by itself, I have to kill it.
I couldn't find if a package it's missing using the fit() function or if something else in the installation is wrong. Do you have any hints about what that could be?
In plot_J_surface.py the programs doesn't run and I get an error by line 73 for the fig function. The error
is the following
File "plot_J_surface.py", line 73, in
fig, (ax_cf, ax_df) = plt.subplots(figsize=(8, 3), ncols=2,constrained_layout=True)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 1176, in subplots
fig = figure(**fig_kw)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 539, in figure
**kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 170, in new_figure_manager
fig = fig_cls(*args, **kwargs)
TypeError: init() got an unexpected keyword argument 'constrained_layout'
If I comment out contrained_layout = True, then it works and creates a plot.
Thank you in advance for your help.
Best regards.
Oh no! Sorry about that. The docs are built against master and there was a recent update that renamed obs_var
to obs_std
. So, to get around that you can either remove the keyword like you already did or swap to obs_var
for now. This may be a good reason to make a new release though, so I will look into that.
To get the plot to stop after playing you can use the repeat keyword argument like so, FuncAnimation(..., repeat=False)
.
For the second error in plot_J_surface
, what version of Matplotlib are you using? constrained_layout
was somewhat recently introduced, so to get that working you may need to upgrade matplotlib pip install --upgrade matplotlib
. It is purely grid positioning and layout though, so nothing functional if you want to remove that.
Hi,
I tried to change the obs_std into obs_var that indeed works I don't get the error about the argument anymore. However, for the animation it actually doesn't work at all, I only get one plot and then a ton of errors, even though I put the FuncAnimation with an ending argument =False.
I'm interested to know how this example works because I would like to reproduce something similar with my data.
Here is the beginning of the error (the error is super long)
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.6/tkinter/init.py", line 1705, in call
return self.func(*args)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 233, in resize
self.show()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 304, in draw
FigureCanvasAgg.draw(self)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1299, in draw
renderer, self, artists, self.suppressComposite)
File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2437, in draw
For the plot_J_surface.py I made the update and it works now without error, thanks.
I have just released a new version on PyPI, so you should be able to pip install --upgrade pysecs
to get the latest changes.
For the animation errors: what matplotlib version are you using?
import matplotlib
print(matplotlib.__version__`)
You are trying to run this example? https://greglucas.github.io/pysecs/examples/plot_animation.html#sphx-glr-examples-plot-animation-py