Пример #1
0
def setupSimpegNSEM_ePrimSec(inputSetup,
                             comp='Imp',
                             singleFreq=False,
                             expMap=True):

    M, freqs, sig, sigBG, rx_loc = inputSetup
    # Make a receiver list
    rxList = []
    if comp == 'All':
        rx_type_list = ['xx', 'xy', 'yx', 'yy', 'zx', 'zy']
    elif comp == 'Imp':
        rx_type_list = ['xx', 'xy', 'yx', 'yy']
    elif comp == 'Tip':
        rx_type_list = ['zx', 'zy']
    else:
        rx_type_list = [comp]

    for rx_type in rx_type_list:
        if rx_type in ['xx', 'xy', 'yx', 'yy']:
            rxList.append(Point_impedance3D(rx_loc, rx_type, 'real'))
            rxList.append(Point_impedance3D(rx_loc, rx_type, 'imag'))
        if rx_type in ['zx', 'zy']:
            rxList.append(Point_tipper3D(rx_loc, rx_type, 'real'))
            rxList.append(Point_tipper3D(rx_loc, rx_type, 'imag'))

    # Source list
    srcList = []

    if singleFreq:
        srcList.append(Planewave_xy_1Dprimary(rxList, singleFreq))
    else:
        for freq in freqs:
            srcList.append(Planewave_xy_1Dprimary(rxList, freq))
    # Survey NSEM
    survey = Survey(srcList)

    # Setup the problem object
    sigma1d = M.r(sigBG, 'CC', 'CC', 'M')[0, 0, :]

    if expMap:
        problem = Problem3D_ePrimSec(M, sigmaPrimary=np.log(sigma1d))
        problem.sigmaMap = simpeg.Maps.ExpMap(problem.mesh)
        problem.model = np.log(sig)
    else:
        problem = Problem3D_ePrimSec(M, sigmaPrimary=sigma1d)
        problem.sigmaMap = simpeg.Maps.IdentityMap(problem.mesh)
        problem.model = sig
    problem.pair(survey)
    problem.verbose = False
    try:
        from pymatsolver import Pardiso
        problem.Solver = Pardiso
    except:
        pass

    return (survey, problem)
Пример #2
0
def convert3Dto1Dobject(NSEMdata, rxType3D='yx'):

    # Find the unique locations
    # Need to find the locations
    recDataTemp = NSEMdata.toRecArray().data.flatten()
    # Check if survey.std has been assigned.
    ## NEED TO: write this...
    # Calculte and add the DET of the tensor to the recArray
    if 'det' in rxType3D:
        Zon = (recDataTemp['zxxr'] + 1j * recDataTemp['zxxi']) * (
            recDataTemp['zyyr'] + 1j * recDataTemp['zyyi'])
        Zoff = (recDataTemp['zxyr'] + 1j * recDataTemp['zxyi']) * (
            recDataTemp['zyxr'] + 1j * recDataTemp['zyxi'])
        det = np.sqrt(Zon - Zoff)
        recData = recFunc.append_fields(recDataTemp, ['zdetr', 'zdeti'],
                                        [det.real, det.imag])
    else:
        recData = recDataTemp

    uniLocs = rec_to_ndarr(np.unique(recData[['x', 'y', 'z']]))
    mtData1DList = []
    if 'xy' in rxType3D:
        corr = -1  # Shift the data to comply with the quadtrature of the 1d problem
    else:
        corr = 1
    for loc in uniLocs:
        # Make the receiver list
        rx1DList = []
        rx1DList.append(Point_impedance1D(simpeg.mkvc(loc, 2).T, 'real'))
        rx1DList.append(Point_impedance1D(simpeg.mkvc(loc, 2).T, 'imag'))
        # Source list
        locrecData = recData[np.sqrt(
            np.sum((rec_to_ndarr(recData[['x', 'y', 'z']]) -
                    loc)**2, axis=1)) < 1e-5]
        dat1DList = []
        src1DList = []
        for freq in locrecData['freq']:
            src1DList.append(Planewave_xy_1Dprimary(rx1DList, freq))
            for comp in ['r', 'i']:
                dat1DList.append(
                    corr *
                    locrecData[rxType3D + comp][locrecData['freq'] == freq])

        # Make the survey
        sur1D = Survey(src1DList)

        # Make the data
        dataVec = np.hstack(dat1DList)
        dat1D = Data(sur1D, dataVec)
        sur1D.dobs = dataVec
        # Need to take NSEMdata.survey.std and split it as well.
        std = 0.05
        sur1D.std = np.abs(sur1D.dobs *
                           std)  #+ 0.01*np.linalg.norm(sur1D.dobs)
        mtData1DList.append(dat1D)

    # Return the the list of data.
    return mtData1DList
Пример #3
0
def setup1DSurvey(sigmaHalf, tD=False, structure=False):

    # Frequency
    nFreq = 33
    freqs = np.logspace(3, -3, nFreq)
    # Make the mesh
    ct = 5
    air = meshTensor([(ct, 25, 1.3)])
    # coreT0 = meshTensor([(ct,15,1.2)])
    # coreT1 = np.kron(meshTensor([(coreT0[-1],15,1.3)]),np.ones((7,)))
    core = np.concatenate((np.kron(meshTensor([(ct, 15, -1.2)]), np.ones(
        (10, ))), meshTensor([(ct, 20)])))
    bot = meshTensor([(core[0], 20, -1.3)])
    x0 = -np.array([np.sum(np.concatenate((core, bot)))])
    m1d = simpeg.Mesh.TensorMesh([np.concatenate((bot, core, air))], x0=x0)
    # Make the model
    sigma = np.zeros(m1d.nC) + sigmaHalf
    sigma[m1d.gridCC > 0] = 1e-8
    sigmaBack = sigma.copy()
    # Add structure
    if structure:
        shallow = (m1d.gridCC < -200) * (m1d.gridCC > -600)
        deep = (m1d.gridCC < -3000) * (m1d.gridCC > -5000)
        sigma[shallow] = 1
        sigma[deep] = 0.1

    rxList = []
    for rxType in ['z1d', 'z1d']:
        rxList.append(
            Point_impedance1D(simpeg.mkvc(np.array([0.0]), 2).T, 'real'))
        rxList.append(
            Point_impedance1D(simpeg.mkvc(np.array([0.0]), 2).T, 'imag'))
    # Source list
    srcList = []
    if tD:
        for freq in freqs:
            srcList.append(Planewave_xy_1DhomotD(rxList, freq))
    else:
        for freq in freqs:
            srcList.append(Planewave_xy_1Dprimary(rxList, freq))

    survey = Survey(srcList)
    return (survey, sigma, sigmaBack, m1d)