diff --git a/SimPEG/Maps.py b/SimPEG/Maps.py index 74a92efd..6dca13dd 100644 --- a/SimPEG/Maps.py +++ b/SimPEG/Maps.py @@ -285,6 +285,37 @@ class LogMap(IdentityMap): def inverse(self, m): return np.exp(Utils.mkvc(m)) +class FullMap(IdentityMap): + """ + FullMap + + Given a scalar, the FullMap maps the value to the + full model space. + """ + + def __init__(self,mesh,**kwargs): + IdentityMap.__init__(self, mesh,**kwargs) + + @property + def nP(self): + return 1 + + def _transform(self, m): + """ + :param m: model (scalar) + :rtype: numpy.array + :return: transformed model + """ + return np.ones(self.mesh.nC)*m + + def deriv(self, m): + """ + :param numpy.array m: model + :rtype: numpy.array + :return: derivative of transformed model + """ + return np.ones([self.mesh.nC,1]) + class Vertical1DMap(IdentityMap): """Vertical1DMap diff --git a/SimPEG/Tests/test_maps.py b/SimPEG/Tests/test_maps.py index a80bc40b..a4ebd80c 100644 --- a/SimPEG/Tests/test_maps.py +++ b/SimPEG/Tests/test_maps.py @@ -6,8 +6,8 @@ from scipy.sparse.linalg import dsolve TOL = 1e-14 -MAPS_TO_TEST_2D = ["CircleMap", "ComplexMap", "ExpMap", "IdentityMap", "Vertical1DMap", "Weighting"] -MAPS_TO_TEST_3D = [ "ComplexMap", "ExpMap", "IdentityMap", "Vertical1DMap", "Weighting"] +MAPS_TO_TEST_2D = ["CircleMap", "ComplexMap", "ExpMap", "IdentityMap", "Vertical1DMap", "Weighting", "FullMap"] +MAPS_TO_TEST_3D = [ "ComplexMap", "ExpMap", "IdentityMap", "Vertical1DMap", "Weighting", "FullMap"] class MapTests(unittest.TestCase):