Skip to content

Commit

Permalink
Backport PR scikit-image#4696: Add pyramid_gaussian support for float32
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaarrfk authored and meeseeksmachine committed May 12, 2020
1 parent 7c5a79c commit fc7c542
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion skimage/transform/tests/test_pyramids.py
@@ -1,12 +1,12 @@
import math
import pytest
import numpy as np
from skimage import data
from skimage.transform import pyramids

from skimage._shared import testing
from skimage._shared.testing import (assert_array_equal, assert_, assert_equal,
assert_almost_equal)
from skimage._shared._warnings import expected_warnings


image = data.astronaut()
Expand Down Expand Up @@ -135,3 +135,13 @@ def test_check_factor():
pyramids._check_factor(0.99)
with testing.raises(ValueError):
pyramids._check_factor(- 2)


@pytest.mark.parametrize('dtype, expected',
zip(['float32', 'float64', 'uint8', 'int64'],
['float32', 'float64', 'float64', 'float64']))
def test_pyramid_gaussian_dtype_support(dtype, expected):
img = np.random.randn(32, 8).astype(dtype)
pyramid = pyramids.pyramid_gaussian(img)

assert np.all([im.dtype == expected for im in pyramid])

0 comments on commit fc7c542

Please sign in to comment.