def test_aliasFunction(self): def alias(e, ind): self.assertTrue(ind[0] is self.Src0) return self.F.mesh.edgeCurl * e F = fields.Fields( self.simulation, knownFields={"e": "E"}, aliasFields={"b": ["e", "F", alias]}, ) e = np.random.rand(F.mesh.nE, 1) F[self.Src0, "e"] = e F[self.Src0, "b"] def alias(e, ind): self.assertTrue(type(ind) is list) self.assertTrue(ind[0] is self.Src0) self.assertTrue(ind[1] is self.Src1) return self.F.mesh.edgeCurl * e F = fields.Fields( self.simulation, knownFields={"e": "E"}, aliasFields={"b": ["e", "F", alias]}, ) e = np.random.rand(F.mesh.nE, 2) F[[self.Src0, self.Src1], "e"] = e F[[self.Src0, self.Src1], "b"]
def setUp(self): mesh = discretize.TensorMesh([np.ones(n) * 5 for n in [10, 11, 12]], [0, 0, -30]) x = np.linspace(5, 10, 3) XYZ = utils.ndgrid(x, x, np.r_[0.0]) srcLoc = np.r_[0, 0, 0.0] rxList0 = survey.BaseRx(XYZ) Src0 = survey.BaseSrc([rxList0], location=srcLoc) rxList1 = survey.BaseRx(XYZ) Src1 = survey.BaseSrc([rxList1], location=srcLoc) rxList2 = survey.BaseRx(XYZ) Src2 = survey.BaseSrc([rxList2], location=srcLoc) rxList3 = survey.BaseRx(XYZ) Src3 = survey.BaseSrc([rxList3], location=srcLoc) Src4 = survey.BaseSrc([rxList0, rxList1, rxList2, rxList3], location=srcLoc) source_list = [Src0, Src1, Src2, Src3, Src4] mysurvey = survey.BaseSurvey(source_list=source_list) sim = simulation.BaseSimulation(mesh=mesh, survey=mysurvey) self.F = fields.Fields( sim, knownFields={"e": "E"}, aliasFields={ "b": ["e", "F", (lambda e, ind: self.F.mesh.edgeCurl * e)] }, ) self.Src0 = Src0 self.Src1 = Src1 self.mesh = mesh self.XYZ = XYZ self.simulation = sim
def setUp(self): mesh = discretize.TensorMesh([np.ones(n) * 5 for n in [10, 11, 12]], [0, 0, -30]) x = np.linspace(5, 10, 3) XYZ = utils.ndgrid(x, x, np.r_[0.0]) srcLoc = np.r_[0.0, 0.0, 0.0] receiver_list0 = survey.BaseRx(XYZ) Src0 = survey.BaseSrc([receiver_list0], location=srcLoc) receiver_list1 = survey.BaseRx(XYZ) Src1 = survey.BaseSrc([receiver_list1], location=srcLoc) receiver_list2 = survey.BaseRx(XYZ) Src2 = survey.BaseSrc([receiver_list2], location=srcLoc) receiver_list3 = survey.BaseRx(XYZ) Src3 = survey.BaseSrc([receiver_list3], location=srcLoc) Src4 = survey.BaseSrc( [receiver_list0, receiver_list1, receiver_list2, receiver_list3], location=srcLoc, ) source_list = [Src0, Src1, Src2, Src3, Src4] mysurvey = survey.BaseSurvey(source_list=source_list) sim = simulation.BaseSimulation(mesh=mesh, survey=mysurvey) self.D = data.Data(mysurvey) self.F = fields.Fields( sim, knownFields={ "phi": "CC", "e": "E", "b": "F" }, dtype={ "phi": float, "e": complex, "b": complex }, ) self.Src0 = Src0 self.Src1 = Src1 self.mesh = mesh self.XYZ = XYZ self.simulation = sim