COSMIT fix ugly line breaks.

This commit is contained in:
Andreas Mueller
2012-06-22 23:40:42 +02:00
parent 9f34c84f1a
commit ee0fd867da
9 changed files with 29 additions and 32 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ class TestTvDenoise():
grad_denoised = ndimage.morphological_gradient(
denoised_lena, size=((3, 3)))
# test if the total variation has decreased
assert np.sqrt(
(grad_denoised ** 2).sum()) < np.sqrt((grad ** 2).sum()) / 2
assert (np.sqrt((grad_denoised ** 2).sum())
< np.sqrt((grad ** 2).sum()) / 2)
denoised_lena_int = filter.tv_denoise(img_as_uint(lena),
weight=60.0, keep_type=True)
assert denoised_lena_int.dtype is np.dtype('uint16')
+2 -2
View File
@@ -252,8 +252,8 @@ def tv_denoise(im, weight=50, eps=2.e-4, keep_type=False, n_iter_max=200):
elif im.ndim == 3:
out = _tv_denoise_3d(im, weight, eps, n_iter_max)
else:
raise ValueError(
'only 2-d and 3-d images may be denoised with this function')
raise ValueError('only 2-d and 3-d images may be denoised with this'
'function')
if keep_type:
return out.astype(im_type)
else:
+1 -1
View File
@@ -145,7 +145,7 @@ def _test_random(shape):
starts = [[0] * len(shape), [-1] * len(shape),
(np.random.random(len(shape)) * shape).astype(int)]
ends = [(np.random.random(len(shape)) * shape).astype(int)
for i in range(4)]
for i in range(4)]
m = mcp.MCP(a, fully_connected=True)
costs, offsets = m.find_costs(starts)
for point in [(np.random.random(len(shape)) * shape).astype(int)
+3 -4
View File
@@ -1,7 +1,6 @@
# the module for the qt color_mixer plugin
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import (QWidget, QStackedWidget, QSlider, QVBoxLayout,
QGridLayout, QLabel)
from PyQt4.QtGui import (QWidget, QStackedWidget, QSlider, QGridLayout, QLabel)
from util import ColorMixer
@@ -36,8 +35,8 @@ class IntelligentSlider(QWidget):
self.name_label.setAlignment(QtCore.Qt.AlignCenter)
self.value_label = QLabel()
self.value_label.setText(
'%2.2f' % (self.slider.value() * self.a + self.b))
self.value_label.setText('%2.2f' % (self.slider.value() * self.a
+ self.b))
self.value_label.setAlignment(QtCore.Qt.AlignCenter)
self.layout = QGridLayout(self)
+2 -3
View File
@@ -64,8 +64,8 @@ class WindowManager(object):
self._gui_lock = False
self._guikit = ''
else:
raise RuntimeError(
'Only the toolkit that owns the lock may release it')
raise RuntimeError('Only the toolkit that owns the lock may'
'release it')
def add_window(self, win):
self._check_locked()
@@ -191,7 +191,6 @@ class ImgThread(threading.Thread):
class ThreadDispatch(object):
def __init__(self, img, stateimg, func, *args):
width = img.shape[1]
height = img.shape[0]
self.cores = CPU_COUNT
self.threads = []
+4 -4
View File
@@ -118,8 +118,8 @@ class MultiImage(object):
if -numframes <= n < numframes:
n = n % numframes
else:
raise IndexError(
"There are only %s frames in the image" % numframes)
raise IndexError("There are only %s frames in the image"
% numframes)
if self.conserve_memory:
if not self._cached == n:
@@ -280,8 +280,8 @@ class ImageCollection(object):
if -num <= n < num:
n = n % num
else:
raise IndexError(
"There are only %s images in the collection" % num)
raise IndexError("There are only %s images in the collection"
% num)
return n
def __iter__(self):
+2 -2
View File
@@ -85,8 +85,8 @@ def test_metadata():
assert meta[('EXIF_MAIN', 'Orientation')] == 1
assert meta[('EXIF_MAIN', 'Software')].startswith('ImageMagick')
meta = fi.read_multipage_metadata(
os.path.join(si.data_dir, 'multipage.tif'))
meta = fi.read_multipage_metadata(os.path.join(si.data_dir,
'multipage.tif'))
assert len(meta) == 2
assert meta[0][('EXIF_MAIN', 'Orientation')] == 1
assert meta[1][('EXIF_MAIN', 'Software')].startswith('ImageMagick')
+1 -2
View File
@@ -13,8 +13,7 @@ class TestPrepareForDisplay:
assert x.dtype == np.dtype(np.uint8)
def test_grey(self):
x = prepare_for_display(
np.arange(12, dtype=float).reshape((4, 3)) / 11.)
x = prepare_for_display(np.arange(12, dtype=float).reshape((4, 3)) / 11)
assert_array_equal(x[..., 0], x[..., 2])
assert x[0, 0, 0] == 0
assert x[3, 2, 0] == 255
+12 -12
View File
@@ -1,6 +1,5 @@
import numpy as np
import os
import time
from skimage.io import ImageCollection
try:
@@ -57,8 +56,8 @@ class CvVideo(object):
else:
cv.Resize(img, cv.fromarray(img_mat))
# opencv stores images in BGR format
cv.CvtColor(
cv.fromarray(img_mat), cv.fromarray(img_mat), cv.CV_BGR2RGB)
cv.CvtColor(cv.fromarray(img_mat), cv.fromarray(img_mat),
cv.CV_BGR2RGB)
return img_mat
def seek_frame(self, frame_number):
@@ -70,8 +69,8 @@ class CvVideo(object):
frame_number : int
Frame position
"""
cv.SetCaptureProperty(
self.capture, cv.CV_CAP_PROP_POS_FRAMES, frame_number)
cv.SetCaptureProperty(self.capture, cv.CV_CAP_PROP_POS_FRAMES,
frame_number)
def seek_time(self, milliseconds):
"""
@@ -82,8 +81,8 @@ class CvVideo(object):
milliseconds : int
Time position
"""
cv.SetCaptureProperty(
self.capture, cv.CV_CAP_PROP_POS_MSEC, milliseconds)
cv.SetCaptureProperty(self.capture, cv.CV_CAP_PROP_POS_MSEC,
milliseconds)
def frame_count(self):
"""
@@ -120,9 +119,9 @@ class GstVideo(object):
size: tuple, optional
Size of returned array.
sync: bool, optional (default False)
Frames are extracted per frame or per time basis.
If enabled the video time step continues onward according to the play rate.
Useful for ip cameras and other real time video feeds.
Frames are extracted per frame or per time basis. If enabled the video
time step continues onward according to the play rate. Useful for ip
cameras and other real time video feeds.
"""
def __init__(self, source=None, size=None, sync=False):
if not gstreamer_available:
@@ -178,7 +177,7 @@ class GstVideo(object):
self.appsink.set_property('caps', gst.caps_from_string(caps))
if self.pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_FAILURE:
raise NameError("Failed to load video source %s" % self.source)
buff = self.appsink.emit('pull-preroll')
self.appsink.emit('pull-preroll')
def get(self):
"""
@@ -190,7 +189,8 @@ class GstVideo(object):
Retrieved image.
"""
buff = self.appsink.emit('pull-buffer')
img_mat = np.ndarray(shape=(self.size[1], self.size[0], 3), dtype=np.uint8, buffer=buff.data)
img_mat = np.ndarray(shape=(self.size[1], self.size[0], 3),
dtype=np.uint8, buffer=buff.data)
return img_mat
def seek_frame(self, frame_number):