From 6fdc7d4a62da408b3fdc568c050d4beec07e9e54 Mon Sep 17 00:00:00 2001 From: rowanc1 Date: Mon, 10 Mar 2014 22:58:25 -0700 Subject: [PATCH] updates to survey and mkvc --- SimPEG/Survey.py | 9 ++++++++- SimPEG/Utils/matutils.py | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SimPEG/Survey.py b/SimPEG/Survey.py index c640d865..e754476e 100644 --- a/SimPEG/Survey.py +++ b/SimPEG/Survey.py @@ -25,6 +25,13 @@ class BaseSurvey(object): """ return getattr(self, '_prob', None) + @property + def mesh(self): + """Mesh of the paired problem.""" + if self.ispaired: + return self.prob.mesh + raise Exception('Pair survey to a problem to access the problems mesh.') + def pair(self, p): """Bind a problem to this survey instance using pointers""" assert hasattr(p, 'surveyPair'), "Problem must have an attribute 'surveyPair'." @@ -71,7 +78,7 @@ class BaseSurvey(object): d_\\text{pred} = \mathbf{P} u(m) """ - return u + raise NotImplemented('projectFields is not yet implemented.') @Utils.count def projectFieldsDeriv(self, u): diff --git a/SimPEG/Utils/matutils.py b/SimPEG/Utils/matutils.py index f1ea7ec7..ac6c391d 100644 --- a/SimPEG/Utils/matutils.py +++ b/SimPEG/Utils/matutils.py @@ -30,6 +30,9 @@ def mkvc(x, numDims=1): if type(x) == np.matrix: x = np.array(x) + if hasattr(x, 'tovec'): + x = x.tovec() + assert type(x) == np.ndarray, "Vector must be a numpy array" if numDims == 1: