This is what my animation function (i.e. the one that gets called by
`FuncAnimation`) looks like:

        import numpy as np
        ...
        def mpl_animation_function(n):
            print "animating timestep: ", n
            
            if n > 0:
                previous_relevant_patch_indices =
np.ravel(patch_indices_per_timestep[n-1])
                for index in previous_relevant_patch_indices:
                    (patches[index]).set_visible(False)
                    
            relevant_patch_indices = np.ravel(patch_indices_per_timestep[n])
            
            for index in relevant_patch_indices:
                (patches[index]).set_visible(True)
                
            return patches,

`patches` is a pre-generated list of patches (possibly large), that have
already been added to an `axes` instance.


This function is awfully time-consuming as the number of patches becomes
large. 

One idea I had was to parallelize the `for` loop, but likely that won't work
because of issues with the `axes` instance being accessed and modified in
parallel -- so I am afraid of fruitlessly spending time there. Do I have any
other options, or is parallelization possible?



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/What-are-my-options-for-speeding-up-a-custom-function-called-by-FuncAnimation-tp45562.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to