-
Notifications
You must be signed in to change notification settings - Fork 67
Closed
Description
There are a number of failing tests observed with pytest pims/tests/test_common.py
(29 tests fail).
It looks like for most of these, the actual vs expected integer array values are off by either 1 or 2 for a relatively substantial proportion of the pixels in the arrays.
Here is a copy of the output from pytest pims/tests/test_common.py
(click to expand details):
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
__________________ TestVideo_PyAV_indexed.test_getting_slice ___________________
self = <pims.tests.test_common.TestVideo_PyAV_indexed testMethod=test_getting_slice>
def test_getting_slice(self):
self.check_skip()
tmp = list(self.v[0:2])
frame0, frame1 = tmp
> assert_image_equal(frame0, self.frame0)
pims/tests/test_common.py:278:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
------------------------------ Captured log call -------------------------------
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
_____________________ TestVideo_PyAV_indexed.test_iterator _____________________
self = <pims.tests.test_common.TestVideo_PyAV_indexed testMethod=test_iterator>
def test_iterator(self):
self.check_skip()
i = iter(self.v)
> assert_image_equal(next(i), self.frame0)
pims/tests/test_common.py:271:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
------------------------------ Captured log call -------------------------------
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
_________________ TestVideo_PyAV_indexed.test_pipeline_simple __________________
self = <pims.tests.test_common.TestVideo_PyAV_indexed testMethod=test_pipeline_simple>
def test_pipeline_simple(self):
rescale = pims.pipeline(_rescale)
rescaled_v = rescale(self.v[:1])
> assert_image_equal(rescaled_v[0], _rescale(self.frame0))
pims/tests/test_common.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[0.86231884, 0.72463768, 0.20289855],
[0.86231884, 0.72463768, 0.20289855],
[0.86231884, 0.724... 0.7173913 , 0.21014493],
[0.8115942 , 0.67391304, 0.20289855],
[0.79710145, 0.65942029, 0.1884058 ]]])
expected = array([[[0.86330935, 0.71223022, 0.20143885],
[0.86330935, 0.71223022, 0.20143885],
[0.86330935, 0.712... 0.70503597, 0.20863309],
[0.81294964, 0.66906475, 0.20143885],
[0.79856115, 0.65467626, 0.18705036]]])
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
assert_equal(actual, expected)
else:
if np.issubdtype(expected.dtype, np.integer):
expected = expected/float(np.iinfo(expected.dtype).max)
> assert_allclose(actual, expected, atol=1/256.)
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0.00390625
E
E Mismatched elements: 387898 / 814080 (47.6%)
E Max absolute difference: 0.01308518
E Max relative difference: 0.32850242
E x: Frame([[[0.862319, 0.724638, 0.202899],
E [0.862319, 0.724638, 0.202899],
E [0.862319, 0.724638, 0.217391],...
E y: array([[[0.863309, 0.71223 , 0.201439],
E [0.863309, 0.71223 , 0.201439],
E [0.863309, 0.71223 , 0.215827],...
pims/tests/test_common.py:75: AssertionError
------------------------------ Captured log call -------------------------------
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
________________ TestVideo_PyAV_indexed.test_pipeline_with_args ________________
self = <pims.tests.test_common.TestVideo_PyAV_indexed testMethod=test_pipeline_with_args>
def test_pipeline_with_args(self):
color_channel = pims.pipeline(_color_channel)
red = color_channel(self.v, 0)
green = color_channel(self.v, 1)
> assert_image_equal(red[0], _color_channel(self.frame0, 0))
pims/tests/test_common.py:318:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[146, 146, 146, ..., 140, 141, 142],
[146, 146, 146, ..., 140, 142, 142],
[146, 146, 146, ..., 14..., 129, 120, 119],
[146, 146, 145, ..., 137, 129, 126],
[146, 146, 145, ..., 145, 139, 137]], dtype=uint8)
expected = array([[146, 146, 146, ..., 140, 141, 142],
[146, 146, 146, ..., 140, 142, 142],
[146, 146, 146, ..., 14..., 129, 120, 119],
[146, 146, 145, ..., 137, 129, 126],
[146, 146, 145, ..., 145, 139, 137]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 95024 / 271360 (35%)
E Max absolute difference: 1
E Max relative difference: 0.00877193
E x: Frame([[146, 146, 146, ..., 140, 141, 142],
E [146, 146, 146, ..., 140, 142, 142],
E [146, 146, 146, ..., 141, 143, 144],...
E y: array([[146, 146, 146, ..., 140, 141, 142],
E [146, 146, 146, ..., 140, 142, 142],
E [146, 146, 146, ..., 141, 143, 144],...
pims/tests/test_common.py:71: AssertionError
------------------------------ Captured log call -------------------------------
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
__________________ TestVideo_PyAV_indexed.test_slice_of_slice __________________
self = <pims.tests.test_common.TestVideo_PyAV_indexed testMethod=test_slice_of_slice>
def test_slice_of_slice(self):
# More thorough recursive slicing tests, making use of more than
# the two frames available for these tests, are elsewhere:
# see test_recursive_slicing.
self.check_skip()
tmp = self.v[0:2]
tmp1 = tmp[1:]
frame1 = tmp1[0]
> assert_image_equal(frame1, self.frame1)
pims/tests/test_common.py:289:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 126, 59],
...,
[137, 118, 53],
...[145, 125, 62],
...,
[147, 128, 58],
[140, 121, 56],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 124, 58],
...,
[137, 117, 52],
...[145, 125, 61],
...,
[147, 126, 57],
[140, 120, 55],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 613964 / 814080 (75.4%)
E Max absolute difference: 2
E Max relative difference: 0.04
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 126, 59],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 124, 58],...
pims/tests/test_common.py:71: AssertionError
------------------------------ Captured log call -------------------------------
WARNING libav.swscaler:pyav_reader.py:389 deprecated pixel format used, make sure you did set range correctly
WARNING libav.swscaler:pyav_reader.py:389 No accelerated colorspace conversion found from yuv420p to rgb24.
_____________________ TestVideo_ImageIO.test_getting_list ______________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_getting_list>
def test_getting_list(self):
self.check_skip()
actual = list(self.v[[1, 0, 0, 1, 1]])
expected = [self.frame1, self.frame0, self.frame0, self.frame1,
self.frame1]
> [assert_image_equal(a, b) for a, b in zip(actual, expected)]
pims/tests/test_common.py:357:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pims/tests/test_common.py:357: in <listcomp>
[assert_image_equal(a, b) for a, b in zip(actual, expected)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 126, 59],
...,
[137, 118, 53],
...[145, 125, 62],
...,
[147, 128, 58],
[140, 121, 56],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 124, 58],
...,
[137, 117, 52],
...[145, 125, 61],
...,
[147, 126, 57],
[140, 120, 55],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 613964 / 814080 (75.4%)
E Max absolute difference: 2
E Max relative difference: 0.04
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 126, 59],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 124, 58],...
pims/tests/test_common.py:71: AssertionError
_________________ TestVideo_ImageIO.test_getting_single_frame __________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_getting_single_frame>
def test_getting_single_frame(self):
self.check_skip()
> assert_image_equal(self.v[0], self.frame0)
pims/tests/test_common.py:347:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
_____________________ TestVideo_ImageIO.test_getting_slice _____________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_getting_slice>
def test_getting_slice(self):
self.check_skip()
tmp = list(self.v[0:2])
frame0, frame1 = tmp
> assert_image_equal(frame0, self.frame0)
pims/tests/test_common.py:278:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
_______________________ TestVideo_ImageIO.test_iterator ________________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_iterator>
def test_iterator(self):
self.check_skip()
i = iter(self.v)
> assert_image_equal(next(i), self.frame0)
pims/tests/test_common.py:271:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
____________________ TestVideo_ImageIO.test_pipeline_simple ____________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_pipeline_simple>
def test_pipeline_simple(self):
rescale = pims.pipeline(_rescale)
rescaled_v = rescale(self.v[:1])
> assert_image_equal(rescaled_v[0], _rescale(self.frame0))
pims/tests/test_common.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[0.86231884, 0.72463768, 0.20289855],
[0.86231884, 0.72463768, 0.20289855],
[0.86231884, 0.724... 0.7173913 , 0.21014493],
[0.8115942 , 0.67391304, 0.20289855],
[0.79710145, 0.65942029, 0.1884058 ]]])
expected = array([[[0.86330935, 0.71223022, 0.20143885],
[0.86330935, 0.71223022, 0.20143885],
[0.86330935, 0.712... 0.70503597, 0.20863309],
[0.81294964, 0.66906475, 0.20143885],
[0.79856115, 0.65467626, 0.18705036]]])
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
assert_equal(actual, expected)
else:
if np.issubdtype(expected.dtype, np.integer):
expected = expected/float(np.iinfo(expected.dtype).max)
> assert_allclose(actual, expected, atol=1/256.)
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0.00390625
E
E Mismatched elements: 387898 / 814080 (47.6%)
E Max absolute difference: 0.01308518
E Max relative difference: 0.32850242
E x: Frame([[[0.862319, 0.724638, 0.202899],
E [0.862319, 0.724638, 0.202899],
E [0.862319, 0.724638, 0.217391],...
E y: array([[[0.863309, 0.71223 , 0.201439],
E [0.863309, 0.71223 , 0.201439],
E [0.863309, 0.71223 , 0.215827],...
pims/tests/test_common.py:75: AssertionError
__________________ TestVideo_ImageIO.test_pipeline_with_args ___________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_pipeline_with_args>
def test_pipeline_with_args(self):
color_channel = pims.pipeline(_color_channel)
red = color_channel(self.v, 0)
green = color_channel(self.v, 1)
> assert_image_equal(red[0], _color_channel(self.frame0, 0))
pims/tests/test_common.py:318:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[146, 146, 146, ..., 140, 141, 142],
[146, 146, 146, ..., 140, 142, 142],
[146, 146, 146, ..., 14..., 129, 120, 119],
[146, 146, 145, ..., 137, 129, 126],
[146, 146, 145, ..., 145, 139, 137]], dtype=uint8)
expected = array([[146, 146, 146, ..., 140, 141, 142],
[146, 146, 146, ..., 140, 142, 142],
[146, 146, 146, ..., 14..., 129, 120, 119],
[146, 146, 145, ..., 137, 129, 126],
[146, 146, 145, ..., 145, 139, 137]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 95024 / 271360 (35%)
E Max absolute difference: 1
E Max relative difference: 0.00877193
E x: Frame([[146, 146, 146, ..., 140, 141, 142],
E [146, 146, 146, ..., 140, 142, 142],
E [146, 146, 146, ..., 141, 143, 144],...
E y: array([[146, 146, 146, ..., 140, 141, 142],
E [146, 146, 146, ..., 140, 142, 142],
E [146, 146, 146, ..., 141, 143, 144],...
pims/tests/test_common.py:71: AssertionError
____________________ TestVideo_ImageIO.test_slice_of_slice _____________________
self = <pims.tests.test_common.TestVideo_ImageIO testMethod=test_slice_of_slice>
def test_slice_of_slice(self):
# More thorough recursive slicing tests, making use of more than
# the two frames available for these tests, are elsewhere:
# see test_recursive_slicing.
self.check_skip()
tmp = self.v[0:2]
tmp1 = tmp[1:]
frame1 = tmp1[0]
> assert_image_equal(frame1, self.frame1)
pims/tests/test_common.py:289:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 126, 59],
...,
[137, 118, 53],
...[145, 125, 62],
...,
[147, 128, 58],
[140, 121, 56],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 124, 58],
...,
[137, 117, 52],
...[145, 125, 61],
...,
[147, 126, 57],
[140, 120, 55],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 613964 / 814080 (75.4%)
E Max absolute difference: 2
E Max relative difference: 0.04
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 126, 59],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 124, 58],...
pims/tests/test_common.py:71: AssertionError
_____________________ TestVideo_MoviePy.test_getting_list ______________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_getting_list>
def test_getting_list(self):
self.check_skip()
actual = list(self.v[[1, 0, 0, 1, 1]])
expected = [self.frame1, self.frame0, self.frame0, self.frame1,
self.frame1]
> [assert_image_equal(a, b) for a, b in zip(actual, expected)]
pims/tests/test_common.py:357:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pims/tests/test_common.py:357: in <listcomp>
[assert_image_equal(a, b) for a, b in zip(actual, expected)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 126, 59],
...,
[137, 118, 53],
...[145, 125, 62],
...,
[147, 128, 58],
[140, 121, 56],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 124, 58],
...,
[137, 117, 52],
...[145, 125, 61],
...,
[147, 126, 57],
[140, 120, 55],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 613964 / 814080 (75.4%)
E Max absolute difference: 2
E Max relative difference: 0.04
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 126, 59],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 124, 58],...
pims/tests/test_common.py:71: AssertionError
_________________ TestVideo_MoviePy.test_getting_single_frame __________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_getting_single_frame>
def test_getting_single_frame(self):
self.check_skip()
> assert_image_equal(self.v[0], self.frame0)
pims/tests/test_common.py:347:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
_____________________ TestVideo_MoviePy.test_getting_slice _____________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_getting_slice>
def test_getting_slice(self):
self.check_skip()
tmp = list(self.v[0:2])
frame0, frame1 = tmp
> assert_image_equal(frame0, self.frame0)
pims/tests/test_common.py:278:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
_______________________ TestVideo_MoviePy.test_iterator ________________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_iterator>
def test_iterator(self):
self.check_skip()
i = iter(self.v)
> assert_image_equal(next(i), self.frame0)
pims/tests/test_common.py:271:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 127, 57],
...,
[140, 121, 56],
...[145, 125, 62],
...,
[145, 126, 56],
[139, 120, 55],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 125, 56],
...,
[140, 120, 55],
...[145, 125, 61],
...,
[145, 124, 55],
[139, 119, 54],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 602412 / 814080 (74%)
E Max absolute difference: 2
E Max relative difference: 0.03846154
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 127, 57],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 125, 56],...
pims/tests/test_common.py:71: AssertionError
____________________ TestVideo_MoviePy.test_pipeline_simple ____________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_pipeline_simple>
def test_pipeline_simple(self):
rescale = pims.pipeline(_rescale)
rescaled_v = rescale(self.v[:1])
> assert_image_equal(rescaled_v[0], _rescale(self.frame0))
pims/tests/test_common.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[0.86231884, 0.72463768, 0.20289855],
[0.86231884, 0.72463768, 0.20289855],
[0.86231884, 0.724... 0.7173913 , 0.21014493],
[0.8115942 , 0.67391304, 0.20289855],
[0.79710145, 0.65942029, 0.1884058 ]]])
expected = array([[[0.86330935, 0.71223022, 0.20143885],
[0.86330935, 0.71223022, 0.20143885],
[0.86330935, 0.712... 0.70503597, 0.20863309],
[0.81294964, 0.66906475, 0.20143885],
[0.79856115, 0.65467626, 0.18705036]]])
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
assert_equal(actual, expected)
else:
if np.issubdtype(expected.dtype, np.integer):
expected = expected/float(np.iinfo(expected.dtype).max)
> assert_allclose(actual, expected, atol=1/256.)
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0.00390625
E
E Mismatched elements: 387898 / 814080 (47.6%)
E Max absolute difference: 0.01308518
E Max relative difference: 0.32850242
E x: Frame([[[0.862319, 0.724638, 0.202899],
E [0.862319, 0.724638, 0.202899],
E [0.862319, 0.724638, 0.217391],...
E y: array([[[0.863309, 0.71223 , 0.201439],
E [0.863309, 0.71223 , 0.201439],
E [0.863309, 0.71223 , 0.215827],...
pims/tests/test_common.py:75: AssertionError
__________________ TestVideo_MoviePy.test_pipeline_with_args ___________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_pipeline_with_args>
def test_pipeline_with_args(self):
color_channel = pims.pipeline(_color_channel)
red = color_channel(self.v, 0)
green = color_channel(self.v, 1)
> assert_image_equal(red[0], _color_channel(self.frame0, 0))
pims/tests/test_common.py:318:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[146, 146, 146, ..., 140, 141, 142],
[146, 146, 146, ..., 140, 142, 142],
[146, 146, 146, ..., 14..., 129, 120, 119],
[146, 146, 145, ..., 137, 129, 126],
[146, 146, 145, ..., 145, 139, 137]], dtype=uint8)
expected = array([[146, 146, 146, ..., 140, 141, 142],
[146, 146, 146, ..., 140, 142, 142],
[146, 146, 146, ..., 14..., 129, 120, 119],
[146, 146, 145, ..., 137, 129, 126],
[146, 146, 145, ..., 145, 139, 137]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 95024 / 271360 (35%)
E Max absolute difference: 1
E Max relative difference: 0.00877193
E x: Frame([[146, 146, 146, ..., 140, 141, 142],
E [146, 146, 146, ..., 140, 142, 142],
E [146, 146, 146, ..., 141, 143, 144],...
E y: array([[146, 146, 146, ..., 140, 141, 142],
E [146, 146, 146, ..., 140, 142, 142],
E [146, 146, 146, ..., 141, 143, 144],...
pims/tests/test_common.py:71: AssertionError
____________________ TestVideo_MoviePy.test_slice_of_slice _____________________
self = <pims.tests.test_common.TestVideo_MoviePy testMethod=test_slice_of_slice>
def test_slice_of_slice(self):
# More thorough recursive slicing tests, making use of more than
# the two frames available for these tests, are elsewhere:
# see test_recursive_slicing.
self.check_skip()
tmp = self.v[0:2]
tmp1 = tmp[1:]
frame1 = tmp1[0]
> assert_image_equal(frame1, self.frame1)
pims/tests/test_common.py:289:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = Frame([[[146, 127, 55],
[146, 127, 55],
[146, 126, 59],
...,
[137, 118, 53],
...[145, 125, 62],
...,
[147, 128, 58],
[140, 121, 56],
[137, 118, 53]]], dtype=uint8)
expected = array([[[146, 125, 54],
[146, 125, 54],
[146, 124, 58],
...,
[137, 117, 52],
...[145, 125, 61],
...,
[147, 126, 57],
[140, 120, 55],
[137, 117, 52]]], dtype=uint8)
def assert_image_equal(actual, expected):
if np.issubdtype(actual.dtype, np.integer):
> assert_equal(actual, expected)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 613964 / 814080 (75.4%)
E Max absolute difference: 2
E Max relative difference: 0.04
E x: Frame([[[146, 127, 55],
E [146, 127, 55],
E [146, 126, 59],...
E y: array([[[146, 125, 54],
E [146, 125, 54],
E [146, 124, 58],...
pims/tests/test_common.py:71: AssertionError
=============================== warnings summary ===============================
pims/tests/test_common.py::TestRecursiveSlicing::test_slice_of_slice
/Users/genevieb/mambaforge/envs/pims/lib/python3.9/site-packages/slicerator/__init__.py:287: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
if isinstance(key, collections.Iterable):
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_getting_list - A...
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_getting_single_frame
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_getting_slice - ...
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_iterator - Asser...
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_pipeline_simple
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_pipeline_with_args
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_simple_negative_index
FAILED pims/tests/test_common.py::TestVideo_PyAV_timed::test_slice_of_slice
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_getting_list
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_getting_single_frame
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_getting_slice
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_iterator - Ass...
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_pipeline_simple
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_pipeline_with_args
FAILED pims/tests/test_common.py::TestVideo_PyAV_indexed::test_slice_of_slice
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_getting_list - Asse...
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_getting_single_frame
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_getting_slice - Ass...
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_iterator - Assertio...
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_pipeline_simple - A...
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_pipeline_with_args
FAILED pims/tests/test_common.py::TestVideo_ImageIO::test_slice_of_slice - As...
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_getting_list - Asse...
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_getting_single_frame
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_getting_slice - Ass...
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_iterator - Assertio...
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_pipeline_simple - A...
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_pipeline_with_args
FAILED pims/tests/test_common.py::TestVideo_MoviePy::test_slice_of_slice - As...
============ 29 failed, 116 passed, 18 skipped, 1 warning in 10.75s ============
(pims) genevieb@192-168-1-103 pims %
I noticed this problem while working on another PR, and mentioned it in my comment here: #403 (comment)
The other tests all look fine, it's just test_common.py
that has this problem (and test_bioformats.py
, but that's the subject of the PR I was working on).
Metadata
Metadata
Assignees
Labels
No labels