Notification time stamped 2021-08-01 03:00:50 UTC
From e8760ed1e923bb3ebaac45826ae2db47e9745dd6 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst(a)gmail.com>
Date: Aug 01 2021 02:59:24 +0000
Subject: Merge branch 'pr1' into rawhide
---
diff --git a/PR-53-without-bin.patch b/PR-53-without-bin.patch
new file mode 100644
index 0000000..3f17ca6
--- /dev/null
+++ b/PR-53-without-bin.patch
@@ -0,0 +1,240 @@
+From 4dd1539698d3852bf8704854c19ed592f6b13e8f Mon Sep 17 00:00:00 2001
+From: John Omotani <john.omotani(a)ukaea.uk>
+Date: Fri, 25 Sep 2020 17:58:17 +0100
+Subject: [PATCH 1/6] Support pcolormesh shadings other than "flat"
+
+shading="gouraud" and the (new in matplotlib-3.3) "nearest" shading
+require the array to be sliced differently, and not flattened.
+---
+ animatplot/blocks/image_like.py | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/animatplot/blocks/image_like.py b/animatplot/blocks/image_like.py
+index ef6517d..80ee84b 100644
+--- a/animatplot/blocks/image_like.py
++++ b/animatplot/blocks/image_like.py
+@@ -49,14 +49,31 @@ def __init__(self, *args, ax=None, t_axis=0, **kwargs):
+ self.C = np.asanyarray(self.C)
+
+ Slice = self._make_slice(0, 3)
++
++ # replicate matplotlib logic for setting default shading value because
++ # matplotlib resets the _shading member variable of the QuadMesh to
"flat" after
++ # interpolating X and Y to corner positions
++ self. shading = kwargs.get("shading",
plt.rcParams.get("pcolor.shading", "flat"))
++ if self.shading == "auto":
++ Nx = self.X.shape[-1]
++ Ny = self.Y.shape[0]
++ if (Ny, Nx) == self.C.shape[Slice]:
++ self.shading = "nearest"
++ else:
++ self.shading = "flat"
++
+ if self._arg_len == 1:
+ self.quad = self.ax.pcolormesh(self.C[Slice], **kwargs)
+ elif self._arg_len == 3:
+ self.quad = self.ax.pcolormesh(self.X, self.Y, self.C[Slice], **kwargs)
+
+ def _update(self, i):
+- Slice = self._make_pcolormesh_slice(i, 3)
+- self.quad.set_array(self.C[Slice].ravel())
++ if self.shading == "flat":
++ Slice = self._make_pcolormesh_flat_slice(i, 3)
++ self.quad.set_array(self.C[Slice].ravel())
++ else:
++ Slice = self._make_slice(i, 3)
++ self.quad.set_array(self.C[Slice])
+ return self.quad
+
+ def __len__(self):
+@@ -64,7 +81,7 @@ def __len__(self):
+ return self.C.shape[0]
+ return self.C.shape[self.t_axis]
+
+- def _make_pcolormesh_slice(self, i, dim):
++ def _make_pcolormesh_flat_slice(self, i, dim):
+ if self._is_list:
+ return i
+ Slice = [slice(-1)]*3 # weird thing to make animation work
+
+diff --git a/tests/baseline_images/Blocks/Pcolormesh_nearest3.png
b/tests/baseline_images/Blocks/Pcolormesh_nearest3.png
+new file mode 100644
+index 0000000..e69de29
+diff --git a/tests/test_blocks.py b/tests/test_blocks.py
+index 358ac7f..56b93fd 100644
+--- a/tests/test_blocks.py
++++ b/tests/test_blocks.py
+@@ -3,6 +3,7 @@
+ import numpy.testing as npt
+ import matplotlib.pyplot as plt
+ import matplotlib as mpl
++import packaging.version
+
+ import pytest
+
+@@ -219,6 +220,40 @@ def test_Pcolormesh(self):
+ block = amp.blocks.Pcolormesh(X[:, :, 0], Y[:, :, 0], Z, t_axis=2)
+ return amp.Animation([block])
+
++ @pytest.mark.skipif(
++ packaging.version.parse(mpl.__version__) <
packaging.version.parse("3.3.0"),
++ reason="matplotlib version too low - does not have
shading='nearest'"
++ )
++ @animation_compare(baseline_images='Blocks/Pcolormesh_nearest', nframes=3)
++ def test_Pcolormesh_nearest(self):
++ x = np.linspace(-2*np.pi, 2*np.pi, 100)
++ t = np.linspace(0, 2*np.pi, 3)
++
++ X, Y, T = np.meshgrid(x, x, t)
++ Z = np.sin(X**2+Y**2-T)
++
++ block = amp.blocks.Pcolormesh(
++ X[:, :, 0], Y[:, :, 0], Z, t_axis=2, shading="nearest"
++ )
++ return amp.Animation([block])
++
++ @pytest.mark.skipif(
++ packaging.version.parse(mpl.__version__) <
packaging.version.parse("3.3.0"),
++ reason="matplotlib version too low - shading='gouraud' does not
work before 3.3"
++ )
++ @animation_compare(baseline_images='Blocks/Pcolormesh_gouraud', nframes=1)
++ def test_Pcolormesh_gouraud(self):
++ x = np.linspace(-2*np.pi, 2*np.pi, 100)
++ t = np.linspace(0, 2*np.pi, 1)
++
++ X, Y, T = np.meshgrid(x, x, t)
++ Z = np.sin(X**2+Y**2-T)
++
++ block = amp.blocks.Pcolormesh(
++ X[:, :, 0], Y[:, :, 0], Z, t_axis=2, shading="gouraud"
++ )
++ return amp.Animation([block])
++
+ @animation_compare(baseline_images='Blocks/Imshow', nframes=3)
+ def test_Imshow(self):
+ x = np.linspace(0, 1, 10)
+
+From 6c02893b4d388c251e8d5ac603a9d6e723f61e5b Mon Sep 17 00:00:00 2001
+From: John Omotani <john.omotani(a)ukaea.uk>
+Date: Sat, 26 Sep 2020 11:23:25 +0100
+Subject: [PATCH 3/6] Fix slicing in shading=="auto" branch
+
+---
+ animatplot/blocks/image_like.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/animatplot/blocks/image_like.py b/animatplot/blocks/image_like.py
+index 80ee84b..57cdd16 100644
+--- a/animatplot/blocks/image_like.py
++++ b/animatplot/blocks/image_like.py
+@@ -57,7 +57,7 @@ def __init__(self, *args, ax=None, t_axis=0, **kwargs):
+ if self.shading == "auto":
+ Nx = self.X.shape[-1]
+ Ny = self.Y.shape[0]
+- if (Ny, Nx) == self.C.shape[Slice]:
++ if (Ny, Nx) == self.C[Slice].shape:
+ self.shading = "nearest"
+ else:
+ self.shading = "flat"
+
+From 25fcedd6c7d986f64e1fb39e72ef04fa7597c17f Mon Sep 17 00:00:00 2001
+From: John Omotani <john.omotani(a)ukaea.uk>
+Date: Sat, 26 Sep 2020 11:24:26 +0100
+Subject: [PATCH 4/6] Handle case where shape of Z is (nx-1)*(ny-1)
+
+This is the case matplotlib is better set up to handle, and uses X and Y
+as the positions of the cell corners to be colored according to the
+value of Z. This case needs to use standard slicing from
+Block._make_slice() instead of the workaround in
+Pcolormesh._make_pcolormesh_flat_slice().
+---
+ animatplot/blocks/image_like.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/animatplot/blocks/image_like.py b/animatplot/blocks/image_like.py
+index 57cdd16..89a13ca 100644
+--- a/animatplot/blocks/image_like.py
++++ b/animatplot/blocks/image_like.py
+@@ -54,13 +54,16 @@ def __init__(self, *args, ax=None, t_axis=0, **kwargs):
+ # matplotlib resets the _shading member variable of the QuadMesh to
"flat" after
+ # interpolating X and Y to corner positions
+ self. shading = kwargs.get("shading",
plt.rcParams.get("pcolor.shading", "flat"))
++ Nx = self.X.shape[-1]
++ Ny = self.Y.shape[0]
+ if self.shading == "auto":
+- Nx = self.X.shape[-1]
+- Ny = self.Y.shape[0]
+ if (Ny, Nx) == self.C[Slice].shape:
+ self.shading = "nearest"
+ else:
+ self.shading = "flat"
++ if self.shading == "flat" and ((Ny - 1, Nx - 1) ==
self.C[Slice].shape):
++ # Need to slice without the workaround in _update()
++ self.shading = "flat_corner_grid"
+
+ if self._arg_len == 1:
+ self.quad = self.ax.pcolormesh(self.C[Slice], **kwargs)
+
+From bec1f8f1e587b9313199d0a0a1ac70a30711043f Mon Sep 17 00:00:00 2001
+From: John Omotani <john.omotani(a)ukaea.uk>
+Date: Sat, 26 Sep 2020 11:27:25 +0100
+Subject: [PATCH 5/6] Test shading="flat" with corner positions passed in
+diff --git a/tests/baseline_images/Blocks/Pcolormesh_corner3.png
b/tests/baseline_images/Blocks/Pcolormesh_corner3.png
+new file mode 100644
+index 0000000..e69de29
+diff --git a/tests/test_blocks.py b/tests/test_blocks.py
+index 56b93fd..1e9a641 100644
+--- a/tests/test_blocks.py
++++ b/tests/test_blocks.py
+@@ -220,6 +220,19 @@ def test_Pcolormesh(self):
+ block = amp.blocks.Pcolormesh(X[:, :, 0], Y[:, :, 0], Z, t_axis=2)
+ return amp.Animation([block])
+
++ @animation_compare(baseline_images='Blocks/Pcolormesh_corner', nframes=3)
++ def test_Pcolormesh_corner_positions(self):
++ # Test with size of Z being (nx-1)*(ny-1) like matplotlib expects for
'flat'
++ # shading
++ x = np.linspace(-2*np.pi, 2*np.pi, 10)
++ t = np.linspace(0, 2*np.pi, 3)
++
++ X, Y, T = np.meshgrid(x, x, t)
++ Z = np.sin(X**2+Y**2-T)[:-1, :-1, :]
++
++ block = amp.blocks.Pcolormesh(X[:, :, 0], Y[:, :, 0], Z, t_axis=2)
++ return amp.Animation([block])
++
+ @pytest.mark.skipif(
+ packaging.version.parse(mpl.__version__) <
packaging.version.parse("3.3.0"),
+ reason="matplotlib version too low - does not have
shading='nearest'"
+
+diff --git a/tests/baseline_images/Blocks/Pcolormesh_auto3.png
b/tests/baseline_images/Blocks/Pcolormesh_auto3.png
+new file mode 100644
+index 0000000..e69de29
+diff --git a/tests/test_blocks.py b/tests/test_blocks.py
+index 1e9a641..1db9ea4 100644
+--- a/tests/test_blocks.py
++++ b/tests/test_blocks.py
+@@ -250,6 +250,23 @@ def test_Pcolormesh_nearest(self):
+ )
+ return amp.Animation([block])
+
++ @pytest.mark.skipif(
++ packaging.version.parse(mpl.__version__) <
packaging.version.parse("3.3.0"),
++ reason="matplotlib version too low - does not have
shading='nearest'"
++ )
++ @animation_compare(baseline_images='Blocks/Pcolormesh_auto', nframes=3)
++ def test_Pcolormesh_nearest(self):
++ x = np.linspace(-2*np.pi, 2*np.pi, 10)
++ t = np.linspace(0, 2*np.pi, 3)
++
++ X, Y, T = np.meshgrid(x, x, t)
++ Z = np.sin(X**2+Y**2-T)
++
++ block = amp.blocks.Pcolormesh(
++ X[:, :, 0], Y[:, :, 0], Z, t_axis=2, shading="auto"
++ )
++ return amp.Animation([block])
++
+ @pytest.mark.skipif(
+ packaging.version.parse(mpl.__version__) <
packaging.version.parse("3.3.0"),
+ reason="matplotlib version too low - shading='gouraud' does not
work before 3.3"
diff --git a/python-animatplot.spec b/python-animatplot.spec
index 50f0e9b..ecd6fdb 100644
--- a/python-animatplot.spec
+++ b/python-animatplot.spec
@@ -10,6 +10,9 @@ License: MIT
URL:
https://github.com/t-makaro/animatplot
# PyPI tarball does not contain docs and tests.
Source0:
https://github.com/t-makaro/%{srcname}/archive/%{version}/%{srcname}-%{ve...
+#
https://patch-diff.githubusercontent.com/raw/t-makaro/animatplot/pull/53....
+# but without binary diff
+Patch0: PR-53-without-bin.patch
BuildArch: noarch
@@ -84,6 +87,9 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=%{buildroot}%{python3_sitelib} \
* Fri Jul 23 2021 Fedora Release Engineering <releng(a)fedoraproject.org> - 0.4.1-11
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+* Wed Jul 07 2021 David <davidsch(a)fedoraproject.org> - 0.4.1-11
+- Add backport of 0.4.2
+
* Fri Jun 04 2021 Python Maint <python-maint(a)redhat.com> - 0.4.1-10
- Rebuilt for Python 3.10
https://src.fedoraproject.org/rpms/python-animatplot/c/e8760ed1e923bb3eba...