コード例 #1
0
ファイル: em1dtd_inv_test.py プロジェクト: simpeg/simpegEM1D
from SimPEG import *
from simpegEM1D import (
    EM1D, EM1DSurveyTD, Utils1D, get_vertical_discretization_time, 
    set_mesh_1d, EM1DAnalytics
)
import numpy as np
from simpegEM1D import skytem_HM_2015
wave = skytem_HM_2015()
time = np.logspace(-6, -2, 21)
hz = get_vertical_discretization_time(time, facter_tmax=0.5, factor_tmin=10.)
mesh1D = set_mesh_1d(hz)
depth = -mesh1D.gridN[:-1]
LocSigZ = -mesh1D.gridCC

# time_input_currents = np.r_[0., 5.5*1e-4, 5.5*1e-4+1e-5]
# input_currents = np.r_[0., 1., 0.]
time_input_currents = wave.current_times[-7:]
input_currents = wave.currents[-7:]

TDsurvey = EM1DSurveyTD(
    rx_location = np.array([0., 0., 100.+30.]),
    src_location = np.array([0., 0., 100.+30.]),
    topo = np.r_[0., 0., 100.],
    depth = depth,
    rx_type = 'dBzdt',
    wave_type = 'general',
    src_type = 'CircularLoop',
    a = 13.,
    time = time,
    time_input_currents=time_input_currents,
    input_currents=input_currents,
コード例 #2
0
    def setUp(self):

        wave_HM = skytem_HM_2015()
        wave_LM = skytem_LM_2015()
        time_HM = wave_HM.time_gate_center[0::2]
        time_LM = wave_LM.time_gate_center[0::2]

        hz = get_vertical_discretization_time(np.unique(np.r_[time_HM,
                                                              time_LM]),
                                              facter_tmax=0.5,
                                              factor_tmin=10.)
        mesh1D = set_mesh_1d(hz)
        depth = -mesh1D.gridN[:-1]
        LocSigZ = -mesh1D.gridCC

        time_input_currents_HM = wave_HM.current_times[-7:]
        input_currents_HM = wave_HM.currents[-7:]
        time_input_currents_LM = wave_LM.current_times[-13:]
        input_currents_LM = wave_LM.currents[-13:]

        TDsurvey = EM1DSurveyTD(
            rx_location=np.array([0., 0., 100.]),
            src_location=np.array([0., 0., 100.]),
            topo=np.r_[0., 0., 100.],
            depth=depth,
            rx_type='dBzdt',
            wave_type='general',
            src_type='CircularLoop',
            a=13.,
            I=1.,
            time=time_HM,
            time_input_currents=time_input_currents_HM,
            input_currents=input_currents_HM,
            n_pulse=2,
            base_frequency=25.,
            use_lowpass_filter=False,
            high_cut_frequency=7e4,
            moment_type='dual',
            time_dual_moment=time_HM,
            time_input_currents_dual_moment=time_input_currents_LM,
            input_currents_dual_moment=input_currents_LM,
            base_frequency_dual_moment=210,
        )

        sig_half = 1e-2
        chi_half = 0.

        expmap = Maps.ExpMap(mesh1D)
        m_1D = np.log(np.ones(TDsurvey.n_layer) * sig_half)
        chi = np.zeros(TDsurvey.n_layer)

        prob = EM1D(mesh1D, sigmaMap=expmap, chi=chi)
        prob.pair(TDsurvey)

        self.survey = TDsurvey
        self.prob = prob
        self.mesh1D = mesh1D
        self.showIt = False
        self.chi = chi
        self.m_1D = m_1D
        self.sig_half = sig_half
        self.expmap = expmap
コード例 #3
0
    ToggleButtons,
    Button,
    Output
)

  
rhomin=0.1
rhomax=1000.
rho_default=50.
zmin=0.
zmax=350
rho_half=30.
tx_alt= 30.

