예제 #1
0
def plotImpAppRes(dataArrays, plotLoc, textStr=[]):
    '''
    Plots amplitude impedance and phase
    '''
    # Make the figure and axes
    fig, axT = plt.subplots(2, 2, sharex=True)
    axes = axT.ravel()
    fig.set_size_inches((13.5, 7.0))
    fig.suptitle('{:s}\nStation at: {:.1f}x ; {:.1f}y'.format(
        textStr, plotLoc[0], plotLoc[1]))
    # Have to deal with axes
    # Set log
    for ax in axes.ravel():
        ax.set_xscale('log')

    axes[0].invert_xaxis()
    axes[0].set_yscale('log')
    axes[2].set_yscale('log')
    # Set labels
    axes[2].set_xlabel('Frequency [Hz]')
    axes[3].set_xlabel('Frequency [Hz]')
    axes[0].set_ylabel('Apperent resistivity [Ohm m]')
    axes[1].set_ylabel('Apperent phase [degrees]')
    axes[1].set_ylim(-180, 180)
    axes[2].set_ylabel('Impedance amplitude [V/A]')
    axes[3].set_ylim(-180, 180)
    axes[3].set_ylabel('Impedance angle [degrees]')

    # Plot the data
    for nr, dataArray in enumerate(dataArrays):
        if nr == 1:
            parSym = '*'
        else:
            parSym = 's'
        # app res
        pDt.plotIsoStaImpedance(axes[0],
                                plotLoc,
                                dataArray,
                                'zxy',
                                par='res',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[0],
                                plotLoc,
                                dataArray,
                                'zyx',
                                par='res',
                                pSym=parSym)
        # app phs
        pDt.plotIsoStaImpedance(axes[1],
                                plotLoc,
                                dataArray,
                                'zxy',
                                par='phs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[1],
                                plotLoc,
                                dataArray,
                                'zyx',
                                par='phs',
                                pSym=parSym)
        # imp abs
        pDt.plotIsoStaImpedance(axes[2],
                                plotLoc,
                                dataArray,
                                'zxx',
                                par='abs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[2],
                                plotLoc,
                                dataArray,
                                'zxy',
                                par='abs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[2],
                                plotLoc,
                                dataArray,
                                'zyx',
                                par='abs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[2],
                                plotLoc,
                                dataArray,
                                'zyy',
                                par='abs',
                                pSym=parSym)
        # imp abs
        pDt.plotIsoStaImpedance(axes[3],
                                plotLoc,
                                dataArray,
                                'zxx',
                                par='phs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[3],
                                plotLoc,
                                dataArray,
                                'zxy',
                                par='phs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[3],
                                plotLoc,
                                dataArray,
                                'zyx',
                                par='phs',
                                pSym=parSym)
        pDt.plotIsoStaImpedance(axes[3],
                                plotLoc,
                                dataArray,
                                'zyy',
                                par='phs',
                                pSym=parSym)

    return (fig, axes)
