Move linear problem example to examples folder.

This commit is contained in:
rowanc1
2014-05-16 17:53:51 -07:00
parent e385747f45
commit 1f0e37d773
7 changed files with 20 additions and 23 deletions
+1
View File
@@ -1,4 +1,5 @@
- Electromagnetics (`simpegEM <http://simpegem.rtfd.org/>`_)
- Magnetotellurics (`simpegMT <http://simpegmt.rtfd.org/>`_)
- Electromagnetics 1D (`simpegEM1D <http://simpegem1d.rtfd.org/>`_)
- Direct Current Resistivity (`simpegDC <http://simpeg-dc.rtfd.org/>`_)
- Potential Fields (`simpegPF <http://simpegpf.rtfd.org/>`_)
@@ -23,7 +23,7 @@ class LinearProblem(Problem.BaseProblem):
return self.G.T.dot(v)
def example(N):
def run(N):
mesh = Mesh.TensorMesh([N])
nk = 20
@@ -46,14 +46,6 @@ def example(N):
prob = LinearProblem(mesh, G)
survey = prob.createSyntheticSurvey(mtrue, std=0.01)
return prob, survey, mesh
if __name__ == '__main__':
import matplotlib.pyplot as plt
prob, survey, mesh = example(100)
M = prob.mesh
reg = Regularization.Tikhonov(mesh)
@@ -67,6 +59,7 @@ if __name__ == '__main__':
mrec = inv.run(m0)
import matplotlib.pyplot as plt
plt.figure(1)
for i in range(prob.G.shape[0]):
plt.plot(prob.G[i,:])
@@ -75,4 +68,4 @@ if __name__ == '__main__':
plt.plot(M.vectorCCx, survey.mtrue, 'b-')
plt.plot(M.vectorCCx, mrec, 'r-')
plt.show()
return prob, survey, mesh
+1
View File
@@ -0,0 +1 @@
import Linear
+1
View File
@@ -13,6 +13,7 @@ class TestBaseMesh(unittest.TestCase):
self.assertTrue(self.mesh.dim, 3)
def test_mesh_nc(self):
self.assertTrue(self.mesh.nC == 36)
self.assertTrue(np.all(self.mesh.vnC == [6, 2, 3]))
def test_mesh_nc_xyz(self):
+13
View File
@@ -0,0 +1,13 @@
import unittest
import sys
from SimPEG.Examples import Linear
import numpy as np
class TestLinear(unittest.TestCase):
def test_running(self):
Linear.run(100)
self.assertTrue(True)
if __name__ == '__main__':
unittest.main()
-8
View File
@@ -1,8 +0,0 @@
import os
print 'Compiling TriSolve.'
os.system('f2py -c Utils/TriSolve.f -m TriSolve')
print 'TriSolve Compiled! yay.'
print 'Moving TriSolve into Utils.'
os.system('mv TriSolve.so Utils/TriSolve.so')
print 'Thats it. Well Done Computer.'
+1 -5
View File
@@ -5,10 +5,6 @@ SimPEG is a python package for simulation and gradient based
parameter estimation in the context of geophysical applications.
"""
# import ez_setup
# ez_setup.use_setuptools()
# from setuptools import setup, find_packages
from distutils.core import setup
from setuptools import find_packages
from Cython.Build import cythonize
@@ -35,7 +31,7 @@ setup(
version = "0.1dev",
packages = find_packages(),
install_requires = ['numpy>=1.7',
'scipy>=0.12',
'scipy>=0.13',
'matplotlib>=1.3',
],
author = "Rowan Cockett",