mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-14 12:50:10 +08:00
Implement distance weighting for potential fields in BaseMag
This commit is contained in:
@@ -2,13 +2,15 @@ import os
|
||||
|
||||
home_dir = 'C:\Users\dominiquef.MIRAGEOSCIENCE\Documents\GIT\SimPEG\simpegpf\simpegPF\Dev'
|
||||
|
||||
inpfile = 'MAG3Cinv.inp'
|
||||
inpfile = 'MAG3D_inv.inp'
|
||||
|
||||
dsep = '\\'
|
||||
os.chdir(home_dir)
|
||||
|
||||
#%%
|
||||
from SimPEG import np, Utils
|
||||
from SimPEG import np, Utils, mkvc
|
||||
import simpegPF as PF
|
||||
import pylab as plt
|
||||
|
||||
## New scripts to be added to basecode
|
||||
#from fwr_MAG_data import fwr_MAG_data
|
||||
@@ -16,13 +18,10 @@ import simpegPF as PF
|
||||
|
||||
#%%
|
||||
# Read input file
|
||||
[mshfile, obsfile, modfile, magfile, topofile] = PF.BaseMag.read_MAGfwr_inp(inpfile)
|
||||
[mshfile, obsfile, topofile, mstart, mref, magfile, wgtfile, chi, alphas, bounds, lpnorms] = PF.BaseMag.read_MAGinv_inp(home_dir + dsep + inpfile)
|
||||
|
||||
# Load mesh file
|
||||
mesh = Utils.meshutils.readUBCTensorMesh(mshfile)
|
||||
|
||||
# Load model file
|
||||
model = Utils.meshutils.readUBCTensorModel(modfile,mesh)
|
||||
|
||||
# Load in observation file
|
||||
[B,M,dobs] = PF.BaseMag.readUBCmagObs(obsfile)
|
||||
@@ -30,8 +29,38 @@ model = Utils.meshutils.readUBCTensorModel(modfile,mesh)
|
||||
rxLoc = dobs[:,0:3]
|
||||
ndata = rxLoc.shape[0]
|
||||
|
||||
|
||||
# Load in topofile or create flat surface
|
||||
#==============================================================================
|
||||
# if topofile == 'null':
|
||||
#
|
||||
# Nx,Ny = np.meshgrid(mesh.vectorNx,mesh.vectorNy)
|
||||
# Nz = np.ones(Nx.shape) * mesh.vectorNz[-1]
|
||||
#
|
||||
# topo = np.c_[mkvc(Nx),mkvc(Ny),mkvc(Nz)]
|
||||
#==============================================================================
|
||||
# Work with flat topogrphy for now
|
||||
nullcell = np.ones(mesh.nC)
|
||||
|
||||
# Load model file
|
||||
if isinstance(mstart, float):
|
||||
mstart = np.ones(mesh.nC) * mstart
|
||||
else:
|
||||
mstart = Utils.meshutils.readUBCTensorModel(mstart,mesh)
|
||||
|
||||
|
||||
# Get magnetization vector for MOF
|
||||
if magfile=='DEFAULT':
|
||||
|
||||
M_xyz = PF.Magnetics.dipazm_2_xyz(np.ones(mesh.nC) * M[0], np.ones(mesh.nC) * M[1])
|
||||
|
||||
else:
|
||||
M_xyz = np.genfromtxt(magfile,delimiter=' \n',dtype=np.str,comments='!')
|
||||
|
||||
|
||||
# Create forward operator
|
||||
F = PF.Magnetics.Intrgl_Fwr_Op(mesh,B,M,rxLoc,'tmi')
|
||||
|
||||
|
||||
F = PF.Magnetics.Intrgl_Fwr_Op(mesh,B,M_xyz,rxLoc,'tmi')
|
||||
|
||||
# Get distance weighting function
|
||||
wr = PF.Magnetics.get_dist_wgt(mesh,rxLoc,3.,np.min(mesh.hx)/4)
|
||||
Utils.writeUBCTensorModel(home_dir+dsep+'wr.dat',mesh,wr)
|
||||
Reference in New Issue
Block a user