print(tdp.summary) plt.figure() tdp.plot() ################################################################################ # Using a time domain datapoint # +++++++++++++++++++++++++++++ ################################################################################ # We can define a 1D layered earth model, and use it to predict some data par = StatArray( np.r_[1 / 50.0, 1 / 100.0, 1 / 1000.0, 1 / 5.0, 1 / 1000.0, 1 / 800.0], "Conductivity", "$\frac{S}{m}$") mod = Model(mesh=RectilinearMesh1D(edges=np.r_[0, 20.0, 50.0, 100.0, 150.0, 250.0, np.inf]), values=par) ################################################################################ # Forward model the data tdp.forward(mod) ################################################################################ plt.figure() plt.subplot(121) _ = mod.pcolor(transpose=True) plt.subplot(122) _ = tdp.plot() _ = tdp.plotPredicted() plt.tight_layout() plt.suptitle('Model and response')
# # Initialize and read an EM data set # D = TdemData.read_csv(dataFile, systemFile) ################################################################################ # Get a datapoint from the dataset plt.figure() tdp.plot() ################################################################################ # Using a time domain datapoint # +++++++++++++++++++++++++++++ ################################################################################ # We can define a 1D layered earth model, and use it to predict some data par = StatArray(np.r_[500.0, 20.0], "Conductivity", "$\frac{S}{m}$") mod = Model(RectilinearMesh1D(edges=np.r_[0.0, 75.0, np.inf]), values=par) ################################################################################ # Forward model the data tdp.forward(mod) ################################################################################ plt.figure() plt.subplot(121) _ = mod.pcolor() plt.subplot(122) _ = tdp.plot() _ = tdp.plotPredicted() plt.tight_layout() ################################################################################
from geobipy import StatArray from geobipy import RectilinearMesh1D, RectilinearMesh2D, RectilinearMesh2D_stitched import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import h5py #%% # The basics # ++++++++++ # Instantiate a new 1D rectilinear mesh by specifying cell centres, edges, or widths. x = StatArray(np.cumsum(np.arange(0.0, 10.0)), 'Depth', 'm') ################################################################################ # Cell edges rm = RectilinearMesh1D(edges=x, centres=None, widths=None) ################################################################################ # We can plot the grid of the mesh # Or Pcolor the mesh showing. An array of cell values is used as the colour. arr = StatArray(np.random.randn(*rm.shape), "Name", "Units") p = 0 plt.figure(p) plt.subplot(121) _ = rm.plotGrid(transpose=True, flip=True) plt.subplot(122) _ = rm.pcolor(arr, grid=True, transpose=True, flip=True) ############################################################################### # Mask the mesh cells by a distance rm_masked, indices, arr2 = rm.mask_cells(2.0, values=arr)
""" #%% from geobipy import StatArray from geobipy import RectilinearMesh1D import matplotlib.pyplot as plt import numpy as np #%% # The basics # ++++++++++ # Instantiate a new 1D rectilinear mesh by specifying cell centres, edges, or widths. x = StatArray(np.cumsum(np.arange(0.0, 10.0)), 'Depth', 'm') ################################################################################ # Cell widths rm = RectilinearMesh1D(widths=np.full(10, fill_value=50.0)) ################################################################################ # Cell centres rm = RectilinearMesh1D(centres=x) ################################################################################ # Cell edges rm = RectilinearMesh1D(edges=x) ################################################################################ # Cell centres print(rm.centres) ################################################################################ # Cell edges
1D Rectilinear Mesh ------------------- """ #%% from geobipy import StatArray from geobipy import RectilinearMesh1D import matplotlib.pyplot as plt import numpy as np #%% # Instantiate a new 1D rectilinear mesh by specifying cell centres or edges. # Here we use edges x = StatArray(np.cumsum(np.arange(0.0, 10.0)), 'Depth', 'm') ################################################################################ rm = RectilinearMesh1D(cellEdges=x) ################################################################################ print(rm.cellCentres) ################################################################################ print(rm.cellEdges) ################################################################################ print(rm.internalCellEdges) ################################################################################ print(rm.cellWidths) ################################################################################ # Get the cell indices
# fdp = D.datapoint(0) # plt.figure() # _ = fdp.plot() ############################################################################### # Using a datapoint # +++++++++++++++++ ################################################################################ # We can define a 1D layered earth model, and use it to predict some data nCells = 19 par = StatArray(np.linspace(0.01, 0.1, nCells), "Conductivity", "$\frac{S}{m}$") depth = StatArray(np.arange(nCells + 1) * 10.0, "Depth", 'm') depth[-1] = np.inf mod = Model(mesh=RectilinearMesh1D(edges=depth), values=par) ################################################################################ # Forward model the data fdp.forward(mod) ############################################################################### plt.figure() plt.subplot(121) _ = mod.pcolor(transpose=True) plt.subplot(122) _ = fdp.plotPredicted() plt.tight_layout() ################################################################################ # Compute the sensitivity matrix for a given model