mirror of
https://github.com/wassname/simpeg.git
synced 2026-09-12 12:51:28 +08:00
Move sub functions to PF.Magnetics
Add Mag Integral forward operator Begin Inversion script for magnetic integral
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import os
|
||||
|
||||
home_dir = 'C:\Users\dominiquef.MIRAGEOSCIENCE\Documents\GIT\SimPEG\simpegpf\simpegPF\Dev'
|
||||
|
||||
inpfile = 'MAG3Cfwr.inp'
|
||||
|
||||
os.chdir(home_dir)
|
||||
|
||||
#%%
|
||||
from SimPEG import np, Utils
|
||||
import simpegPF as PF
|
||||
|
||||
## New scripts to be added to basecode
|
||||
#from fwr_MAG_data import fwr_MAG_data
|
||||
#from read_MAGfwr_inp import read_MAGfwr_inp
|
||||
|
||||
#%%
|
||||
# Read input file
|
||||
[mshfile, obsfile, modfile, magfile, topofile] = PF.BaseMag.read_MAGfwr_inp(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)
|
||||
|
||||
rxLoc = dobs[:,0:3]
|
||||
ndata = rxLoc.shape[0]
|
||||
|
||||
# Compute forward model using integral equation
|
||||
d = PF.Magnetics.Intgrl_Fwr_Data(mesh,B,M,rxLoc,model,'tmi')
|
||||
|
||||
# Form data object with coordinates and write to file
|
||||
data = np.c_[rxLoc , d , np.zeros((ndata,1))]
|
||||
|
||||
# Save forward data to file
|
||||
with file('FWR_data.dat','w') as fid:
|
||||
fid.write('%6.2f %6.2f %6.2f\n' %(B[0], B[1], B[2]) )
|
||||
fid.write('%6.2f %6.2f %6.2f\n' %(M[0], M[1], 1) )
|
||||
fid.write('%i\n' %(ndata) )
|
||||
np.savetxt(fid, data, fmt='%e',delimiter=' ',newline='\n')
|
||||
|
||||
|
||||
print "Observation file saved to " + home_dir + '\FWR_data.dat'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user