From d88fc1c383b2f41847d7e5dd5c90421206f5fd27 Mon Sep 17 00:00:00 2001 From: rowanc1 Date: Tue, 15 Apr 2014 10:20:32 -0700 Subject: [PATCH] Some Changes to Maps and documentation --- SimPEG/Maps.py | 2 +- SimPEG/Mesh/BaseMesh.py | 2 +- SimPEG/Regularization.py | 3 ++- SimPEG/Tests/test_maps.py | 2 +- docs/{api_Model.rst => api_Maps.rst} | 30 ++++++++++++++-------------- docs/index.rst | 2 +- 6 files changed, 21 insertions(+), 20 deletions(-) rename docs/{api_Model.rst => api_Maps.rst} (53%) diff --git a/SimPEG/Maps.py b/SimPEG/Maps.py index 4b219f22..37b210d9 100644 --- a/SimPEG/Maps.py +++ b/SimPEG/Maps.py @@ -3,7 +3,7 @@ from Tests import checkDerivative class IdentityMap(object): """ - SimPEG Model + SimPEG Map """ diff --git a/SimPEG/Mesh/BaseMesh.py b/SimPEG/Mesh/BaseMesh.py index 2d70093c..a1b631d1 100644 --- a/SimPEG/Mesh/BaseMesh.py +++ b/SimPEG/Mesh/BaseMesh.py @@ -51,7 +51,7 @@ class BaseMesh(object): @property def nC(self): """ - Total number of cells in the model. + Total number of cells in the mesh. :rtype: int :return: nC diff --git a/SimPEG/Regularization.py b/SimPEG/Regularization.py index 68e528e3..7760f4f3 100644 --- a/SimPEG/Regularization.py +++ b/SimPEG/Regularization.py @@ -6,7 +6,7 @@ class BaseRegularization(object): This is used to regularize the model space:: - reg = Regularization(mesh, model) + reg = Regularization(mesh) """ @@ -24,6 +24,7 @@ class BaseRegularization(object): def __init__(self, mesh, mapping=None, **kwargs): Utils.setKwargs(self, **kwargs) self.mesh = mesh + assert isinstance(mesh, Mesh.BaseMesh), "mesh must be a SimPEG.Mesh object." self.mapping = mapping or Maps.IdentityMap(mesh) self.mapping._assertMatchesPair(self.mapPair) diff --git a/SimPEG/Tests/test_maps.py b/SimPEG/Tests/test_maps.py index 3b417fe6..e689c597 100644 --- a/SimPEG/Tests/test_maps.py +++ b/SimPEG/Tests/test_maps.py @@ -18,7 +18,7 @@ class MapTests(unittest.TestCase): for M in dir(Maps): try: maps = getattr(Maps, M)(self.mesh2) - assert isinstance(maps, Maps.BaseModel) + assert isinstance(maps, Maps.IdentityMap) except Exception, e: continue self.assertTrue(maps.test()) diff --git a/docs/api_Model.rst b/docs/api_Maps.rst similarity index 53% rename from docs/api_Model.rst rename to docs/api_Maps.rst index 05963ff0..7974c272 100644 --- a/docs/api_Model.rst +++ b/docs/api_Maps.rst @@ -1,45 +1,45 @@ -.. _api_Model: +.. _api_Maps: -Model -***** +Maps +**** -A SimPEG model operates on a vector and transforms it to another space. +A SimPEG Map operates on a vector and transforms it to another space. We will use an example commonly applied in electromagnetics (EM) of the -log-conductivity model (:class:`SimPEG.Model.LogModel`). +log-conductivity model. Electrical conductivity varies over many orders of magnitude, so it is a common technique when solving the inverse problem to parameterize and optimize in terms of log conductivity. This makes sense not only because it ensures all conductivities will be positive, but because this is fundamentally the space where conductivity -lives (i.e. it varies logarithmically). In SimPEG, we use the term Model to -describe how to get between these two spaces. +lives (i.e. it varies logarithmically). In SimPEG, we use a (:class:`SimPEG.Maps.ExpMap`) to +describe how to map back to conductivity. The API ======= -.. autoclass:: SimPEG.Model.BaseModel +.. autoclass:: SimPEG.Maps.IdentityMap :members: :undoc-members: -.. autoclass:: SimPEG.Model.BaseNonLinearModel +.. autoclass:: SimPEG.Maps.NonLinearMap :members: :undoc-members: -.. autoclass:: SimPEG.Model.ComboModel +.. autoclass:: SimPEG.Maps.ComboMap :members: :undoc-members: -Common Models -============= +Common Maps +=========== -.. autoclass:: SimPEG.Model.LogModel +.. autoclass:: SimPEG.Maps.ExpMap :members: :undoc-members: -.. autoclass:: SimPEG.Model.Vertical1DModel +.. autoclass:: SimPEG.Maps.Vertical1DMap :members: :undoc-members: -.. autoclass:: SimPEG.Model.Mesh2Mesh +.. autoclass:: SimPEG.Maps.Mesh2Mesh :members: :undoc-members: diff --git a/docs/index.rst b/docs/index.rst index 98f4efb7..2de51960 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -39,7 +39,7 @@ Forward Problems .. toctree:: :maxdepth: 2 - api_Model + api_Maps api_Survey api_Problem