############################################################################### # The data container has no apparent resistivities (token field 'rhoa') yet. # We can let the Manager fix this later for us (as we now have the 'k' field), # or we do it manually. mgr.checkData(data) print(data) ############################################################################### # The data container does not necessarily contain data errors data errors # (token field 'err'), requiring us to enter data errors. We can let the # manager guess some defaults for us automaticly or set them manually data['err'] = ert.estimateError(data, absoluteUError=5e-5, relativeError=0.03) # or manually: # data['err'] = data_errors # somehow ert.show(data, data['err'] * 100) ############################################################################### # Now the data have all necessary fields ('rhoa', 'err' and 'k') so we can run # the inversion. The inversion mesh will be created with some optional values # for the parametric mesh generation. # mod = mgr.invert(data, lam=10, verbose=True, paraDX=0.3, paraMaxCellSize=10, paraDepth=20, quality=33.6) mgr.showResult()
pg.info('Selected data noise %(min/max)', min(data['err']) * 100, max(data['err']) * 100) ############################################################################### # Optional: you can filter all values and tokens in the data container. # Its possible that there are some negative data values due to noise and # huge geometric factors. So we need to remove them. data.remove(data['rhoa'] < 0) pg.info('Filtered rhoa (min/max)', min(data['rhoa']), max(data['rhoa'])) # You can save the data for further use data.save('simple.dat') # You can take a look at the data ert.show(data) ############################################################################### # Initialize the ERTManager, e.g. with a data container or a filename. # mgr = ert.ERTManager('simple.dat') ############################################################################### # Run the inversion with the preset data. The Inversion mesh will be created # with default settings. inv = mgr.invert(lam=20, verbose=True) # np.testing.assert_approx_equal(mgr.inv.chi2(), 1.049145, significant=3) ############################################################################### # Let the ERTManger show you the model of the last successful run and how it # fits the data. Shows data, model response, and model. #
schemes = ['wa', 'wb', 'pp', 'pd', 'dd', 'slm', 'gr', 'hw'] fig, ax = pg.plt.subplots(3, 3) kw = dict(cMin=10, cMax=1000, logScale=True, colorBar=False, cMap="viridis") for i, schemeName in enumerate(schemes): shm = ert.createData(elecs=41, schemeName=schemeName) print(schemeName, shm) k = ert.geometricFactor(shm) mg = DataSchemeManager() longname = mg.scheme(schemeName).name ert.show(shm, vals=np.abs(k), ax=ax.flat[i], colorBar=1, logScale=0, label='k ' + longname + ')-' + schemeName) createColorBarOnly(**kw, ax=ax.flat[-1], aspect=0.1) pg.plt.show() # %% # import matplotlib.pyplot as plt # from pygimli.physics import ert # schemes = ['wa', 'wb', 'pp', 'pd', 'dd', 'slm', 'hw', 'gr'] # fig, ax = plt.subplots(3,3) # for i, schemeName in enumerate(schemes): # s = ert.createData(elecs=41, schemeName=schemeName) # k = ert.geometricFactors(s)