Skip to content

compilation failed - Attribute error in example I of continuos time convolution #31

@TheFabulousDeath

Description

@TheFabulousDeath

I tried running the example in Binder and locally and both versions had the same (lengthy) compilation error. I cut out the parts of the message that just referenced elements in conda, so here is the shortened one:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[5], line 6
      2 xB = h
      3 y = sp.integrate(xA.subs(t, t-tau) * xB.subs(t, tau),
      4                  (tau, 0, t))  # for causal signals
----> 6 anim = animate_convolution(
      7     x=xA,
      8     h=xB,
      9     y=y,
     10     td=np.arange(-2, 10, .1),
     11     taud=np.arange(-10, 10, 0.01),
     12     xlim=(-2, 5))
     13 anim

Cell In[2], line 63, in animate_convolution(x, h, y, td, taud, xlim)
     59     lines[3].set_data(ti, y_eval(ti))
     61     return lines
---> 63 return animation.FuncAnimation(fig, animate, td, interval=50, blit=True)

Cell In[2], line 51, in animate_convolution.<locals>.animate(ti)
     50 def animate(ti):
---> 51     ax[0].collections.clear()
     52     ax[0].fill_between(taud, 0, h_eval(ti, taud) *
     53                        x_eval(taud), facecolor='gray', alpha=0.3)
     55     lines[0].set_data(taud, h_eval(ti, taud))

AttributeError: 'ArtistList' object has no attribute 'clear'

Changing line 51 from ax[0].collections.clear() to ax[0].clear() fixed the compilation error, however I don't know if the result is the intended one.

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplots.html - the documentation for the command used to create the subplot of which the collection was tried to be deleted.

Thank you so much for providing this platform, it's much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions