ActiveState Community

Numpy arrays

Posted by markb on 2009-03-31 09:52

I have been evaluating Komodo IDE and was ready to commit to buy and then I ran into a major road block to productivity for me. I cannot seem to inspect any of the values in numpy created arrays while debugging. I can seem to do this just fine in Wing IDE, but I hate that interface, Komodo is so much nicer. Is there any work around for this? I can evaluate individual values from arrays in the shell, but this is really cumbersome.

toddw | Tue, 2009-03-31 11:10

Since the numpy array is a complex python object, Komodo's Locals exposes all of the underlying data structures of the numpy array, which I can see is not very helpful for a quick overview.

Given the following numpy code sample:

from numpy import *
a = array( [ 10, 20, 30, 40 ] )
print a
from numpy import *
a = array( [ 10, 20, 30, 40 ] )
print a

You can add a watch expression of "str(a)", such gives a better visual representation of this numpy data.

Another alternative is to turn on the Debugger->Show expression values in hover tooltips preference, then hovering over the a in this example will show a more friendly tooltip of the contents.

Is that what your needing?

Cheers,
Todd

markb | Tue, 2009-03-31 12:05

Yea, let me try that out. I think that will likely provide the quick peeks at the values while I work through some of these algorithms. For this to work though is there anyway to view both the Watch and Locals tabs at once?

I have been using matlab, but have been really impressed with Komodo and its functionality under Os X.

toddw | Tue, 2009-03-31 12:16

No, there is no way to combine the watch and local variables (at least not without some hacking of Komodo).

You can also submit an enhancement request:
http://bugs.activestate.com/enter_bug.cgi?product=komodo
for the Komodo debugger to also show a canonical string representation of the object, such as from "str()" or "repr()".

Cheers,
Todd