예제 #2
0
파일: dataUtils.py 프로젝트: jsc1129/simpeg
def plotMT1DModelData(problem, models, symList=None):

    # Setup the figure
    fontSize = 15

    fig = plt.figure(figsize=[9,7])
    axM = fig.add_axes([0.075,.1,.25,.875])
    axM.set_xlabel('Resistivity [Ohm*m]',fontsize=fontSize)
    axM.set_xlim(1e-1,1e5)
    axM.set_ylim(-10000,5000)
    axM.set_ylabel('Depth [km]',fontsize=fontSize)
    axR = fig.add_axes([0.42,.575,.5,.4])
    axR.set_xscale('log')
    axR.set_yscale('log')
    axR.invert_xaxis()
    # axR.set_xlabel('Frequency [Hz]')
    axR.set_ylabel('Apparent resistivity [Ohm m]',fontsize=fontSize)

    axP = fig.add_axes([0.42,.1,.5,.4])
    axP.set_xscale('log')
    axP.invert_xaxis()
    axP.set_ylim(0,90)
    axP.set_xlabel('Frequency [Hz]',fontsize=fontSize)
    axP.set_ylabel('Apparent phase [deg]',fontsize=fontSize)

    # if not symList:
    #   symList = ['x']*len(models)
    # Loop through the models.
    modelList = [problem.survey.mtrue]
    modelList.extend(models)
    if False:
        modelList = [problem.sigmaMap*mod for mod in modelList]
    for nr, model in enumerate(modelList):
        # Calculate the data
        if nr==0:
            data1D = problem.dataPair(problem.survey,problem.survey.dobs).toRecArray('Complex')
        else:
            data1D = problem.dataPair(problem.survey,problem.survey.dpred(model)).toRecArray('Complex')
        # Plot the data and the model
        colRat = nr/((len(modelList)-1.999)*1.)
        if colRat > 1.:
            col = 'k'
        else:
            col = plt.cm.seismic(1-colRat)
        # The model - make the pts to plot
        meshPts = np.concatenate((problem.mesh.gridN[0:1],np.kron(problem.mesh.gridN[1::],np.ones(2))[:-1]))
        modelPts = np.kron(1./(problem.sigmaMap*model),np.ones(2,))
        axM.semilogx(modelPts,meshPts,color=col)

        ## Data
        loc = rec_to_ndarr(np.unique(data1D[['x','y']]))
        # Appres
        pDt.plotIsoStaImpedance(axR,loc,data1D,'zyx','res',pColor=col)
        # Appphs
        pDt.plotIsoStaImpedance(axP,loc,data1D,'zyx','phs',pColor=col)
        try:
            allData = np.concatenate((allData,simpeg.mkvc(data1D['zyx'],2)),1)
        except:
            allData = simpeg.mkvc(data1D['zyx'],2)
    freq = simpeg.mkvc(data1D['freq'],2)
    res, phs = appResPhs(freq,allData)

    if False:
        stdCol = 'gray'
        axRtw = axR.twinx()
        axRtw.set_ylabel('Std of log10',color=stdCol)
        [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()]
        axPtw = axP.twinx()
        axPtw.set_ylabel('Std ',color=stdCol)
        [t.set_color(stdCol) for t in axPtw.get_yticklabels()]
        axRtw.plot(freq, np.std(np.log10(res),1),'--',color=stdCol)
        axPtw.plot(freq, np.std(phs,1),'--',color=stdCol)

    # Fix labels and ticks

    # yMtick = [l/1000 for l in axM.get_yticks().tolist()]
    # axM.set_yticklabels(yMtick)
    [ l.set_rotation(90) for l in axM.get_yticklabels()]
    [ l.set_rotation(90) for l in axR.get_yticklabels()]
    # [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()]
    # [t.set_color(stdCol) for t in axPtw.get_yticklabels()]
    for ax in [axM,axR,axP]:
        ax.xaxis.set_tick_params(labelsize=fontSize)
        ax.yaxis.set_tick_params(labelsize=fontSize)
    return fig
예제 #3
0
def plotMT1DModelData(problem, models, symList=None):

    # Setup the figure
    fontSize = 15

    fig = plt.figure(figsize=[9, 7])
    axM = fig.add_axes([0.075, .1, .25, .875])
    axM.set_xlabel('Resistivity [Ohm*m]', fontsize=fontSize)
    axM.set_xlim(1e-1, 1e5)
    axM.set_ylim(-10000, 5000)
    axM.set_ylabel('Depth [km]', fontsize=fontSize)
    axR = fig.add_axes([0.42, .575, .5, .4])
    axR.set_xscale('log')
    axR.set_yscale('log')
    axR.invert_xaxis()
    # axR.set_xlabel('Frequency [Hz]')
    axR.set_ylabel('Apparent resistivity [Ohm m]', fontsize=fontSize)

    axP = fig.add_axes([0.42, .1, .5, .4])
    axP.set_xscale('log')
    axP.invert_xaxis()
    axP.set_ylim(0, 90)
    axP.set_xlabel('Frequency [Hz]', fontsize=fontSize)
    axP.set_ylabel('Apparent phase [deg]', fontsize=fontSize)

    # if not symList:
    #   symList = ['x']*len(models)
    # Loop through the models.
    modelList = [problem.survey.mtrue]
    modelList.extend(models)
    if False:
        modelList = [problem.sigmaMap * mod for mod in modelList]
    for nr, model in enumerate(modelList):
        # Calculate the data
        if nr == 0:
            data1D = problem.dataPair(
                problem.survey, problem.survey.dobs).toRecArray('Complex')
        else:
            data1D = problem.dataPair(
                problem.survey,
                problem.survey.dpred(model)).toRecArray('Complex')
        # Plot the data and the model
        colRat = nr / ((len(modelList) - 1.999) * 1.)
        if colRat > 1.:
            col = 'k'
        else:
            col = plt.cm.seismic(1 - colRat)
        # The model - make the pts to plot
        meshPts = np.concatenate((problem.mesh.gridN[0:1],
                                  np.kron(problem.mesh.gridN[1::],
                                          np.ones(2))[:-1]))
        modelPts = np.kron(1. / (problem.sigmaMap * model), np.ones(2, ))
        axM.semilogx(modelPts, meshPts, color=col)

        ## Data
        loc = rec_to_ndarr(np.unique(data1D[['x', 'y']]).copy())
        # Appres
        pDt.plotIsoStaImpedance(axR, loc, data1D, 'zyx', 'res', pColor=col)
        # Appphs
        pDt.plotIsoStaImpedance(axP, loc, data1D, 'zyx', 'phs', pColor=col)
        try:
            allData = np.concatenate((allData, simpeg.mkvc(data1D['zyx'], 2)),
                                     1)
        except:
            allData = simpeg.mkvc(data1D['zyx'], 2)
    freq = simpeg.mkvc(data1D['freq'], 2)
    res, phs = appResPhs(freq, allData)

    if False:
        stdCol = 'gray'
        axRtw = axR.twinx()
        axRtw.set_ylabel('Std of log10', color=stdCol)
        [(t.set_color(stdCol), t.set_rotation(-45))
         for t in axRtw.get_yticklabels()]
        axPtw = axP.twinx()
        axPtw.set_ylabel('Std ', color=stdCol)
        [t.set_color(stdCol) for t in axPtw.get_yticklabels()]
        axRtw.plot(freq, np.std(np.log10(res), 1), '--', color=stdCol)
        axPtw.plot(freq, np.std(phs, 1), '--', color=stdCol)

    # Fix labels and ticks

    # yMtick = [l/1000 for l in axM.get_yticks().tolist()]
    # axM.set_yticklabels(yMtick)
    [l.set_rotation(90) for l in axM.get_yticklabels()]
    [l.set_rotation(90) for l in axR.get_yticklabels()]
    # [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()]
    # [t.set_color(stdCol) for t in axPtw.get_yticklabels()]
    for ax in [axM, axR, axP]:
        ax.xaxis.set_tick_params(labelsize=fontSize)
        ax.yaxis.set_tick_params(labelsize=fontSize)
    return fig
