def __init__(self, data, nlay=2, verbose=False): """Parameters: FDEM data class and number of layers.""" super(FDEM2dFOP, self).__init__(verbose) self.nlay = nlay self.header = {} self.pos, self.z, self.topo = None, None, None self.FOP = data.FOP(nlay) self.nx = len(data.x) self.nf = len(data.freq()) npar = 2 * nlay - 1 self.mesh1d = pg.createMesh1D(self.nx, npar) self.mesh_ = pg.createMesh1D(self.nx, 2 * nlay - 1) self.setMesh(self.mesh_) # self.J = NDMatrix(self.nx, self.nf*2, npar) self.J = pg.RBlockMatrix() self.FOP1d = [] for i in range(self.nx): self.FOP1d.append( pg.FDEM1dModelling(nlay, data.freq(), data.coilSpacing, -data.height)) n = self.J.addMatrix(self.FOP1d[-1].jacobian()) self.J.addMatrixEntry(n, self.nf * 2 * i, npar * i) self.J.recalcMatrixSize() print(self.J.rows(), self.J.cols())
def __init__(self, nlay, ab2, mn2, freq, coilspacing, verbose=False): """Init number of layers, AB/2, MN/2, frequencies & coil spacing.""" pg.ModellingBase.__init__(self, verbose) self.nlay_ = nlay self.fDC_ = pg.DC1dModelling(nlay, ab2, mn2, verbose) self.fEM_ = pg.FDEM1dModelling(nlay, freq, coilspacing, verbose) self.mesh_ = pg.createMesh1DBlock(nlay) self.setMesh(self.mesh_)
def __init__(self, frequencies, coilspacing, nlay=2, verbose=False): """Set up class by frequencies and geometries.""" pg.ModellingBase.__init__(self, verbose) self.nlay_ = nlay # real layers (actually one more!) self.FOP_ = pg.FDEM1dModelling(nlay + 1, frequencies, coilspacing, 0.0) self.mesh_ = pg.createMesh1D(nlay, 2) # thicknesses and resistivities self.mesh_.cell(0).setMarker(2) self.setMesh(self.mesh_)
def FOP(self, nlay=2): # createFOP deciding upon block or smooth """Forward modelling operator using a block discretization. Parameters ---------- nlay : int Number of blocks """ return pg.FDEM1dModelling(nlay, self.freq(), self.coilSpacing, -self.height)
thk = pg.RVector(nlay - 1, 15.0) # 15m thickness each res = pg.RVector(nlay, 200.0) # 200 Ohmm res[1] = 10. res[2] = 50. model = pg.cat(thk, res) # paste together to one model ############################################################################### # We first set up EM forward operator and generate synthetic data with noise coilspacing = 50. nf = 10 freq = pg.RVector(nf, 110.) for i in range(nf - 1): freq[i + 1] = freq[i] * 2. fEM = pg.FDEM1dModelling(nlay, freq, coilspacing) dataEM = fEM(model) for i in range(len(dataEM)): dataEM[i] += np.random.randn(1)[0] * noiseEM ############################################################################### # We define model transformations: logarithms and log with upper+lower bounds transRhoa = pg.RTransLog() transThk = pg.RTransLog() transRes = pg.RTransLogLU(1., 1000.) transEM = pg.RTrans() fEM.region(0).setTransModel(transThk) fEM.region(1).setTransModel(transRes) ###############################################################################