Beispiel #1
0
    def test_activeCells(self):
        M = Mesh.TensorMesh([2, 4], '0C')
        for actMap in [Maps.InjectActiveCells(M, M.vectorCCy <= 0, 10,
                       nC=M.nCy), Maps.ActiveCells(M, M.vectorCCy <= 0, 10,
                       nC=M.nCy)]:

            vertMap = Maps.SurjectVertical1D(M)
            combo = vertMap * actMap
            m = np.r_[1., 2.]
            mod = Models.Model(m, combo)

            self.assertLess(np.linalg.norm(mod.transform -
                            np.r_[1, 1, 2, 2, 10, 10, 10, 10.]), TOL)
            self.assertLess((mod.transformDeriv -
                            combo.deriv(m)).toarray().sum(), TOL)
Beispiel #2
0
 def test_activeCells(self):
     M = Mesh.TensorMesh([2, 4], '0C')
     expMap = Maps.ExpMap(M)
     for actMap in [
             Maps.InjectActiveCells(M, M.vectorCCy <= 0, 10, nC=M.nCy),
             Maps.ActiveCells(M, M.vectorCCy <= 0, 10, nC=M.nCy)
     ]:
         # actMap = Maps.InjectActiveCells(M, M.vectorCCy <=0, 10, nC=M.nCy)
         vertMap = Maps.SurjectVertical1D(M)
         combo = vertMap * actMap
         m = np.r_[1, 2.]
         mod = Models.Model(m, combo)
         # import matplotlib.pyplot as plt
         # plt.colorbar(M.plotImage(mod.transform)[0])
         # plt.show()
         self.assertLess(
             np.linalg.norm(mod.transform -
                            np.r_[1, 1, 2, 2, 10, 10, 10, 10.]), TOL)
         self.assertLess(
             (mod.transformDeriv - combo.deriv(m)).toarray().sum(), TOL)
Beispiel #3
0
# Load model file
model = Mesh.TensorMesh.readModelUBC(mesh, modfile)
model[model == ndv] = 0.

# Load in topofile or create flat surface
if topofile == 'null':

    actv = np.ones(mesh.nC)

else:
    topo = np.genfromtxt(topofile, skip_header=1)
    actv = PF.Magnetics.getActiveTopo(mesh, topo, 'N')

# Create active map to go from reduce set to full
actvMap = Maps.ActiveCells(mesh, actv, -100)

Mesh.TensorMesh.writeModelUBC(mesh, 'nullcell.dat',
                              actvMap * np.ones(len(actv)))

# Load in observation file
survey = PF.Magnetics.readUBCmagObs(obsfile)

rxLoc = survey.srcField.rxList[0].locs
d = None

#rxLoc[:,2] += 5 # Temporary change for test
ndata = rxLoc.shape[0]

#%% Subdivide the forward data locations into tiles
PF.Magnetics.plot_obs_2D(rxLoc)