diff --git a/python/damask/_colormap.py b/python/damask/_colormap.py index 8bcb076d4..5c0ca11d3 100644 --- a/python/damask/_colormap.py +++ b/python/damask/_colormap.py @@ -186,7 +186,7 @@ class Colormap(mpl.colors.ListedColormap): np.logical_or (np.isnan(field), field == gap)) # mask gap and NaN (if gap present) if bounds is None: - hi,lo = field[mask].min(),field[mask].max() + hi,lo = field[mask].max(),field[mask].min() else: hi,lo = bounds[::-1] diff --git a/python/tests/reference/Colormap/shade.png b/python/tests/reference/Colormap/shade.png deleted file mode 100644 index a9e5eacea..000000000 Binary files a/python/tests/reference/Colormap/shade.png and /dev/null differ diff --git a/python/tests/reference/Colormap/shade_None.png b/python/tests/reference/Colormap/shade_None.png new file mode 100644 index 000000000..2289910ae Binary files /dev/null and b/python/tests/reference/Colormap/shade_None.png differ diff --git a/python/tests/reference/Colormap/shade_[2, 10].png b/python/tests/reference/Colormap/shade_[2, 10].png new file mode 100644 index 000000000..25c1cebb8 Binary files /dev/null and b/python/tests/reference/Colormap/shade_[2, 10].png differ diff --git a/python/tests/test_Colormap.py b/python/tests/test_Colormap.py index 8eebf63ee..b3309f12b 100644 --- a/python/tests/test_Colormap.py +++ b/python/tests/test_Colormap.py @@ -131,13 +131,14 @@ class TestColormap: c += c assert (np.allclose(c.colors[:len(c.colors)//2],c.colors[len(c.colors)//2:])) - def test_shade(self,reference_dir,update): + @pytest.mark.parametrize('bounds',[None,[2,10]]) + def test_shade(self,reference_dir,update,bounds): data = np.add(*np.indices((10, 11))) - img_current = Colormap.from_predefined('orientation').shade(data) + img_current = Colormap.from_predefined('orientation').shade(data,bounds=bounds) if update: - img_current.save(reference_dir/'shade.png') + img_current.save(reference_dir/f'shade_{bounds}.png') else: - img_reference = Image.open(reference_dir/'shade.png') + img_reference = Image.open(reference_dir/f'shade_{bounds}.png') diff = ImageChops.difference(img_reference.convert('RGB'),img_current.convert('RGB')) assert not diff.getbbox()