Clean Up Documentation

This commit is contained in:
rowanc1
2014-01-19 13:39:50 -07:00
parent 583f3ed8d0
commit 25d79d3636
27 changed files with 109 additions and 4216 deletions
+12 -22
View File
@@ -147,16 +147,6 @@ class BaseMesh(object):
else:
return switchKernal(x)
# def n():
# doc = """
# Number of Cells in each dimension (array of integers)
# :rtype: numpy.array
# :return: n
# """
# fget = lambda self: self._n
# return locals()
# n = property(**n())
def dim():
doc = """
@@ -219,10 +209,10 @@ class BaseMesh(object):
:return: nC
.. plot::
:include-source:
from SimPEG.mesh import TensorMesh
import numpy as np
TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(centers=True,showIt=True)
from SimPEG import Mesh, np
Mesh.TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(centers=True,showIt=True)
"""
fget = lambda self: np.prod(self._n)
return locals()
@@ -290,10 +280,10 @@ class BaseMesh(object):
:return: nN
.. plot::
:include-source:
from SimPEG.mesh import TensorMesh
import numpy as np
TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(nodes=True,showIt=True)
from SimPEG import Mesh, np
Mesh.TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(nodes=True,showIt=True)
"""
fget = lambda self: np.prod(self.nCv + 1)
return locals()
@@ -361,10 +351,10 @@ class BaseMesh(object):
:return: [prod(nEx), prod(nEy), prod(nEz)]
.. plot::
:include-source:
from SimPEG.mesh import TensorMesh
import numpy as np
TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(edges=True,showIt=True)
from SimPEG import Mesh, np
Mesh.TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(edges=True,showIt=True)
"""
fget = lambda self: np.array([np.prod(x) for x in [self.nEx, self.nEy, self.nEz] if not x is None])
return locals()
@@ -433,10 +423,10 @@ class BaseMesh(object):
:return: [prod(nFx), prod(nFy), prod(nFz)]
.. plot::
:include-source:
from SimPEG.mesh import TensorMesh
import numpy as np
TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(faces=True,showIt=True)
from SimPEG import Mesh, np
Mesh.TensorMesh([np.ones(n) for n in [2,3]]).plotGrid(faces=True,showIt=True)
"""
fget = lambda self: np.array([np.prod(x) for x in [self.nFx, self.nFy, self.nFz] if not x is None])
return locals()
+6 -1
View File
@@ -17,8 +17,13 @@ class LogicallyOrthogonalMesh(BaseMesh, DiffOperators, InnerProducts, LomView):
Example of a logically orthogonal mesh:
.. plot:: examples/mesh/plot_LogicallyOrthogonalMesh.py
.. plot::
:include-source:
from SimPEG import Mesh, Utils
X, Y = Utils.exampleLomGird([3,3],'rotate')
M = Mesh.LogicallyOrthogonalMesh([X, Y])
M.plotGrid(showIt=True)
"""
__metaclass__ = Utils.Save.Savable
+12 -3
View File
@@ -15,10 +15,18 @@ class LomView(object):
def __init__(self):
pass
def plotGrid(self, length=0.05):
def plotGrid(self, length=0.05, showIt=False):
"""Plot the nodal, cell-centered and staggered grids for 1,2 and 3 dimensions.
.. plot:: examples/mesh/plot_LogicallyOrthogonalMesh.py
.. plot::
:include-source:
from SimPEG import Mesh, Utils
X, Y = Utils.exampleLomGird([3,3],'rotate')
M = Mesh.LogicallyOrthogonalMesh([X, Y])
M.plotGrid(showIt=True)
"""
NN = self.r(self.gridN, 'N', 'N', 'M')
if self.dim == 2:
@@ -92,4 +100,5 @@ class LomView(object):
ax.hold(False)
ax.set_xlabel('x1')
ax.set_ylabel('x2')
fig.show()
if showIt: plt.show()
+4 -4
View File
@@ -17,19 +17,19 @@ class TensorMesh(BaseMesh, TensorView, DiffOperators, InnerProducts):
hy = np.array([1,2])
hz = np.array([1,1,1,1])
mesh = TensorMesh([hx, hy, hz])
mesh = Mesh.TensorMesh([hx, hy, hz])
Example of a padded tensor mesh:
.. plot::
from SimPEG import mesh, Utils
M = mesh.TensorMesh(Utils.meshTensors(((10,10),(40,10),(10,10)), ((10,10),(20,10),(0,0))))
from SimPEG import Mesh, Utils
M = Mesh.TensorMesh(Utils.meshTensors(((10,10),(40,10),(10,10)), ((10,10),(20,10),(0,0))))
M.plotGrid()
For a quick tensor mesh on a (10x12x15) unit cube::
mesh = TensorMesh([10, 12, 15])
mesh = Mesh.TensorMesh([10, 12, 15])
"""
+31 -6
View File
@@ -34,11 +34,22 @@ class TensorView(object):
:param str annotationColor: color of annotation, e.g. 'w', 'k', 'b'
:param bool showIt: call plt.show()
.. plot:: examples/mesh/plot_image_2D.py
:include-source:
.. plot::
:include-source:
from SimPEG import Mesh, np
M = Mesh.TensorMesh([20, 20])
I = np.sin(M.gridCC[:,0]*2*np.pi)*np.sin(M.gridCC[:,1]*2*np.pi)
M.plotImage(I, showIt=True)
.. plot::
:include-source:
from SimPEG import Mesh, np
M = Mesh.TensorMesh([20,20,20])
I = np.sin(M.gridCC[:,0]*2*np.pi)*np.sin(M.gridCC[:,1]*2*np.pi)*np.sin(M.gridCC[:,2]*2*np.pi)
M.plotImage(I, annotationColor='k', showIt=True)
.. plot:: examples/mesh/plot_image_3D.py
:include-source:
"""
assert type(I) == np.ndarray, "I must be a numpy array"
assert type(numbering) == bool, "numbering must be a bool"
@@ -237,11 +248,25 @@ class TensorView(object):
:param bool lines: plot lines connecting nodes
:param bool showIt: call plt.show()
.. plot:: examples/mesh/plot_grid_2D.py
.. plot::
:include-source:
.. plot:: examples/mesh/plot_grid_3D.py
from SimPEG import Mesh, np
h1 = np.linspace(.1,.5,3)
h2 = np.linspace(.1,.5,5)
mesh = Mesh.TensorMesh([h1, h2])
mesh.plotGrid(nodes=True, faces=True, centers=True, lines=True, showIt=True)
.. plot::
:include-source:
from SimPEG import Mesh, np
h1 = np.linspace(.1,.5,3)
h2 = np.linspace(.1,.5,5)
h3 = np.linspace(.1,.5,3)
mesh = Mesh.TensorMesh([h1,h2,h3])
mesh.plotGrid(nodes=True, faces=True, centers=True, lines=True, showIt=True)
"""
if self.dim == 1:
fig = plt.figure(1)
+3 -5
View File
@@ -211,12 +211,10 @@ def checkDerivative(fctn, x0, num=7, plotIt=True, dx=None, expectedOrder=2, tole
.. plot::
:include-source:
from SimPEG.tests import checkDerivative
from SimPEG.Utils import sdiag
import numpy as np
from SimPEG import Tests, Utils, np
def simplePass(x):
return np.sin(x), sdiag(np.cos(x))
checkDerivative(simplePass, np.random.randn(5))
return np.sin(x), Utils.sdiag(np.cos(x))
Tests.checkDerivative(simplePass, np.random.randn(5))
"""
print "%s checkDerivative %s" % ('='*20, '='*20)
-57
View File
@@ -1,57 +0,0 @@
import os
import glob
import unittest
import HTMLTestRunner
# This code will run all tests in directory named test_*.py
def main(html=False):
TITLE = 'Test Results'
test_file_strings = glob.glob('test_*.py')
module_strings = [str[0:len(str)-3] for str in test_file_strings]
suites = [unittest.defaultTestLoader.loadTestsFromName(str) for str
in module_strings]
testSuite = unittest.TestSuite(suites)
if not html:
unittest.TextTestRunner(verbosity=2).run(testSuite)
return
outfile = open("report.html", "w")
runner = HTMLTestRunner.HTMLTestRunner(
stream=outfile,
title=TITLE,
description='SimPEG Test Report was automatically generated.',
verbosity=2
)
runner.run(testSuite)
outfile.close()
reader = open("report.html", "r")
writer = open("../../docs/api_TestResults.rst", "w")
writer.write('.. _api_TestResults:\n\nTest Results\n============\n\n.. raw:: html\n\n')
go = False
for line in reader:
skip = False
if line == '<style type="text/css" media="screen">\n':
go = True
elif line == "<div id='ending'>&nbsp;</div>\n":
go = False
elif line == '</head>\n':
skip = True
elif line == '<h1>'+TITLE+'</h1>\n':
skip = True
elif line == '<body>\n':
skip = True
if go and not skip:
writer.write(' '+line)
writer.close()
reader.close()
os.remove("report.html")
if __name__ == '__main__':
main(True)
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
python -m unittest discover
+2 -2
View File
@@ -34,8 +34,8 @@ def meshTensors(*args):
.. plot::
from SimPEG import mesh, Utils
M = mesh.TensorMesh(Utils.meshTensors(((10,10),(40,10),(10,10)), ((10,10),(20,10),(0,0))))
from SimPEG import Mesh, Utils
M = Mesh.TensorMesh(Utils.meshTensors(((10,10),(40,10),(10,10)), ((10,10),(20,10),(0,0))))
M.plotGrid()
"""
+1 -1
View File
@@ -3,6 +3,6 @@
Base Mesh
*********
.. automodule:: SimPEG.mesh.BaseMesh
.. automodule:: SimPEG.Mesh.BaseMesh
:members:
:undoc-members:
+2 -2
View File
@@ -3,6 +3,6 @@
Cylindrical 1D Mesh
*******************
.. automodule:: SimPEG.mesh.Cyl1DMesh
.. automodule:: SimPEG.Mesh.Cyl1DMesh
:members:
:undoc-members:
:undoc-members:
+1 -1
View File
@@ -3,6 +3,6 @@
Differential Operators
**********************
.. automodule:: SimPEG.mesh.DiffOperators
.. automodule:: SimPEG.Mesh.DiffOperators
:members:
:undoc-members:
+1 -1
View File
@@ -3,6 +3,6 @@
Inner Products
**************
.. automodule:: SimPEG.mesh.InnerProducts
.. automodule:: SimPEG.Mesh.InnerProducts
:members:
:undoc-members:
+1 -9
View File
@@ -3,16 +3,8 @@
Logically Orthogonal Mesh
*************************
.. automodule:: SimPEG.mesh.LogicallyOrthogonalMesh
.. automodule:: SimPEG.Mesh.LogicallyOrthogonalMesh
:show-inheritance:
:members:
:undoc-members:
:inherited-members:
LOM View
********
.. automodule:: SimPEG.mesh.LomView
:members:
:undoc-members:
+12 -11
View File
@@ -1,35 +1,36 @@
.. _api_Inverse:
Objective Function
******************
.. automodule:: SimPEG.ObjFunction
:members:
:undoc-members:
Optimize
********
.. automodule:: SimPEG.inverse.Optimize
.. automodule:: SimPEG.Optimization
:show-inheritance:
:private-members:
:members:
:undoc-members:
Inversion
*********
.. automodule:: SimPEG.inverse.Inversion
.. automodule:: SimPEG.Inversion
:show-inheritance:
:members:
:undoc-members:
Beta Schedule
*************
.. automodule:: SimPEG.inverse.BetaSchedule
:members:
:undoc-members:
Regularization
**************
.. automodule:: SimPEG.inverse.Regularization
.. automodule:: SimPEG.Regularization
:show-inheritance:
:members:
:undoc-members:
+3 -3
View File
@@ -4,7 +4,7 @@
Problem
*******
.. automodule:: SimPEG.forward.Problem
.. automodule:: SimPEG.Problem
:show-inheritance:
:members:
:undoc-members:
@@ -14,7 +14,7 @@ Problem
DCProblem
*********
.. automodule:: SimPEG.examples.DC
.. automodule:: SimPEG.Examples.DC
:show-inheritance:
:members:
:undoc-members:
@@ -25,7 +25,7 @@ DCProblem
Linear Problem
**************
.. automodule:: SimPEG.examples.Linear
.. automodule:: SimPEG.Examples.Linear
:show-inheritance:
:members:
:undoc-members:
+1 -8
View File
@@ -3,15 +3,8 @@
Tensor Mesh
***********
.. automodule:: SimPEG.mesh.TensorMesh
.. automodule:: SimPEG.Mesh.TensorMesh
:show-inheritance:
:members:
:undoc-members:
:inherited-members:
Tensor View
***********
.. automodule:: SimPEG.mesh.TensorView
:members:
:undoc-members:
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,6 +3,6 @@
Testing SimPEG
**************
.. automodule:: SimPEG.tests.TestUtils
.. automodule:: SimPEG.Tests.TestUtils
:members:
:undoc-members:
+8 -8
View File
@@ -4,7 +4,7 @@
Solver
******
.. automodule:: SimPEG.utils.Solver
.. automodule:: SimPEG.Solver
:members:
:undoc-members:
@@ -12,49 +12,49 @@ Solver
Utilities
*********
.. automodule:: SimPEG.utils
.. automodule:: SimPEG.Utils
:members:
:undoc-members:
Matrix Utilities
****************
.. automodule:: SimPEG.utils.matutils
.. automodule:: SimPEG.Utils.matutils
:members:
:undoc-members:
Sparse Utilities
****************
.. automodule:: SimPEG.utils.sputils
.. automodule:: SimPEG.Utils.sputils
:members:
:undoc-members:
LOM Utilities
*************
.. automodule:: SimPEG.utils.lomutils
.. automodule:: SimPEG.Utils.lomutils
:members:
:undoc-members:
Mesh Utilities
**************
.. automodule:: SimPEG.utils.meshutils
.. automodule:: SimPEG.Utils.meshutils
:members:
:undoc-members:
Model Builder Utilities
***********************
.. automodule:: SimPEG.utils.ModelBuilder
.. automodule:: SimPEG.Utils.ModelBuilder
:members:
:undoc-members:
Interpolation Utilities
***********************
.. automodule:: SimPEG.utils.interputils
.. automodule:: SimPEG.Utils.interputils
:members:
:undoc-members:
@@ -1,7 +0,0 @@
from SimPEG.mesh import LogicallyOrthogonalMesh
from SimPEG import utils
import matplotlib.pyplot as plt
X, Y = utils.exampleLomGird([3,3],'rotate')
M = LogicallyOrthogonalMesh([X, Y])
M.plotGrid()
plt.show()
-11
View File
@@ -1,11 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from SimPEG.mesh import TensorMesh
h1 = np.linspace(.1,.5,3)
h2 = np.linspace(.1,.5,5)
mesh = TensorMesh([h1, h2])
mesh.plotGrid(nodes=True, faces=True, centers=True, lines=True)
plt.show()
-12
View File
@@ -1,12 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from SimPEG.mesh import TensorMesh
h1 = np.linspace(.1,.5,3)
h2 = np.linspace(.1,.5,5)
h3 = np.linspace(.1,.5,3)
mesh = TensorMesh([h1,h2,h3])
mesh.plotGrid(nodes=True, faces=True, centers=True, lines=True)
plt.show()
-11
View File
@@ -1,11 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from SimPEG.mesh import TensorMesh
n = 20
h = np.ones(n)/n
M = TensorMesh([h, h])
I = np.sin(M.gridCC[:,0]*2*np.pi)*np.sin(M.gridCC[:,1]*2*np.pi)
M.plotImage(I)
plt.show()
-12
View File
@@ -1,12 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from SimPEG.mesh import TensorMesh
n = 20
h = np.ones(n)/n
M = TensorMesh([h,h,h])
I = np.sin(M.gridCC[:,0]*2*np.pi)*np.sin(M.gridCC[:,1]*2*np.pi)*np.sin(M.gridCC[:,2]*2*np.pi)
M.plotImage(I, annotationColor='k')
plt.show()
-13
View File
@@ -1,13 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from SimPEG.mesh import TensorMesh
x0 = np.zeros(2)
h1 = np.linspace(.1,.5,3)
h2 = np.linspace(.1,.5,5)
M = TensorMesh([h1,h2],x0)
M.plotGrid()
plt.hold()
plt.plot(M.gridN[:,0], M.gridN[:,1], 'ks', markersize=10)
plt.show()
+8 -8
View File
@@ -64,16 +64,16 @@ Build Results
=============
* Master Branch
.. image:: https://travis-ci.org/simpeg/simpeg.png?branch=master
:target: https://travis-ci.org/simpeg/simpeg
:alt: Master Branch
:align: center
.. image:: https://travis-ci.org/simpeg/simpeg.png?branch=master
:target: https://travis-ci.org/simpeg/simpeg
:alt: Master Branch
:align: center
* Develop Branch
.. image:: https://travis-ci.org/simpeg/simpeg.png?branch=develop
:target: https://travis-ci.org/simpeg/simpeg
:alt: Develop Branch
:align: center
.. image:: https://travis-ci.org/simpeg/simpeg.png?branch=develop
:target: https://travis-ci.org/simpeg/simpeg
:alt: Develop Branch
:align: center
Utility Codes