[SciPy-User] Package recommendations for *efficiently* making good looking animations, or alternatively, how can I "predraw" matplotlib animation frames?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] Package recommendations for *efficiently* making good looking animations, or alternatively, how can I "predraw" matplotlib animation frames?

Brian Merchant
Hi all,

Right now, I am at the simulation stage in my modelling. I need to explore possible behaviours, in some parameter sets. In order to do this exploration, it is helpful to visualize the data via animation.

I started with matplotlib, but am disappointed with how long it takes to produce an animation using my data. It is also difficult for me to navigate matplotlib's documentation. Anyway, let me explain what I am doing right now.

Currently, my custom matplotlib animation (i.e. a class that inherit's from 

animation.TimedAnimation) class's `_draw_frame` method does this:


 1. get line data for timestep `n`
 2. update data of each line of interest in the axes with `set_data` (lets say for the sake of an example (`ax_line1.set_data(datax, datay`, where `ax_line1, = ax.plot(...)`)
 3. make a list of each line that was updated, and set `self._drawn_artists` to that (so in the example if two lines of interest are there, then we update them `self._drawn_artists = [ax_line1, ax_line2]`

Is there a way I can set the data in multiple copies of the line artists before `_draw_frame` is called? Then, all that `_draw_frame` has to do is fetch the predrawn lines, and update the drawn artist list with that.

That means that I set the artist data in parallel, if I have the data already, and thus produce an animation faster? I tried doing `copy.deepcopy` of the artists, but got an error telling me that I cannot do so (`TransformationNode` has to be frozen). What other options do I have?

At this point, I am totally open to exploring other packages apart from matplotlib, that may be recommended.

Kind regards,
Brian


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Package recommendations for *efficiently* making good looking animations, or alternatively, how can I "predraw" matplotlib animation frames?

Paul Kilgo
I can't comment much about matplotlib, but you might take a look at Vispy when exploring your options. It seems more geared toward interactive visualization which I think is what you're going for. It's pretty young and the documentation is mostly for reference, but they have a nice gallery of examples. I found it fairly easy to get up and going just from that.

That said, I only used their "lower-level" gloo API which I would say requires a fair amount of knowledge of OpenGL and GLSL. It looks like they are working on a higher-level API (they call it "visuals"). I didn't touch this at all.

I bet there is someone subscribed to this list who knows a lot more than me about it. :)

On Sun, Mar 8, 2015 at 5:40 PM Brian Merchant <[hidden email]> wrote:
Hi all,

Right now, I am at the simulation stage in my modelling. I need to explore possible behaviours, in some parameter sets. In order to do this exploration, it is helpful to visualize the data via animation.

I started with matplotlib, but am disappointed with how long it takes to produce an animation using my data. It is also difficult for me to navigate matplotlib's documentation. Anyway, let me explain what I am doing right now.

Currently, my custom matplotlib animation (i.e. a class that inherit's from 

animation.TimedAnimation) class's `_draw_frame` method does this:


 1. get line data for timestep `n`
 2. update data of each line of interest in the axes with `set_data` (lets say for the sake of an example (`ax_line1.set_data(datax, datay`, where `ax_line1, = ax.plot(...)`)
 3. make a list of each line that was updated, and set `self._drawn_artists` to that (so in the example if two lines of interest are there, then we update them `self._drawn_artists = [ax_line1, ax_line2]`

Is there a way I can set the data in multiple copies of the line artists before `_draw_frame` is called? Then, all that `_draw_frame` has to do is fetch the predrawn lines, and update the drawn artist list with that.

That means that I set the artist data in parallel, if I have the data already, and thus produce an animation faster? I tried doing `copy.deepcopy` of the artists, but got an error telling me that I cannot do so (`TransformationNode` has to be frozen). What other options do I have?

At this point, I am totally open to exploring other packages apart from matplotlib, that may be recommended.

Kind regards,
Brian

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Package recommendations for *efficiently* making good looking animations, or alternatively, how can I "predraw" matplotlib animation frames?

ralfgommers


On Mon, Mar 9, 2015 at 12:38 AM, Paul Kilgo <[hidden email]> wrote:
I can't comment much about matplotlib, but you might take a look at Vispy when exploring your options. It seems more geared toward interactive visualization which I think is what you're going for. It's pretty young and the documentation is mostly for reference, but they have a nice gallery of examples. I found it fairly easy to get up and going just from that.

That said, I only used their "lower-level" gloo API which I would say requires a fair amount of knowledge of OpenGL and GLSL. It looks like they are working on a higher-level API (they call it "visuals"). I didn't touch this at all.

I bet there is someone subscribed to this list who knows a lot more than me about it. :)

Probably. Asking on the Matplotlib list will likely generate more useful suggestions than this list though.

Ralf



On Sun, Mar 8, 2015 at 5:40 PM Brian Merchant <[hidden email]> wrote:
Hi all,

Right now, I am at the simulation stage in my modelling. I need to explore possible behaviours, in some parameter sets. In order to do this exploration, it is helpful to visualize the data via animation.

I started with matplotlib, but am disappointed with how long it takes to produce an animation using my data. It is also difficult for me to navigate matplotlib's documentation. Anyway, let me explain what I am doing right now.

Currently, my custom matplotlib animation (i.e. a class that inherit's from 

animation.TimedAnimation) class's `_draw_frame` method does this:


 1. get line data for timestep `n`
 2. update data of each line of interest in the axes with `set_data` (lets say for the sake of an example (`ax_line1.set_data(datax, datay`, where `ax_line1, = ax.plot(...)`)
 3. make a list of each line that was updated, and set `self._drawn_artists` to that (so in the example if two lines of interest are there, then we update them `self._drawn_artists = [ax_line1, ax_line2]`

Is there a way I can set the data in multiple copies of the line artists before `_draw_frame` is called? Then, all that `_draw_frame` has to do is fetch the predrawn lines, and update the drawn artist list with that.

That means that I set the artist data in parallel, if I have the data already, and thus produce an animation faster? I tried doing `copy.deepcopy` of the artists, but got an error telling me that I cannot do so (`TransformationNode` has to be frozen). What other options do I have?

At this point, I am totally open to exploring other packages apart from matplotlib, that may be recommended.

Kind regards,
Brian

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Package recommendations for *efficiently* making good looking animations, or alternatively, how can I "predraw" matplotlib animation frames?

Cyrille Rossant
In reply to this post by Paul Kilgo
2015-03-09 0:38 GMT+01:00 Paul Kilgo <[hidden email]>:
> I can't comment much about matplotlib, but you might take a look at Vispy
> when exploring your options. It seems more geared toward interactive
> visualization which I think is what you're going for.

Yes. Feel free to detail your use-case on
https://groups.google.com/forum/#!forum/vispy and we'll see
whether/how VisPy can help you.

Cyrille
_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user