diff --git a/SimPEG/Model.py b/SimPEG/Model.py index f6d4d6d4..ce2349d0 100644 --- a/SimPEG/Model.py +++ b/SimPEG/Model.py @@ -64,6 +64,68 @@ class BaseModel(object): m = self.example() return checkDerivative(lambda m : [self.transform(m), self.transformDeriv(m)], m, plotIt=False) +class BaseNonLinearModel(object): + """ + SimPEG BaseNonLinearModel + + """ + + __metaclass__ = Utils.SimPEGMetaClass + + counter = None #: A SimPEG.Utils.Counter object + mesh = None #: A SimPEG Mesh + + def __init__(self, mesh): + self.mesh = mesh + + def transform(self, u, m): + """ + :param numpy.array u: fields + :param numpy.array m: model + :rtype: numpy.array + :return: transformed model + + The *transform* changes the model into the physical property. + + """ + return m + + def transformDerivU(self, u, m): + """ + :param numpy.array u: fields + :param numpy.array m: model + :rtype: scipy.csr_matrix + :return: derivative of transformed model + + The *transform* changes the model into the physical property. + The *transformDerivU* provides the derivative of the *transform* with respect to the fields. + """ + raise NotImplementedError('The transformDerivU is not implemented.') + + + def transformDerivM(self, u, m): + """ + :param numpy.array u: fields + :param numpy.array m: model + :rtype: scipy.csr_matrix + :return: derivative of transformed model + + The *transform* changes the model into the physical property. + The *transformDerivU* provides the derivative of the *transform* with respect to the model. + """ + raise NotImplementedError('The transformDerivM is not implemented.') + + @property + def nP(self): + """Number of parameters in the model.""" + return self.mesh.nC + + def example(self): + raise NotImplementedError('The example is not implemented.') + + def test(self, m=None): + raise NotImplementedError('The test is not implemented.') + class LogModel(BaseModel): """SimPEG LogModel""" diff --git a/SimPEG/Problem.py b/SimPEG/Problem.py index 350ff93a..414d0c33 100644 --- a/SimPEG/Problem.py +++ b/SimPEG/Problem.py @@ -41,7 +41,7 @@ class BaseProblem(object): dataPair = Data.BaseData modelPair = Model.BaseModel - def __init__(self, mesh, model, *args, **kwargs): + def __init__(self, mesh, model, **kwargs): Utils.setKwargs(self, **kwargs) self.mesh = mesh assert isinstance(model, self.modelPair), "Model object must be an instance of a %s class."%(self.modelPair.__name__) diff --git a/docs/api_BaseMesh.rst b/docs/api_BaseMesh.rst deleted file mode 100644 index fcf0e8c1..00000000 --- a/docs/api_BaseMesh.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _api_BaseMesh: - -Base Mesh -********* - -.. automodule:: SimPEG.Mesh.BaseMesh - :members: - :undoc-members: diff --git a/docs/api_Cyl1DMesh.rst b/docs/api_Cyl1DMesh.rst deleted file mode 100644 index 573e6c5e..00000000 --- a/docs/api_Cyl1DMesh.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _api_Cyl1DMesh: - -Cylindrical 1D Mesh -******************* - -.. automodule:: SimPEG.Mesh.Cyl1DMesh - :members: - :undoc-members: diff --git a/docs/api_DiffOperators.rst b/docs/api_DiffOperators.rst deleted file mode 100644 index a3a2ca98..00000000 --- a/docs/api_DiffOperators.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _api_DiffOperators: - -Differential Operators -********************** - -.. automodule:: SimPEG.Mesh.DiffOperators - :members: - :undoc-members: diff --git a/docs/api_Forward.rst b/docs/api_Forward.rst index 91009294..067a902f 100644 --- a/docs/api_Forward.rst +++ b/docs/api_Forward.rst @@ -2,7 +2,7 @@ Model -***** +===== .. automodule:: SimPEG.Model :show-inheritance: @@ -11,7 +11,7 @@ Model :inherited-members: Data -**** +==== .. automodule:: SimPEG.Data :show-inheritance: @@ -20,7 +20,7 @@ Data :inherited-members: Problem -******* +======= .. automodule:: SimPEG.Problem :show-inheritance: diff --git a/docs/api_InnerProducts.rst b/docs/api_InnerProducts.rst deleted file mode 100644 index e2f54c8e..00000000 --- a/docs/api_InnerProducts.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _api_InnerProducts: - -Inner Products -************** - -.. automodule:: SimPEG.Mesh.InnerProducts - :members: - :undoc-members: diff --git a/docs/api_Inverse.rst b/docs/api_Inverse.rst index 21f4386e..ab711f81 100644 --- a/docs/api_Inverse.rst +++ b/docs/api_Inverse.rst @@ -2,7 +2,7 @@ Regularization -************** +============== .. automodule:: SimPEG.Regularization :show-inheritance: @@ -11,7 +11,7 @@ Regularization Objective Function -****************** +================== .. automodule:: SimPEG.ObjFunction :members: @@ -19,7 +19,7 @@ Objective Function Optimize -******** +======== .. automodule:: SimPEG.Optimization :show-inheritance: @@ -28,7 +28,7 @@ Optimize :undoc-members: Inversion -********* +========= .. automodule:: SimPEG.Inversion :show-inheritance: diff --git a/docs/api_LogicallyOrthogonalMesh.rst b/docs/api_LogicallyOrthogonalMesh.rst deleted file mode 100644 index 449ed6f8..00000000 --- a/docs/api_LogicallyOrthogonalMesh.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. _api_LogicallyOrthogonalMesh: - -Logically Orthogonal Mesh -************************* - -.. automodule:: SimPEG.Mesh.LogicallyOrthogonalMesh - :show-inheritance: - :members: - :undoc-members: - :inherited-members: diff --git a/docs/api_Mesh.rst b/docs/api_Mesh.rst new file mode 100644 index 00000000..a964b24d --- /dev/null +++ b/docs/api_Mesh.rst @@ -0,0 +1,53 @@ +.. _api_Mesh: + + +Tensor Mesh +=========== + +.. automodule:: SimPEG.Mesh.TensorMesh + :show-inheritance: + :members: + :undoc-members: + :inherited-members: + + +Cylindrical 1D Mesh +=================== + +.. automodule:: SimPEG.Mesh.Cyl1DMesh + :members: + :undoc-members: + + +Logically Orthogonal Mesh +========================= + +.. automodule:: SimPEG.Mesh.LogicallyOrthogonalMesh + :show-inheritance: + :members: + :undoc-members: + :inherited-members: + + + +Base Mesh +========= + +.. automodule:: SimPEG.Mesh.BaseMesh + :members: + :undoc-members: + + +Inner Products +============== + +.. automodule:: SimPEG.Mesh.InnerProducts + :members: + :undoc-members: + +Differential Operators +====================== + +.. automodule:: SimPEG.Mesh.DiffOperators + :members: + :undoc-members: diff --git a/docs/api_Parameters.rst b/docs/api_Parameters.rst index e90b58a5..1a333b88 100644 --- a/docs/api_Parameters.rst +++ b/docs/api_Parameters.rst @@ -2,7 +2,7 @@ Parameters -********** +========== .. automodule:: SimPEG.Parameters :show-inheritance: diff --git a/docs/api_TensorMesh.rst b/docs/api_TensorMesh.rst deleted file mode 100644 index 9cf80c41..00000000 --- a/docs/api_TensorMesh.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. _api_TensorMesh: - -Tensor Mesh -*********** - -.. automodule:: SimPEG.Mesh.TensorMesh - :show-inheritance: - :members: - :undoc-members: - :inherited-members: diff --git a/docs/api_Tests.rst b/docs/api_Tests.rst index 0ab45c51..614d8747 100644 --- a/docs/api_Tests.rst +++ b/docs/api_Tests.rst @@ -1,7 +1,7 @@ .. _api_Tests: Testing SimPEG -************** +============== .. automodule:: SimPEG.Tests.TestUtils :members: diff --git a/docs/api_Utils.rst b/docs/api_Utils.rst index 9c40cabe..641e6d60 100644 --- a/docs/api_Utils.rst +++ b/docs/api_Utils.rst @@ -17,42 +17,35 @@ Utilities :undoc-members: Matrix Utilities -**************** +================ .. automodule:: SimPEG.Utils.matutils :members: :undoc-members: -Sparse Utilities -**************** - -.. automodule:: SimPEG.Utils.sputils - :members: - :undoc-members: - LOM Utilities -************* +============= .. automodule:: SimPEG.Utils.lomutils :members: :undoc-members: Mesh Utilities -************** +============== .. automodule:: SimPEG.Utils.meshutils :members: :undoc-members: Model Builder Utilities -*********************** +======================= .. automodule:: SimPEG.Utils.ModelBuilder :members: :undoc-members: Interpolation Utilities -*********************** +======================= .. automodule:: SimPEG.Utils.interputils :members: diff --git a/docs/index.rst b/docs/index.rst index 9ed98291..84e0f925 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,10 +11,12 @@ The vision is to create a package for finite volume simulation and parameter est applications to geophysical imaging and subsurface flow. To enable these goals, this package has the following features: -* is modular with respect to discretization, physics, optimization, and regularization -* is built with the (large-scale) inverse problem in mind -* provides a framework for geophysical and hydrogeologic problems -* supports 1D, 2D and 3D problems + + * is modular with respect to discretization, physics, optimization, and regularization + * is built with the (large-scale) inverse problem in mind + * provides a framework for geophysical and hydrogeologic problems + * supports 1D, 2D and 3D problems + .. image:: simpeg-framework.png :width: 400 px @@ -22,20 +24,15 @@ these goals, this package has the following features: :align: center Meshing & Operators -=================== +******************* .. toctree:: :maxdepth: 2 - api_BaseMesh - api_TensorMesh - api_LogicallyOrthogonalMesh - api_Cyl1DMesh - api_DiffOperators - api_InnerProducts + api_Mesh Forward Problems -================ +**************** .. toctree:: :maxdepth: 2 @@ -43,7 +40,7 @@ Forward Problems api_Forward Inversion -========= +********* .. toctree:: :maxdepth: 2 @@ -52,7 +49,7 @@ Inversion api_Parameters Testing SimPEG -============== +************** .. toctree:: :maxdepth: 2 @@ -60,20 +57,20 @@ Testing SimPEG api_Tests * Master Branch - .. image:: https://travis-ci.org/simpeg/simpeg.png?branch=master + .. 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 + .. image:: https://travis-ci.org/simpeg/simpeg.png?branch*develop :target: https://travis-ci.org/simpeg/simpeg :alt: Develop Branch :align: center Utility Codes -============= +************* .. toctree:: :maxdepth: 2 @@ -82,7 +79,7 @@ Utility Codes Project Index & Search -====================== +********************** * :ref:`genindex` * :ref:`modindex`