Skip to content

Commit fbe0b71

Browse files
committed
Bring back Projection as input for Wires
1 parent e9911e1 commit fbe0b71

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

simpeg/maps/_base.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,20 +1140,24 @@ def __init__(self, *args):
11401140
and isinstance(arg[0], str)
11411141
and
11421142
# TODO: this should be extended to a slice.
1143-
isinstance(arg[1], (int, np.integer))
1143+
isinstance(arg[1], (int, np.integer, Projection))
11441144
), (
1145-
"Each wire needs to be a tuple: (name, length). "
1145+
"Each wire needs to be a tuple: (name, length) or (name, Projection). "
11461146
"You provided: {}".format(arg)
11471147
)
11481148

1149-
self._nP = int(np.sum([w[1] for w in args]))
11501149
start = 0
11511150
maps = []
11521151
for arg in args:
1153-
wire = Projection(self.nP, slice(start, start + arg[1]))
1152+
1153+
if isinstance(arg[1], (int, np.integer)):
1154+
wire = Projection(self.nP, slice(start, start + arg[1]))
1155+
start += arg[1]
1156+
else:
1157+
wire = arg[1]
1158+
11541159
setattr(self, arg[0], wire)
11551160
maps += [(arg[0], wire)]
1156-
start += arg[1]
11571161
self.maps = maps
11581162

11591163
self._tuple = namedtuple("Model", [w[0] for w in args])

0 commit comments

Comments
 (0)