From 86ecaf32a4e64c41fd1044c8ccf2486bcd64c164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Mon, 21 Feb 2022 15:11:57 +0100 Subject: [PATCH] BUG: fix a bug where normalizing a quiverplot with 0-len vectors would yield runtims warnings from numpy (divide by 0 errors) --- yt/visualization/plot_modifications.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yt/visualization/plot_modifications.py b/yt/visualization/plot_modifications.py index b0c2f74fc57..501656ec70c 100644 --- a/yt/visualization/plot_modifications.py +++ b/yt/visualization/plot_modifications.py @@ -533,6 +533,7 @@ def __call__(self, plot): def _finalize(self, plot, X, Y, pixX, pixY, pixC): if self.normalize: nn = np.sqrt(pixX**2 + pixY**2) + nn = np.where(nn == 0, 1, nn) pixX /= nn pixY /= nn