cjm2671
cjm2671

Reputation: 19476

Python array visualizer for debugging

I'm working with image processing which means I'm doing operations on large matrices. I'm trying to debug which means I need to explore the elements, but it's a real pain doing it with print statements. Is there some kind of python plugin that will let me view arrays in a GUI for the purpose of debugging?

Upvotes: 2

Views: 3194

Answers (2)

dragon7
dragon7

Reputation: 1133

However, if you would like to display numpy array as an image, you can use OpenCV Image Viewer Plugin, which I've just released.

https://plugins.jetbrains.com/plugin/14371-opencv-image-viewer

enter image description here

Upvotes: 0

Joran Beasley
Joran Beasley

Reputation: 113988

yes just use the python debugger and put a break point

or use something like q

$ easy_install q

import q
my_array = numpy.arange(1000)
q.d() #open a terminal where you have access to my_array

you will see something like below

Python console opened by q.d() in <some_module>
>>> print my_array[5]

you can also use pill to generate an image from the array (not sure if it will work right without tweaking)

>>> import Image
>>> img = Image.fromarray(my_array, 'RGB')
>>> img.save('test.png')

Upvotes: 1

Related Questions