time = np.logspace(-5, -2, 31)
hz = get_vertical_discretization_time(time, facter_tmax=0.3, factor_tmin=10., n_layer=19)
mesh1D = set_mesh_1d(hz)
depth = -mesh1D.gridN[:-1]
LocSigZ = -mesh1D.gridCC
TDsurvey = EM1DSurveyTD(
    rx_location = np.array([0., 0., 100.+tx_alt]),
    src_location = np.array([0., 0., 100.+tx_alt]),
    topo = np.r_[0., 0., 100.],
    depth = depth,
    rx_type = 'dBzdt',
    wave_type = 'stepoff',
    src_type = 'CircularLoop',
    a = 13.,
    I = 1.,
    time = time,
    base_frequency = 25.,
コード例 #4
0
    def setUp(self):

        wave_HM = skytem_HM_2015()
        wave_LM = skytem_LM_2015()
        time_HM = wave_HM.time_gate_center[0::2]
        time_LM = wave_LM.time_gate_center[0::2]

        hz = get_vertical_discretization_time(
            np.unique(np.r_[time_HM, time_LM]), facter_tmax=0.5, factor_tmin=10.
        )
        mesh1D = set_mesh_1d(hz)
        depth = -mesh1D.gridN[:-1]
        LocSigZ = -mesh1D.gridCC

        time_input_currents_HM = wave_HM.current_times[-7:]
        input_currents_HM = wave_HM.currents[-7:]
        time_input_currents_LM = wave_LM.current_times[-13:]
        input_currents_LM = wave_LM.currents[-13:]

        TDsurvey = EM1DSurveyTD(
            rx_location=np.array([0., 0., 100.]),
            src_location=np.array([0., 0., 100.]),
            topo=np.r_[0., 0., 100.],
            depth=depth,
            rx_type='dBzdt',
            wave_type='general',
            src_type='CircularLoop',
            a=13.,
            I=1.,
            time=time_HM,
            time_input_currents=time_input_currents_HM,
            input_currents=input_currents_HM,
            n_pulse=2,
            base_frequency=25.,
            use_lowpass_filter=False,
            high_cut_frequency=7e4,
            moment_type='dual',
            time_dual_moment=time_HM,
            time_input_currents_dual_moment=time_input_currents_LM,
            input_currents_dual_moment=input_currents_LM,
            base_frequency_dual_moment=210,
        )

        sig_half=1e-2
        chi_half=0.

        expmap = Maps.ExpMap(mesh1D)
        m_1D = np.log(np.ones(TDsurvey.n_layer)*sig_half)
        chi = np.zeros(TDsurvey.n_layer)

        prob = EM1D(
            mesh1D, sigmaMap=expmap, chi=chi
        )
        prob.pair(TDsurvey)

        self.survey = TDsurvey
        self.prob = prob
        self.mesh1D = mesh1D
        self.showIt = False
        self.chi = chi
        self.m_1D = m_1D
        self.sig_half = sig_half
        self.expmap = expmap
コード例 #5
0
    def setUp(self, parallel=True):
        time = np.logspace(-6, -3, 21)
        hz = get_vertical_discretization_time(time,
                                              facter_tmax=0.5,
                                              factor_tmin=10.)
        time_input_currents = wave.current_times[-7:]
        input_currents = wave.currents[-7:]

        n_sounding = 5
        dx = 20.
        hx = np.ones(n_sounding) * dx
        mesh = Mesh.TensorMesh([hx, hz], x0='00')
        inds = mesh.gridCC[:, 1] < 25
        inds_1 = mesh.gridCC[:, 1] < 50
        sigma = np.ones(mesh.nC) * 1. / 100.
        sigma[inds_1] = 1. / 10.
        sigma[inds] = 1. / 50.
        sigma_em1d = sigma.reshape(mesh.vnC, order='F').flatten()
        mSynth = np.log(sigma_em1d)

        x = mesh.vectorCCx
        y = np.zeros_like(x)
        z = np.ones_like(x) * 30.
        rx_locations = np.c_[x, y, z]
        src_locations = np.c_[x, y, z]
        topo = np.c_[x, y, z - 30.].astype(float)

        n_sounding = rx_locations.shape[0]

        rx_type_global = np.array(["dBzdt"], dtype=str).repeat(n_sounding,
                                                               axis=0)
        field_type_global = np.array(['secondary'],
                                     dtype=str).repeat(n_sounding, axis=0)
        wave_type_global = np.array(['general'], dtype=str).repeat(n_sounding,
                                                                   axis=0)

        time_global = [time for i in range(n_sounding)]

        src_type_global = np.array(["CircularLoop"],
                                   dtype=str).repeat(n_sounding, axis=0)
        a_global = np.array([13.], dtype=float).repeat(n_sounding, axis=0)
        input_currents_global = [input_currents for i in range(n_sounding)]
        time_input_currents_global = [
            time_input_currents for i in range(n_sounding)
        ]

        mapping = Maps.ExpMap(mesh)

        survey = GlobalEM1DSurveyTD(
            rx_locations=rx_locations,
            src_locations=src_locations,
            topo=topo,
            time=time_global,
            src_type=src_type_global,
            rx_type=rx_type_global,
            field_type=field_type_global,
            wave_type=wave_type_global,
            a=a_global,
            input_currents=input_currents_global,
            time_input_currents=time_input_currents_global)

        problem = GlobalEM1DProblemTD(mesh,
                                      sigmaMap=mapping,
                                      hz=hz,
                                      parallel=parallel,
                                      n_cpu=2)
        problem.pair(survey)

        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=0.)
        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
