Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
topo = np.c_[Utils.mkvc(xx), Utils.mkvc(yy), Utils.mkvc(zz)]
# Create and array of observation points
xr = np.linspace(-100., 100., 20)
yr = np.linspace(-100., 100., 20)
X, Y = np.meshgrid(xr, yr)
Z = A*np.exp(-0.5*((X/b)**2. + (Y/b)**2.)) + 5
# Create a MAGsurvey
xyzLoc = np.c_[Utils.mkvc(X.T), Utils.mkvc(Y.T), Utils.mkvc(Z.T)]
rxLoc = PF.BaseMag.RxObs(xyzLoc)
srcField = PF.BaseMag.SrcField([rxLoc], param=H0)
survey = PF.BaseMag.LinearSurvey(srcField)
# self.mesh.finalize()
self.mesh = meshutils.mesh_builder_xyz(
xyzLoc, h, padding_distance=padDist,
mesh_type='TREE',
)
self.mesh = meshutils.refine_tree_xyz(
self.mesh, topo, method='surface',
octree_levels=nCpad,
octree_levels_padding=nCpad,
finalize=True,
)
# Define an active cells from topo
actv = Utils.surface2ind_topo(self.mesh, topo)
nC = int(actv.sum())
# We can now create a susceptibility model and generate data
yr = np.linspace(-100., 100., 20)
X, Y = np.meshgrid(xr, yr)
Z = A*np.exp(-0.5*((X/b)**2. + (Y/b)**2.)) + 5
# Create a MAGsurvey
xyzLoc = np.c_[Utils.mkvc(X.T), Utils.mkvc(Y.T), Utils.mkvc(Z.T)]
Rx = PF.BaseMag.RxObs(xyzLoc)
srcField = PF.BaseMag.SrcField([Rx], param=H0)
survey = PF.BaseMag.LinearSurvey(srcField)
# Create a mesh
h = [5, 5, 5]
padDist = np.ones((3, 2)) * 100
nCpad = [4, 4, 2]
self.mesh = meshutils.mesh_builder_xyz(
xyzLoc, h, padding_distance=padDist,
mesh_type='TREE',
)
self.mesh = meshutils.refine_tree_xyz(
self.mesh, topo, method='surface',
octree_levels=nCpad,
octree_levels_padding=nCpad,
finalize=True,
)
# Define an active cells from topo
actv = Utils.surface2ind_topo(self.mesh, topo)
nC = int(actv.sum())
# Convert the inclination declination to vector in Cartesian
M_xyz = Utils.matutils.dip_azimuth2cartesian(np.ones(nC)*M[0], np.ones(nC)*M[1])