Merge pull request #586 from sciunto/print

MIN: use print() instead of print
This commit is contained in:
Johannes Schönberger
2013-06-12 12:57:13 -07:00
19 changed files with 89 additions and 90 deletions
+4 -4
View File
@@ -34,14 +34,14 @@ def match_template(image, template, pad_input=False):
--------
>>> template = np.zeros((3, 3))
>>> template[1, 1] = 1
>>> print template
>>> print(template)
[[ 0. 0. 0.]
[ 0. 1. 0.]
[ 0. 0. 0.]]
>>> image = np.zeros((6, 6))
>>> image[1, 1] = 1
>>> image[4, 4] = -1
>>> print image
>>> print(image)
[[ 0. 0. 0. 0. 0. 0.]
[ 0. 1. 0. 0. 0. 0.]
[ 0. 0. 0. 0. 0. 0.]
@@ -49,13 +49,13 @@ def match_template(image, template, pad_input=False):
[ 0. 0. 0. 0. -1. 0.]
[ 0. 0. 0. 0. 0. 0.]]
>>> result = match_template(image, template)
>>> print np.round(result, 3)
>>> print(np.round(result, 3))
[[ 1. -0.125 0. 0. ]
[-0.125 -0.125 0. 0. ]
[ 0. 0. 0.125 0.125]
[ 0. 0. 0.125 -1. ]]
>>> result = match_template(image, template, pad_input=True)
>>> print np.round(result, 3)
>>> print(np.round(result, 3))
[[-0.125 -0.125 -0.125 0. 0. 0. ]
[-0.125 1. -0.125 0. 0. 0. ]
[-0.125 -0.125 -0.125 0. 0. 0. ]
+4 -4
View File
@@ -6,13 +6,13 @@ try:
# gui's pyos_inputhook.
window_manager.acquire('gtk')
except GuiLockError, gle:
print gle
print(gle)
else:
try:
import gtk
except ImportError:
print 'pygtk libraries not installed.'
print 'plugin not loaded.'
print('pygtk libraries not installed.')
print('plugin not loaded.')
window_manager._release('gtk')
else:
@@ -51,4 +51,4 @@ else:
window_manager.register_callback(gtk.main_quit)
gtk.main()
else:
print 'no images to display'
print('no images to display')
+4 -4
View File
@@ -52,8 +52,8 @@ def _scan_plugins():
for p in provides:
if not p in plugin_store:
print "Plugin `%s` wants to provide non-existent `%s`." \
" Ignoring." % (name, p)
print("Plugin `%s` wants to provide non-existent `%s`." \
" Ignoring." % (name, p))
plugin_provides[name] = valid_provides
plugin_module_name[name] = os.path.basename(f)[:-4]
@@ -208,8 +208,8 @@ def _load(plugin):
provides = plugin_provides[plugin]
for p in provides:
if not hasattr(plugin_module, p):
print "Plugin %s does not provide %s as advertised. Ignoring." % \
(plugin, p)
print("Plugin %s does not provide %s as advertised. Ignoring." % \
(plugin, p))
else:
store = plugin_store[p]
func = getattr(plugin_module, p)
+1 -1
View File
@@ -144,7 +144,7 @@ def _app_show():
if app and window_manager.has_windows():
app.exec_()
else:
print 'No images to show. See `imshow`.'
print('No images to show. See `imshow`.')
def imsave(filename, img, format_str=None):
+2 -2
View File
@@ -76,8 +76,8 @@ class WindowManager(object):
try:
self._windows.remove(win)
except ValueError:
print 'Unable to find referenced window in tracked windows.'
print 'Ignoring...'
print('Unable to find referenced window in tracked windows.')
print('Ignoring...')
else:
if len(self._windows) == 0:
self._exec_callback()
+1 -1
View File
@@ -98,7 +98,7 @@ class MultiImage(object):
>>> len(img)
2
>>> for frame in img:
... print frame.shape
... print(frame.shape)
(15, 10)
(15, 10)
+4 -4
View File
@@ -118,17 +118,17 @@ def label(input, DTYPE_t neighbors=8, DTYPE_t background=-1, return_num=False):
Examples
--------
>>> x = np.eye(3).astype(int)
>>> print x
>>> print(x)
[[1 0 0]
[0 1 0]
[0 0 1]]
>>> print m.label(x, neighbors=4)
>>> print(m.label(x, neighbors=4))
[[0 1 1]
[2 3 1]
[2 2 4]]
>>> print m.label(x, neighbors=8)
>>> print(m.label(x, neighbors=8))
[[0 1 1]
[1 0 1]
[1 1 0]]
@@ -137,7 +137,7 @@ def label(input, DTYPE_t neighbors=8, DTYPE_t background=-1, return_num=False):
... [1, 1, 5],
... [0, 0, 0]])
>>> print m.label(x, background=0)
>>> print(m.label(x, background=0))
[[ 0 -1 -1]
[ 0 0 1]
[-1 -1 -1]]
+1 -1
View File
@@ -6,7 +6,7 @@ def main():
import sys
if len(sys.argv) != 2:
print "Usage: skivi <image-file>"
print("Usage: skivi <image-file>")
sys.exit(-1)
io.use_plugin('qt')
+5 -5
View File
@@ -50,7 +50,7 @@ def montage2d(arr_in, fill='mean', rescale_intensity=False):
>>> import numpy as np
>>> from skimage.util.montage import montage2d
>>> arr_in = np.arange(3 * 2 * 2).reshape(3, 2, 2)
>>> print arr_in # doctest: +NORMALIZE_WHITESPACE
>>> print(arr_in) # doctest: +NORMALIZE_WHITESPACE
[[[ 0 1]
[ 2 3]]
[[ 4 5]
@@ -58,20 +58,20 @@ def montage2d(arr_in, fill='mean', rescale_intensity=False):
[[ 8 9]
[10 11]]]
>>> arr_out = montage2d(arr_in)
>>> print arr_out.shape
>>> print(arr_out.shape)
(4, 4)
>>> print arr_out
>>> print(arr_out)
[[ 0. 1. 4. 5. ]
[ 2. 3. 6. 7. ]
[ 8. 9. 5.5 5.5]
[ 10. 11. 5.5 5.5]]
>>> print arr_in.mean()
>>> print(arr_in.mean())
5.5
"""
assert arr_in.ndim == 3
n_images, height, width = arr_in.shape
arr_in = arr_in.copy()
# -- rescale intensity if necessary
+1 -1
View File
@@ -60,7 +60,7 @@ class LineTool(CanvasToolBase):
if on_enter is None:
def on_enter(pts):
x, y = np.transpose(pts)
print "length = %0.2f" % np.sqrt(np.diff(x)**2 + np.diff(y)**2)
print("length = %0.2f" % np.sqrt(np.diff(x)**2 + np.diff(y)**2))
self.callback_on_enter = on_enter
self.connect_event('button_press_event', self.on_mouse_press)