From b1ba2c0a24e49e84f9814606966253c3825e271c Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 26 Jul 2017 17:31:36 +0100
Subject: [PATCH] Fix to skipUnchanged - np.all(a == b) might return true even
 if a and b have different shapes

---
 fsl/utils/memoize.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fsl/utils/memoize.py b/fsl/utils/memoize.py
index 8f56a1a61..9f56d4cea 100644
--- a/fsl/utils/memoize.py
+++ b/fsl/utils/memoize.py
@@ -143,8 +143,13 @@ def skipUnchanged(func):
             newIsArray = isinstance(value,  np.ndarray)
             isarray    = oldIsArray or newIsArray
 
-            if isarray: nochange = np.all(oldVal == value)
-            else:       nochange =        oldVal == value
+            if isarray:
+                a = np.array(oldVal, copy=False)
+                b = np.array(value,  copy=False)
+
+                nochange = (a.shape == b.shape) and np.allclose(a, b)
+            else:
+                nochange = oldVal == value
 
             if nochange:
                 return False
-- 
GitLab