예제 #4
0
파일: dataUtils.py 프로젝트: jsc1129/simpeg
def plotImpAppRes(dataArrays, plotLoc, textStr=[]):
    ''' Plots amplitude impedance and phase'''
    # Make the figure and axes
    fig,axT=plt.subplots(2,2,sharex=True)
    axes = axT.ravel()
    fig.set_size_inches((13.5,7.0))
    fig.suptitle('{:s}\nStation at: {:.1f}x ; {:.1f}y'.format(textStr,plotLoc[0],plotLoc[1]))
    # Have to deal with axes
    # Set log
    for ax in axes.ravel():
        ax.set_xscale('log')

    axes[0].invert_xaxis()
    axes[0].set_yscale('log')
    axes[2].set_yscale('log')
    # Set labels
    axes[2].set_xlabel('Frequency [Hz]')
    axes[3].set_xlabel('Frequency [Hz]')
    axes[0].set_ylabel('Apperent resistivity [Ohm m]')
    axes[1].set_ylabel('Apperent phase [degrees]')
    axes[1].set_ylim(-180,180)
    axes[2].set_ylabel('Impedance amplitude [V/A]')
    axes[3].set_ylim(-180,180)
    axes[3].set_ylabel('Impedance angle [degrees]')


    # Plot the data
    for nr,dataArray in enumerate(dataArrays):
        if nr==1:
            parSym = '*'
        else:
            parSym = 's'
        # app res
        pDt.plotIsoStaImpedance(axes[0],plotLoc,dataArray,'zxy',par='res',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[0],plotLoc,dataArray,'zyx',par='res',pSym=parSym)
        # app phs
        pDt.plotIsoStaImpedance(axes[1],plotLoc,dataArray,'zxy',par='phs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[1],plotLoc,dataArray,'zyx',par='phs',pSym=parSym)
        # imp abs
        pDt.plotIsoStaImpedance(axes[2],plotLoc,dataArray,'zxx',par='abs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[2],plotLoc,dataArray,'zxy',par='abs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[2],plotLoc,dataArray,'zyx',par='abs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[2],plotLoc,dataArray,'zyy',par='abs',pSym=parSym)
            # imp abs
        pDt.plotIsoStaImpedance(axes[3],plotLoc,dataArray,'zxx',par='phs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[3],plotLoc,dataArray,'zxy',par='phs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[3],plotLoc,dataArray,'zyx',par='phs',pSym=parSym)
        pDt.plotIsoStaImpedance(axes[3],plotLoc,dataArray,'zyy',par='phs',pSym=parSym)

    return fig,axes