mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-13 17:45:30 +08:00
291cce9d52
Start test function.
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
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
|
|
from simpegPF import BaseMag
|
|
|
|
## New scripts to be added to basecode
|
|
from fwr_MAG_obs import fwr_MAG_obs
|
|
from read_MAGfwr_inp import read_MAGfwr_inp
|
|
|
|
#%%
|
|
# Read input file
|
|
[mshfile, obsfile, modfile, magfile, topofile] = 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] = BaseMag.readUBCmagObs(obsfile)
|
|
|
|
rxLoc = dobs[:,0:3]
|
|
ndata = rxLoc.shape[0]
|
|
|
|
# Compute forward model using integral equation
|
|
d = fwr_MAG_obs(mesh,B,M,rxLoc,model)
|
|
|
|
# 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'
|
|
|
|
|