From f8a4c77fc37be5c4815e061e240866f34856156b Mon Sep 17 00:00:00 2001 From: rowanc1 Date: Thu, 13 Mar 2014 12:50:15 -0700 Subject: [PATCH] Updates to linear problem --- Tutorials/Linear.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Tutorials/Linear.py b/Tutorials/Linear.py index 90714abc..affed20f 100644 --- a/Tutorials/Linear.py +++ b/Tutorials/Linear.py @@ -1,10 +1,15 @@ from SimPEG import * import matplotlib.pyplot as plt +class LinearSurvey(Survey.BaseSurvey): + def projectFields(self, u): + return u class LinearProblem(Problem.BaseProblem): """docstring for LinearProblem""" + surveyPair = LinearSurvey + def __init__(self, model, G, **kwargs): Problem.BaseProblem.__init__(self, model, **kwargs) self.G = G @@ -43,21 +48,21 @@ def example(N): model = Model.BaseModel(M) prob = LinearProblem(model, G) - data = prob.createSyntheticSurvey(mtrue, std=0.01) + survey = prob.createSyntheticSurvey(mtrue, std=0.01) - return prob, data, model + return prob, survey, model if __name__ == '__main__': - prob, data, model = example(100) + prob, survey, model = example(100) M = prob.mesh reg = Regularization.Tikhonov(model) - objFunc = ObjFunction.BaseObjFunction(data, reg) + objFunc = ObjFunction.BaseObjFunction(survey, reg) opt = Optimization.InexactGaussNewton(maxIter=20) inv = Inversion.BaseInversion(objFunc, opt) - m0 = np.zeros_like(data.mtrue) + m0 = np.zeros_like(survey.mtrue) mrec = inv.run(m0) @@ -67,7 +72,7 @@ if __name__ == '__main__': plt.figure(2) - plt.plot(M.vectorCCx, data.mtrue, 'b-') + plt.plot(M.vectorCCx, survey.mtrue, 'b-') plt.plot(M.vectorCCx, mrec, 'r-') plt.show()