From 950fcc572f85168365b66b1b4ffbce476ca12fc7 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Mon, 30 Sep 2013 10:20:23 -0700 Subject: [PATCH] Documentation updates. --- SimPEG/TensorView.py | 22 +++++++++++++++------- docs/api_DiffOperators.rst | 8 ++++++++ docs/api_GaussNewton.rst | 8 ++++++++ docs/api_InnerProducts.rst | 8 ++++++++ docs/api_LOMView.rst | 8 ++++++++ docs/api_LogicallyOrthogonalMesh.rst | 8 ++++++++ docs/api_TensorView.rst | 8 ++++++++ docs/examples/mesh/plot_image_2D.py | 11 +++++++++++ docs/examples/mesh/plot_image_3D.py | 12 ++++++++++++ docs/examples/mesh/plot_nodes.py | 13 +++++++++++++ docs/index.rst | 23 +++++++++++++++++++++-- 11 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 docs/api_DiffOperators.rst create mode 100644 docs/api_GaussNewton.rst create mode 100644 docs/api_InnerProducts.rst create mode 100644 docs/api_LOMView.rst create mode 100644 docs/api_LogicallyOrthogonalMesh.rst create mode 100644 docs/api_TensorView.rst create mode 100644 docs/examples/mesh/plot_image_2D.py create mode 100644 docs/examples/mesh/plot_image_3D.py create mode 100644 docs/examples/mesh/plot_nodes.py diff --git a/SimPEG/TensorView.py b/SimPEG/TensorView.py index 3140bdd5..2b02bfaa 100644 --- a/SimPEG/TensorView.py +++ b/SimPEG/TensorView.py @@ -21,15 +21,23 @@ class TensorView(object): Input: - I - scalar field (np.array) + :param numpy.array I: scalar field Optional Input: - imageType - type of image ('CC','N','Fx','Fy','Fz','Ex','Ey','Ez') - figNum - number of figure to plot to - ax - axis to plot to - direction - 3D only. slice dimensions - numbering - 3D only. show numbering of slices + :param str imageType: type of image ('CC','N','Fx','Fy','Fz','Ex','Ey','Ez') + :param int figNum: number of figure to plot to + :param matplotlib.axes.Axes ax: axis to plot to + :param str direction: slice dimensions, 3D only ('x', 'y', 'z') + :param bool numbering: show numbering of slices, 3D only + :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:: 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" @@ -154,6 +162,7 @@ class TensorView(object): gyY = np.c_[gy, gy, gy+np.nan].ravel() ax.plot(gxX, gxY, annotationColor+'-', linewidth=2) ax.plot(gyX, gyY, annotationColor+'-', linewidth=2) + ax.axis('tight') if numbering: pad = np.sum(self.hx)*0.04 @@ -170,7 +179,6 @@ class TensorView(object): def plotGrid(self, showIt=False): """Plot the nodal, cell-centered and staggered grids for 1,2 and 3 dimensions. - .. plot:: examples/mesh/plot_grid_2D.py :include-source: diff --git a/docs/api_DiffOperators.rst b/docs/api_DiffOperators.rst new file mode 100644 index 00000000..57763a33 --- /dev/null +++ b/docs/api_DiffOperators.rst @@ -0,0 +1,8 @@ +.. _api_DiffOperators: + +Differential Operators +********************** + +.. automodule:: SimPEG.DiffOperators + :members: + :undoc-members: diff --git a/docs/api_GaussNewton.rst b/docs/api_GaussNewton.rst new file mode 100644 index 00000000..65012347 --- /dev/null +++ b/docs/api_GaussNewton.rst @@ -0,0 +1,8 @@ +.. _api_GaussNewton: + +Gauss Newton +************ + +.. automodule:: SimPEG.GaussNewton + :members: + :undoc-members: diff --git a/docs/api_InnerProducts.rst b/docs/api_InnerProducts.rst new file mode 100644 index 00000000..6dfd2a77 --- /dev/null +++ b/docs/api_InnerProducts.rst @@ -0,0 +1,8 @@ +.. _api_InnerProducts: + +Inner Products +************** + +.. automodule:: SimPEG.InnerProducts + :members: + :undoc-members: diff --git a/docs/api_LOMView.rst b/docs/api_LOMView.rst new file mode 100644 index 00000000..67e1bb91 --- /dev/null +++ b/docs/api_LOMView.rst @@ -0,0 +1,8 @@ +.. _api_LOMView: + +LOM View +*********** + +.. automodule:: SimPEG.LOMView + :members: + :undoc-members: diff --git a/docs/api_LogicallyOrthogonalMesh.rst b/docs/api_LogicallyOrthogonalMesh.rst new file mode 100644 index 00000000..3b8296d7 --- /dev/null +++ b/docs/api_LogicallyOrthogonalMesh.rst @@ -0,0 +1,8 @@ +.. _api_LogicallyOrthogonalMesh: + +Logically Orthogonal Mesh +************************* + +.. automodule:: SimPEG.LogicallyOrthogonalMesh + :members: + :undoc-members: diff --git a/docs/api_TensorView.rst b/docs/api_TensorView.rst new file mode 100644 index 00000000..6ae80276 --- /dev/null +++ b/docs/api_TensorView.rst @@ -0,0 +1,8 @@ +.. _api_TensorView: + +Tensor View +*********** + +.. automodule:: SimPEG.TensorView + :members: + :undoc-members: diff --git a/docs/examples/mesh/plot_image_2D.py b/docs/examples/mesh/plot_image_2D.py new file mode 100644 index 00000000..c7bcb0d5 --- /dev/null +++ b/docs/examples/mesh/plot_image_2D.py @@ -0,0 +1,11 @@ +import numpy as np +import matplotlib.pyplot as plt +from SimPEG 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() diff --git a/docs/examples/mesh/plot_image_3D.py b/docs/examples/mesh/plot_image_3D.py new file mode 100644 index 00000000..d00756a1 --- /dev/null +++ b/docs/examples/mesh/plot_image_3D.py @@ -0,0 +1,12 @@ +import numpy as np +import matplotlib.pyplot as plt +from SimPEG 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() diff --git a/docs/examples/mesh/plot_nodes.py b/docs/examples/mesh/plot_nodes.py new file mode 100644 index 00000000..5d2c912b --- /dev/null +++ b/docs/examples/mesh/plot_nodes.py @@ -0,0 +1,13 @@ +import numpy as np +import matplotlib.pyplot as plt +from SimPEG 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() + diff --git a/docs/index.rst b/docs/index.rst index 20998c3f..ce50bc3d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -16,8 +16,8 @@ The vision is to create a package for finite volume simulation with applications * supports 2D and 3D problems -Contents -======== +Meshing & Operators +=================== .. toctree:: :maxdepth: 2 @@ -25,6 +25,25 @@ Contents api_BaseMesh api_TensorMesh api_TensorView + api_LogicallyOrthogonalMesh + api_LomView + api_DiffOperators + api_InnerProducts + +Inversion +========= + +.. toctree:: + :maxdepth: 2 + + api_GaussNewton + +Example Problems +================ + +.. toctree:: + :maxdepth: 2 + Project Index & Search