Skip to content

Commit e0adeaf

Browse files
committed
Bring back derivs
1 parent fbe0b71 commit e0adeaf

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

simpeg/maps/_base.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,9 @@ def __init__(self, *args):
11591159
setattr(self, arg[0], wire)
11601160
maps += [(arg[0], wire)]
11611161
self.maps = maps
1162-
1163-
self._tuple = namedtuple("Model", [w[0] for w in args])
1162+
self._nP = maps[0][1].nP
1163+
self._tuple = namedtuple("Model", [name for name, _ in args])
1164+
self._projection = sp.vstack([wire.P for _, wire in self.maps])
11641165

11651166
def __mul__(self, val):
11661167
assert isinstance(val, np.ndarray)
@@ -1180,6 +1181,22 @@ def nP(self):
11801181
"""
11811182
return self._nP
11821183

1184+
def deriv(self, m):
1185+
"""
1186+
Derivative of the mapping with respect to the input parameters
1187+
1188+
Parameters
1189+
----------
1190+
m : (n_param, ) numpy.ndarray
1191+
The model for which the gradient is evaluated.
1192+
1193+
Returns
1194+
-------
1195+
(n_param, ) numpy.ndarray
1196+
The Gradient of the mapping function evaluated for the model provided.
1197+
"""
1198+
return self._projection
1199+
11831200

11841201
class TileMap(IdentityMap):
11851202
"""

0 commit comments

Comments
 (0)