bmer
2015-05-16 22:42:42 UTC
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.
`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.