Exemple #1
0
    def showResultAndFit(self,
                         figsize=(12, 10),
                         save='',
                         plotmisfit=False,
                         maxdep=0,
                         clim=None):
        """Show ec(z), T2*(z), data and model response."""
        fig, ax = plt.subplots(2, 2 + plotmisfit, figsize=figsize)
        self.figs['result+fit'] = fig
        thk, wc, t2 = self.splitModel()
        showWC(ax[0, 0], thk, wc, maxdep=maxdep)
        showT2(ax[0, 1], thk, t2, maxdep=maxdep)
        ax[0, 0].set_title(r'MRS water content $\theta$')
        ax[0, 1].set_title(r'MRS decay time $T_2^*$')
        ax[0, 0].set_ylabel('$z$ [m]')
        ax[0, 1].set_ylabel('$z$ [m]')
        if self.modelL is not None and self.modelU is not None:
            thkL, wcL, t2L = self.splitModel(self.modelL)
            thkU, wcU, t2U = self.splitModel(self.modelU)
            showErrorBars(ax[0, 0], thk, wc, thkL, thkU, wcL, wcU)
            showErrorBars(ax[0, 1], thk, t2 * 1e3, thkL, thkU, t2L * 1e3,
                          t2U * 1e3)

        if maxdep > 0.:
            ax[0, 0].set_ylim([maxdep, 0.])
            ax[0, 1].set_ylim([maxdep, 0.])
        clim = self.showCube(ax[1, 0], self.data * 1e9, islog=False, clim=clim)
        ax[1, 0].set_title('measured data [nV]')  # log10
        self.showCube(ax[1, 1],
                      self.INV.response() * 1e9,
                      clim=clim,
                      islog=False)
        ax[1, 1].set_title('simulated data [nV]')  # log10
        if plotmisfit:
            self.showCube(ax[0, 2], (self.data - self.INV.response()) * 1e9,
                          islog=False)
            ax[0, 2].set_title('misfit [nV]')  # log10
            ewmisfit = (self.data - self.INV.response()) / self.error
            self.showCube(ax[1, 2], ewmisfit, islog=False)
            ax[1, 2].set_title('error-weighted misfit')

        if save:
            if not isinstance(save, str):
                save = self.basename

            fig.savefig(save, bbox_inches='tight')
        return fig, ax
Exemple #2
0
    def showResult(self, figsize=(10, 8), save='', fig=None, ax=None):
        """Show theta(z) and T2*(z) (+uncertainties if there)."""
        if ax is None:
            fig, ax = plt.subplots(1, 2, sharey=True, figsize=figsize)
            self.figs['result'] = fig

        thk, wc, t2 = self.splitModel()
        showWC(ax[0], thk, wc)
        showT2(ax[1], thk, t2)
        if self.modelL is not None and self.modelU is not None:
            thkL, wcL, t2L = self.splitModel(self.modelL)
            thkU, wcU, t2U = self.splitModel(self.modelU)
            showErrorBars(ax[0], thk, wc, thkL, thkU, wcL, wcU)
            showErrorBars(ax[1], thk, t2*1e3, thkL, thkU, t2L*1e3, t2U*1e3)

        if fig is not None:
            if save:
                fig.savefig(save, bbox_inches='tight')
            return fig, ax