Documentation updates.

This commit is contained in:
Rowan Cockett
2013-10-26 16:19:02 -07:00
parent 49d08f3245
commit 86c1080631
6 changed files with 89 additions and 67 deletions
+65 -61
View File
@@ -5,47 +5,6 @@ from SimPEG.regularization import Regularization
from SimPEG.inverse import *
import matplotlib.pyplot as plt
N = 100
h = np.ones(N)/N
M = TensorMesh([h])
nk = 20
jk = np.linspace(1.,20.,nk)
p = -0.25
q = 0.25
g = lambda k: np.exp(p*jk[k]*M.vectorCCx)*np.cos(2*np.pi*q*jk[k]*M.vectorCCx)
G = np.empty((nk, M.nC))
for i in range(nk):
G[i,:] = g(i)
plt.figure(1)
for i in range(nk):
plt.plot(G[i,:])
m_true = np.zeros(M.nC)
m_true[M.vectorCCx > 0.3] = 1.
m_true[M.vectorCCx > 0.45] = -0.5
m_true[M.vectorCCx > 0.6] = 0
d_true = G.dot(m_true)
noise = 0.1 * np.random.rand(d_true.size)
d_obs = d_true + noise
# plt.figure(3)
# plt.plot(d_true,'-o')
# plt.plot(d_obs,'r-o')
class LinearProblem(Problem):
"""docstring for LinearProblem"""
@@ -59,27 +18,72 @@ class LinearProblem(Problem):
def Jt(self, m, v, u=None):
return G.T.dot(v)
prob = LinearProblem(M)
prob.G = G
prob.dobs = d_obs
prob.std = np.ones_like(d_obs)*0.1
if __name__ == '__main__':
N = 100
h = np.ones(N)/N
M = TensorMesh([h])
reg = Regularization(M)
opt = InexactGaussNewton(maxIter=20)
inv = Inversion(prob,reg,opt,beta0=1e-4)
m0 = np.zeros_like(m_true)
mrec = inv.run(m0)
plt.figure(2)
plt.plot(M.vectorCCx, m_true, 'b-')
plt.plot(M.vectorCCx, mrec, 'r-')
nk = 20
jk = np.linspace(1.,20.,nk)
p = -0.25
q = 0.25
plt.show()
g = lambda k: np.exp(p*jk[k]*M.vectorCCx)*np.cos(2*np.pi*q*jk[k]*M.vectorCCx)
G = np.empty((nk, M.nC))
for i in range(nk):
G[i,:] = g(i)
plt.figure(1)
for i in range(nk):
plt.plot(G[i,:])
m_true = np.zeros(M.nC)
m_true[M.vectorCCx > 0.3] = 1.
m_true[M.vectorCCx > 0.45] = -0.5
m_true[M.vectorCCx > 0.6] = 0
d_true = G.dot(m_true)
noise = 0.1 * np.random.rand(d_true.size)
d_obs = d_true + noise
# plt.figure(3)
# plt.plot(d_true,'-o')
# plt.plot(d_obs,'r-o')
prob = LinearProblem(M)
prob.G = G
prob.dobs = d_obs
prob.std = np.ones_like(d_obs)*0.1
reg = Regularization(M)
opt = InexactGaussNewton(maxIter=20)
inv = Inversion(prob,reg,opt,beta0=1e-4)
m0 = np.zeros_like(m_true)
mrec = inv.run(m0)
plt.figure(2)
plt.plot(M.vectorCCx, m_true, 'b-')
plt.plot(M.vectorCCx, mrec, 'r-')
plt.show()
+1
View File
@@ -1,3 +1,4 @@
from Problem import *
from DCProblem import DCProblem
from LinearProblem import LinearProblem
import ModelTransforms
@@ -1,7 +1,7 @@
class Cooling(object):
"""Simple Beta Schedual"""
"""Simple Beta Schedule"""
beta0 = 1.e6
beta_coolingFactor = 5.
+1 -1
View File
@@ -1,3 +1,3 @@
from Optimize import *
from Inversion import *
import BetaSchedual
import BetaSchedule
+15
View File
@@ -6,3 +6,18 @@ Optimize
.. automodule:: SimPEG.inverse.Optimize
:members:
:undoc-members:
Inversion
*********
.. automodule:: SimPEG.inverse.Inversion
:members:
:undoc-members:
Beta Schedule
*************
.. automodule:: SimPEG.inverse.BetaSchedule
:members:
:undoc-members:
+6 -4
View File
@@ -13,14 +13,16 @@ Problem
DCProblem
*********
.. automodule:: SimPEG.forward.DCProblem.DCProblem
.. automodule:: SimPEG.forward.DCProblem
:members:
:undoc-members:
DCutils
*******
.. automodule:: SimPEG.forward.DCProblem.DCutils
Linear Problem
**************
.. automodule:: SimPEG.forward.LinearProblem
:members:
:undoc-members: