Implement distance weighting for potential fields in BaseMag

This commit is contained in:
D Fournier
2015-12-27 11:29:01 -08:00
parent cbe3b3de42
commit 1a7656c34d
5 changed files with 8297 additions and 69 deletions
+38 -9
View File
@@ -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)
+11
View File
@@ -0,0 +1,11 @@
Mesh.msh ! Mesh file
FWR_data.dat ! Obsfile
null ! Topofile
Model.dat ! Starting model
VALUE 0.0 ! Reference model
DEFAULT !..\AzmDip.dat ! Magnetization vector model
DEFAULT ! Cell based weight file
1 ! target chi factor | DEFAULT=1
1 1 1 1 ! alpha s, x ,y ,z
VALUE 0 1 ! Lower and Upper Bounds for p-component
VALUE 0 2 2 2 1 ! lp-norm for amplitude inversion FILE pqxqyqzr.dat ! Norms VALUE p, qx, qy, qz, r | FILE m-by-5 matrix
+8000 -27
View File
File diff suppressed because it is too large Load Diff