change field--> fields

This commit is contained in:
rowanc1
2014-02-11 18:45:06 -08:00
parent 62f00004eb
commit 12e885f5ce
6 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -56,12 +56,12 @@ class BaseData(object):
Where P is a projection of the fields onto the data space.
"""
if u is None: u = self.prob.field(m)
return Utils.mkvc(self.projectField(u))
if u is None: u = self.prob.fields(m)
return Utils.mkvc(self.projectFields(u))
@Utils.count
def projectField(self, u):
def projectFields(self, u):
"""
This function projects the fields onto the data space.
+4 -4
View File
@@ -69,7 +69,7 @@ class DCProblem(Problem.BaseProblem):
A = D*Msig*G
return A.tocsc()
def field(self, m):
def fields(self, m):
A = self.createMatrix(m)
solve = Solver(A)
phi = solve.solve(self.data.RHS)
@@ -98,7 +98,7 @@ class DCProblem(Problem.BaseProblem):
J(v) = - P ( A(m)^{-1} ( G\\text{sdiag}(Du)\\nabla_m(M(mT(m))) v ) )
"""
if u is None:
u = self.field(m)
u = self.fields(m)
u = self.data.reshapeFields(u)
@@ -123,7 +123,7 @@ class DCProblem(Problem.BaseProblem):
"""Takes data, turns it into a model..ish"""
if u is None:
u = self.field(m)
u = self.fields(m)
u = self.data.reshapeFields(u)
v = self.data.reshapeFields(v)
@@ -214,7 +214,7 @@ if __name__ == '__main__':
# Create some data
data = prob.createSyntheticData(mSynth, std=0.05, P=P, RHS=q)
u = prob.field(mSynth)
u = prob.fields(mSynth)
u = data.reshapeFields(u)
M.plotImage(u[:,10])
plt.show()
+1 -1
View File
@@ -9,7 +9,7 @@ class LinearProblem(Problem.BaseProblem):
Problem.BaseProblem.__init__(self, mesh, model, **kwargs)
self.G = G
def field(self, m, u=None):
def fields(self, m, u=None):
return self.G.dot(m)
def J(self, m, v, u=None):
+3 -3
View File
@@ -73,7 +73,7 @@ class BaseObjFunction(object):
self.u_current = None
self.m_current = m
u = self.data.prob.field(m)
u = self.data.prob.fields(m)
self.u_current = u
phi_d = self.dataObj(m, u=u)
@@ -160,7 +160,7 @@ class BaseObjFunction(object):
\\frac{\partial \mu_\\text{data}}{\partial \mathbf{m}} = \mathbf{J}^\\top \mathbf{W \circ R}
"""
if u is None: u = self.data.prob.field(m)
if u is None: u = self.data.prob.fields(m)
R = self.data.residualWeighted(m, u=u)
@@ -204,7 +204,7 @@ class BaseObjFunction(object):
\\frac{\partial^2 \mu_\\text{data}}{\partial^2 \mathbf{m}} = \mathbf{J}^\\top \mathbf{W \circ W J}
"""
if u is None: u = self.data.prob.field(m)
if u is None: u = self.data.prob.fields(m)
R = self.data.residualWeighted(m, u=u)
+1 -1
View File
@@ -137,7 +137,7 @@ class BetaEstimate(Parameter):
u = objFunc.u_current
if u is None:
u = data.prob.field(m)
u = data.prob.fields(m)
x0 = np.random.rand(*m.shape)
t = x0.dot(objFunc.dataObj2Deriv(m,x0,u=u))
+1 -1
View File
@@ -142,7 +142,7 @@ class BaseProblem(object):
"""
return self.Jt(m, v, u)
def field(self, m):
def fields(self, m):
"""
The field given the model.