updates to survey and mkvc

This commit is contained in:
rowanc1
2014-03-10 22:58:25 -07:00
parent fcaff5ed64
commit 6fdc7d4a62
2 changed files with 11 additions and 1 deletions
+8 -1
View File
@@ -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):
+3
View File
@@ -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: