mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-05 22:01:33 +08:00
+4
-10
@@ -141,11 +141,8 @@ class Fields(object):
|
||||
# Aliased fields
|
||||
alias, loc, func = self.aliasFields[name]
|
||||
|
||||
srcII = np.array(self.survey.srcList)[ind]
|
||||
if isinstance(srcII, np.ndarray):
|
||||
srcII = srcII.tolist()
|
||||
if len(srcII) == 1:
|
||||
srcII = srcII[0]
|
||||
srcII = np.array(self.survey.srcList)[ind]
|
||||
srcII = srcII.tolist()
|
||||
|
||||
if type(func) is str:
|
||||
assert hasattr(self, func), 'The alias field function is a string, but it does not exist in the Fields class.'
|
||||
@@ -238,11 +235,8 @@ class TimeFields(Fields):
|
||||
pointerFields = pointerFields.reshape(pointerShape, order='F')
|
||||
|
||||
timeII = np.arange(self.survey.prob.nT + 1)[timeInd]
|
||||
srcII = np.array(self.survey.srcList)[srcInd]
|
||||
if isinstance(srcII, np.ndarray):
|
||||
srcII = srcII.tolist()
|
||||
if len(srcII) == 1:
|
||||
srcII = srcII[0]
|
||||
srcII = np.array(self.survey.srcList)[srcInd]
|
||||
srcII = srcII.tolist()
|
||||
|
||||
if timeII.size == 1:
|
||||
pointerShapeDeflated = self._correctShape(alias, ind, deflate=True)
|
||||
|
||||
@@ -147,7 +147,7 @@ class FieldsTest_Alias(unittest.TestCase):
|
||||
|
||||
def test_aliasFunction(self):
|
||||
def alias(e, ind):
|
||||
self.assertTrue(ind is self.Src0)
|
||||
self.assertTrue(ind[0] is self.Src0)
|
||||
return self.F.mesh.edgeCurl * e
|
||||
F = Problem.Fields(self.F.mesh, self.F.survey, knownFields={'e':'E'}, aliasFields={'b':['e','F',alias]})
|
||||
e = np.random.rand(F.mesh.nE,1)
|
||||
@@ -343,7 +343,7 @@ class FieldsTest_Time_Aliased(unittest.TestCase):
|
||||
count = [0]
|
||||
def alias(e, srcInd, timeInd):
|
||||
count[0] += 1
|
||||
self.assertTrue(srcInd is self.Src0)
|
||||
self.assertTrue(srcInd[0] is self.Src0)
|
||||
return self.F.mesh.edgeCurl * e
|
||||
F = Problem.TimeFields(self.F.mesh, self.F.survey, knownFields={'e':'E'}, aliasFields={'b':['e','F',alias]})
|
||||
e = np.random.rand(F.mesh.nE,1,nT)
|
||||
|
||||
Reference in New Issue
Block a user