[visionegg] smooth object motion
- From: "Gabriel Nevarez" <nevarezg@xxxxxxxxxxxxx>
- To: <visionegg@xxxxxxxxxxxxx>
- Date: Wed, 24 Aug 2005 00:36:48 +0100
Hello, all,
I was hoping to recode some multiple-object-tracking studies in VisionEgg. So,
thinking that it'd be nice that I finally get to do an object-oriented version
of an object-tracking program, I go about it, only to realize that the
interpreter overhead makes the final program too slow to be useful.
Essentially, I create anywhere from 1 to 10 objects, giving them individual
properties (i.e, size, shape, position, orientation, etc) and append them in a
list, then I iterate through their trajectories, themselves part of the object,
(generated offline and loaded before each trial) for each object, as such:
g_num_objects = 8
g_num_cycles = 1000
## in main experiment loop ##
for j in xrange (g_num_cycles):
for i in xrange(g_num_objects):
object_list[i].position = object_list[i].trajectory_list[j]
drawScreen()
It works exactly as intended.... but *horribly* slow!
Any suggestions on optimizing overall script speed? Have looked into the
generally-recommended performance-enhancing python tips (such as
http://www.szgti.bmf.hu/harp/python/fastpython.html), but seems the main speed
bottleneck is the interpreter moving up and down the call stack within the
embedded loops, so I would need to restructure the object position updates in a
different way from the embedded loops I currently have. I noticed the Dots.py
demo uses the Numeric package to optimize object movement, which I'm currently
looking into.
Any tips?
cheers,
-=Gabriel Nevarez
Research Programmer
Psychology Department
Cardiff University
http://www.cf.ac.uk/psych
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: smooth object motion
- From: Bertrand Guay-Paquet
- [visionegg] Re: smooth object motion
- From: Simeon Fitch
Other related posts:
- » [visionegg] smooth object motion
- » [visionegg] Re: smooth object motion
- » [visionegg] Re: smooth object motion
- » [visionegg] Re: smooth object motion
- [visionegg] Re: smooth object motion
- From: Bertrand Guay-Paquet
- [visionegg] Re: smooth object motion
- From: Simeon Fitch