Beispiel #1
0
    def test_Problem2D_N(self):

        problemDC = DC.Problem2D_N(self.mesh,
                                   sigmaMap=Maps.IdentityMap(self.mesh))
        problemDC.Solver = Solver
        problemDC.pair(self.surveyDC)
        data0 = self.surveyDC.dpred(self.sigma0)
        datainf = self.surveyDC.dpred(self.sigmaInf)
        problemIP = IP.Problem2D_N(
            self.mesh,
            sigma=self.sigmaInf,
            etaMap=Maps.IdentityMap(self.mesh),
        )
        problemIP.Solver = Solver
        surveyIP = IP.Survey(self.srcLists_ip)
        problemIP.pair(surveyIP)
        data_full = data0 - datainf
        data = surveyIP.dpred(self.eta)
        err = np.linalg.norm(
            (data - data_full) / data_full)**2 / data_full.size
        if err < 0.05:
            passed = True
            print(">> IP forward test for Problem2D_N is passed")
            print(err)
        else:
            passed = False
            print(">> IP forward test for Problem2D_N is failed")
        self.assertTrue(passed)
Beispiel #2
0
    def test_Problem3D_N(self):

        problem = DC.Problem2D_N(self.mesh)
        problem.Solver = self.Solver
        problem.pair(self.survey)
        data = self.survey.dpred(self.sigma)
        err= np.linalg.norm((data-self.data_anal)/self.data_anal)**2 / self.data_anal.size
        if err < 0.05:
            passed = True
            print ">> DC analytic test for Problem3D_N is passed"
        else:
            passed = False
            print ">> DC analytic test for Problem3D_N is failed"
        self.assertTrue(passed)
Beispiel #3
0
    def test_Problem2D_N(self, tolerance=0.05):

        problem = DC.Problem2D_N(self.mesh, sigma=self.sigma)
        problem.Solver = self.Solver
        problem.pair(self.survey)
        data = self.survey.dpred()
        err = (np.linalg.norm(
            (data - self.data_anal) / self.data_anal)**2 / self.data_anal.size)
        if err < tolerance:
            passed = True
            print(">> DC analytic test for PDP Problem2D_N is passed")
        else:
            print(err)
            passed = False
            print(">> DC analytic test for PDP Problem2D_N is failed")
        self.assertTrue(passed)
    def setUp(self):

        cs = 12.5
        hx = [(cs, 7, -1.3), (cs, 61), (cs, 7, 1.3)]
        hy = [(cs, 7, -1.3), (cs, 20)]
        mesh = Mesh.TensorMesh([hx, hy], x0="CN")
        x = np.linspace(-135, 250., 20)
        M = Utils.ndgrid(x - 12.5, np.r_[0.])
        N = Utils.ndgrid(x + 12.5, np.r_[0.])
        A0loc = np.r_[-150, 0.]
        A1loc = np.r_[-130, 0.]
        rxloc = [np.c_[M, np.zeros(20)], np.c_[N, np.zeros(20)]]
        rx = DC.Rx.Dipole_ky(M, N)
        src0 = DC.Src.Pole([rx], A0loc)
        src1 = DC.Src.Pole([rx], A1loc)
        survey = DC.Survey_ky([src0, src1])
        problem = DC.Problem2D_N(mesh,
                                 mapping=[('rho', Maps.IdentityMap(mesh))])
        problem.pair(survey)

        mSynth = np.ones(mesh.nC) * 1.
        survey.makeSyntheticData(mSynth)

        # Now set up the problem to do some minimization
        dmis = DataMisfit.l2_DataMisfit(survey)
        reg = Regularization.Tikhonov(mesh)
        opt = Optimization.InexactGaussNewton(maxIterLS=20,
                                              maxIter=10,
                                              tolF=1e-6,
                                              tolX=1e-6,
                                              tolG=1e-6,
                                              maxIterCG=6)
        invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta=1e0)
        inv = Inversion.BaseInversion(invProb)

        self.inv = inv
        self.reg = reg
        self.p = problem
        self.mesh = mesh
        self.m0 = mSynth
        self.survey = survey
        self.dmis = dmis
Beispiel #5
0
                    orientation="horizontal",
                    ax=axs,
                    ticks=np.linspace(vmin, vmax, 3))
cbar.ax.set_xticklabels([
    str(int(10**-vmin)),
    str(int(np.round(10**(-(vmin + vmax) / 2) / 10) * 10)),
    str(int(10**-vmax))
])
cbar.set_label('Resistivity ($\Omega \cdot m$)')

plotPoles(survey2D, stype, axs)

#%% # Simpeg INV
m0 = np.ones(mesh2d.nC) * np.log(1e-2)
mapping = Maps.ExpMap(mesh2d)
problem = DC.Problem2D_N(mesh2d, sigmaMap=mapping)
problem.Solver = PardisoSolver

srcLists2D = []
for iSrc in range(survey2D.nSrc):
    src = survey2D.srcList[iSrc]
    locsM = np.c_[src.rxList[0].locs[0][:, 0],
                  src.rxList[0].locs[0][:, 2] - dx_in / 2.]
    locsN = np.c_[src.rxList[0].locs[1][:, 0],
                  src.rxList[0].locs[1][:, 2] - dx_in / 2.]
    rx = DC.Rx.Dipole_ky(locsM, locsN)
    locA = np.r_[src.loc[0][0], src.loc[0][2] - dx_in / 2.]
    locB = np.r_[src.loc[1][0], src.loc[1][2] - dx_in / 2.]
    src = DC.Src.Dipole([rx], locA, locB)
    srcLists2D.append(src)
DCsurvey2D = DC.Survey_ky(srcLists2D)