From ce7b0b24dadf79e43a3428e1c85a66bcd7bd32b7 Mon Sep 17 00:00:00 2001 From: Lindsey Date: Thu, 7 May 2015 14:44:57 -0700 Subject: [PATCH 1/2] changed check of out.shape, since if out is a vector (not an array with width 1), out.shape[1] does not exsist --- SimPEG/Problem.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/SimPEG/Problem.py b/SimPEG/Problem.py index dff99a97..81ba0511 100644 --- a/SimPEG/Problem.py +++ b/SimPEG/Problem.py @@ -160,9 +160,8 @@ class Fields(object): assert hasattr(self, func), 'The alias field function is a string, but it does not exist in the Fields class.' func = getattr(self, func) out = func(self._fields[alias][:,ind], srcII) - - if out.shape[1] == 1: - out = Utils.mkvc(out) + if not out.size > out.shape[0]: + out = Utils.mkvc(out) return out def __contains__(self, other): From 4bda4b60191b6137f228027e065978ea27aa629b Mon Sep 17 00:00:00 2001 From: Lindsey Date: Thu, 7 May 2015 15:29:41 -0700 Subject: [PATCH 2/2] a better way of checking sizes --- SimPEG/Problem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimPEG/Problem.py b/SimPEG/Problem.py index 81ba0511..b629d723 100644 --- a/SimPEG/Problem.py +++ b/SimPEG/Problem.py @@ -160,8 +160,8 @@ class Fields(object): assert hasattr(self, func), 'The alias field function is a string, but it does not exist in the Fields class.' func = getattr(self, func) out = func(self._fields[alias][:,ind], srcII) - if not out.size > out.shape[0]: - out = Utils.mkvc(out) + if out.shape[0] == out.size: + out = Utils.mkvc(out) return out def __contains__(self, other):