コード例 #6
0
    def setUp(self, parallel=True):
        time = np.logspace(-6, -3, 21)
        time_input_currents = wave.current_times[-7:]
        input_currents = wave.currents[-7:]
        hz = get_vertical_discretization_time(time,
                                              facter_tmax=0.5,
                                              factor_tmin=10.)

        hz = np.r_[1.]
        n_sounding = 10
        dx = 20.
        hx = np.ones(n_sounding) * dx
        e = np.ones(n_sounding)
        mSynth = np.r_[e * np.log(1. / 100.), e * 20]

        x = np.arange(n_sounding)
        y = np.zeros_like(x)
        z = np.ones_like(x) * 30.
        rx_locations = np.c_[x, y, z]
        src_locations = np.c_[x, y, z]
        topo = np.c_[x, y, z - 30.].astype(float)

        rx_type_global = np.array(["dBzdt"], dtype=str).repeat(n_sounding,
                                                               axis=0)
        field_type_global = np.array(['secondary'],
                                     dtype=str).repeat(n_sounding, axis=0)
        wave_type_global = np.array(['general'], dtype=str).repeat(n_sounding,
                                                                   axis=0)

        time_global = [time for i in range(n_sounding)]

        src_type_global = np.array(["CircularLoop"],
                                   dtype=str).repeat(n_sounding, axis=0)
        a_global = np.array([13.], dtype=float).repeat(n_sounding, axis=0)
        input_currents_global = [input_currents for i in range(n_sounding)]
        time_input_currents_global = [
            time_input_currents for i in range(n_sounding)
        ]

        wires = Maps.Wires(('sigma', n_sounding), ('h', n_sounding))
        expmap = Maps.ExpMap(nP=n_sounding)
        sigmaMap = expmap * wires.sigma

        survey = GlobalEM1DSurveyTD(
            rx_locations=rx_locations,
            src_locations=src_locations,
            topo=topo,
            time=time_global,
            src_type=src_type_global,
            rx_type=rx_type_global,
            field_type=field_type_global,
            wave_type=wave_type_global,
            a=a_global,
            input_currents=input_currents_global,
            time_input_currents=time_input_currents_global,
            half_switch=True)

        problem = GlobalEM1DProblemTD([],
                                      sigmaMap=sigmaMap,
                                      hMap=wires.h,
                                      hz=hz,
                                      parallel=parallel,
                                      n_cpu=2)
        problem.pair(survey)

        survey.makeSyntheticData(mSynth)

        # Now set up the problem to do some minimization
        mesh = Mesh.TensorMesh([int(n_sounding * 2)])
        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=0.)
        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
コード例 #7
0
from SimPEG import *
from simpegEM1D import (EM1D, EM1DSurveyTD, Utils1D,
                        get_vertical_discretization_time, set_mesh_1d,
                        EM1DAnalytics)
import numpy as np
from simpegEM1D import skytem_HM_2015
wave = skytem_HM_2015()
time = np.logspace(-6, -2, 21)
hz = get_vertical_discretization_time(time, facter_tmax=0.5, factor_tmin=10.)
mesh1D = set_mesh_1d(hz)
depth = -mesh1D.gridN[:-1]
LocSigZ = -mesh1D.gridCC

# time_input_currents = np.r_[0., 5.5*1e-4, 5.5*1e-4+1e-5]
# input_currents = np.r_[0., 1., 0.]
time_input_currents = wave.current_times[-7:]
input_currents = wave.currents[-7:]

TDsurvey = EM1DSurveyTD(rx_location=np.array([0., 0., 100. + 30.]),
                        src_location=np.array([0., 0., 100. + 30.]),
                        topo=np.r_[0., 0., 100.],
                        depth=depth,
                        rx_type='dBzdt',
                        wave_type='general',
                        src_type='CircularLoop',
                        a=13.,
                        time=time,
                        time_input_currents=time_input_currents,
                        input_currents=input_currents,
                        n_pulse=2,
                        base_frequency=25.)