Add driver for gravity. Adapt example for new Regularization formulation

This commit is contained in:
D Fournier
2016-05-30 17:35:47 -07:00
parent f1eaac7cd0
commit 7f7ce5e25b
18 changed files with 166879 additions and 33212 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

+87 -161
View File
@@ -5,72 +5,39 @@ import pylab as plt
import os
home_dir = '.'
inpfile = 'PYGRAV3D_inv.inp'
#inpfile = 'PYGRAV3D_inv.inp'
dsep = os.path.sep
plt.close('all')
#%% User input
# Treshold values for compact norm
eps_p = 1e-3 # Small model values
eps_q = 1e-3 # Small model gradient
# Plotting parameter
vmin = -0.3
vmax = 0.3
#%%
# Read input file
[mshfile, obsfile, topofile, mstart, mref, wgtfile, chi, alphas, bounds, lpnorms] = PF.Gravity.read_GRAVinv_inp(home_dir + dsep + inpfile)
#[mshfile, obsfile, topofile, mstart, mref, wgtfile, chi, alphas, bounds, lpnorms] = PF.Gravity.read_GRAVinv_inp(home_dir + dsep + inpfile)
driver = PF.GravityDriver.GravityDriver_Inv('PYGRAV3D_inv.inp')
mesh = driver.mesh
survey = driver.survey
# Load mesh file
mesh = Mesh.TensorMesh.readUBC(mshfile)
# Load in observation file
survey = PF.Gravity.readUBCgravObs(obsfile)
# Get obs location and data
rxLoc = survey.srcField.rxList[0].locs
d = survey.dobs
wd = survey.std
ndata = survey.srcField.rxList[0].locs.shape[0]
# Load in topofile or create flat surface
if topofile == 'null':
# All active
actv = np.asarray(range(mesh.nC))
else:
topo = np.genfromtxt(topofile,skip_header=1)
# Find the active cells
actv = PF.Magnetics.getActiveTopo(mesh,topo,'N')
actv = driver.activeCells
nC = len(actv)
# Create active map to go from reduce set to full
actvMap = Maps.InjectActiveCells(mesh, actv, -100)
# Creat reduced identity map
idenMap = Maps.IdentityMap(nP = nC)
# Create reduced identity map
idenMap = Maps.IdentityMap(nP=nC)
# Load starting model file
if isinstance(mstart, float):
mstart = np.ones(nC) * mstart
else:
mstart = Mesh.TensorMesh.readModelUBC(mesh,mstart)
mstart = mstart[actv]
# Load reference file
if isinstance(mref, float):
mref = np.ones(nC) * mref
else:
mref = Mesh.TensorMesh.readModelUBC(mesh,mref)
mref = mref[actv]
# Get index of the center for plotting
# Get index of the center
midx = int(mesh.nCx/2)
midy = int(mesh.nCy/2)
@@ -85,60 +52,53 @@ prob.solverOpts['accuracyTol'] = 1e-4
survey.pair(prob)
# Write out the predicted file and generate the forward operator
pred = prob.fields(mstart)
pred = prob.fields(driver.m0)
PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred0.dat',survey,pred)
#
# Make depth weighting
#wr = np.sum(prob.G**2.,axis=0)**0.5 / mesh.vol[actv]
#wr = ( wr/np.max(wr) )
#wr_out = actvMap * wr
# Load weighting file
if wgtfile is None:
if driver.wgtfile == 'DEFAULT':
wr = PF.Magnetics.get_dist_wgt(mesh, rxLoc, actv, 3., np.min(mesh.hx)/4.)
wr = wr**2.
# Make depth weighting
#wr = np.sum(prob.G**2.,axis=0)**0.5 / mesh.vol[actv]
#wr = ( wr/np.max(wr) )
#wr_out = actvMap * wr
else:
wr = Mesh.TensorMesh.readModelUBC(mesh, home_dir + dsep + wgtfile)
wr = wr[actv]
wr = wr**2.
#%% Plot depth weighting
plt.figure()
ax = plt.subplot()
mesh.plotSlice(actvMap*wr, ax = ax, normal = 'Y', ind=midx+1 ,clim = (0, wr.max()))
plt.title('Distance weighting')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
#plt.figure()
#ax = plt.subplot()
#mesh.plotSlice(actvMap*wr, ax = ax, normal = 'Y', ind=midx+1 ,clim = (0, wr.max()))
#plt.title('Distance weighting')
#plt.xlabel('x');plt.ylabel('z')
#plt.gca().set_aspect('equal', adjustable='box')
#%% Create inversion objects
# First start with an l2 regularization
reg = Regularization.Simple(mesh, indActive = actv, mapping = idenMap)
reg.mref = mref
reg.wght = wr
reg = Regularization.Sparse(mesh, indActive=actv, mapping=idenMap)
reg.mref = driver.mref
reg.cell_weights = wr*mesh.vol[actv]
# Data misfit function
opt = Optimization.ProjectedGNCG(maxIter=100 ,lower=-2.,upper=2., maxIterLS = 20, maxIterCG= 10, tolCG = 1e-3)
dmis = DataMisfit.l2_DataMisfit(survey)
dmis.Wd = 1./wd
opt = Optimization.ProjectedGNCG(maxIter=20,lower=bounds[0],upper=bounds[1], maxIterCG= 50, tolCG = 1e-4)
invProb = InvProblem.BaseInvProblem(dmis, reg, opt)
# Add directives to the inversion
beta = Directives.BetaSchedule(coolingFactor=2, coolingRate=1)
beta_init = Directives.BetaEstimate_ByEig()
target = Directives.TargetMisfit()
update_Jacobi = Directives.Update_lin_PreCond(onlyOnStart=True)
inv = Inversion.BaseInversion(invProb, directiveList=[beta,target,beta_init,update_Jacobi])
m0 = mstart
#beta = Directives.BetaSchedule(coolingFactor=1, coolingRate=1)
#update_beta = Directives.Scale_Beta(tol = 0.05, coolingRate=5)
betaest = Directives.BetaEstimate_ByEig()
IRLS = Directives.Update_IRLS( norms=driver.lpnorms, eps_p=driver.eps[0], eps_q=driver.eps[1], f_min_change = 1e-2)
update_Jacobi = Directives.Update_lin_PreCond()
inv = Inversion.BaseInversion(invProb, directiveList=[IRLS,betaest,update_Jacobi])
# Run inversion
mrec = inv.run(m0)
mrec = inv.run(driver.m0)
m_out = actvMap*mrec
@@ -152,109 +112,73 @@ pred = prob.fields(mrec)
print "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
#%% Plot out sections of the smooth model
yslice = midx+1
m_out[m_out==-100] = np.nan
plt.figure()
ax = plt.subplot(221)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-5, clim = (vmin,vmax), pcolorOpts = {'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.title('Z: ' + str(mesh.vectorCCz[-5]) + ' m')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
ax = plt.subplot(222)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-8, clim = (vmin,vmax), pcolorOpts = {'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.title('Z: ' + str(mesh.vectorCCz[-8]) + ' m')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
ax = plt.subplot(212)
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax), pcolorOpts = {'cmap':'bwr'})
plt.title('Cross Section')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
plt.figure()
ax = plt.subplot(121)
plt.hist(mrec,100)
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model values - Smooth')
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*mrec,100)
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model gradient values - Smooth')
#%% Run one more round for sparsity
phim = invProb.phi_m_last
phid = invProb.phi_d
reg = Regularization.Sparse(mesh, indActive = actv, mapping = idenMap)
reg.recModel = mrec
reg.mref = mref
reg.wght = wr
reg.eps_p = eps_p
reg.eps_q = eps_q
reg.norms = lpnorms
dmis = DataMisfit.l2_DataMisfit(survey)
dmis.Wd = 1./wd
opt = Optimization.ProjectedGNCG(maxIter=20 , maxIterLS = 20,lower=bounds[0],upper=bounds[1], maxIterCG= 50, tolCG = 1e-4)
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta = invProb.beta)
# Add directives to the inversion
beta = Directives.BetaSchedule(coolingFactor=1, coolingRate=1)
update_beta = Directives.Scale_Beta(tol = 0.05)
target = Directives.TargetMisfit()
IRLS =Directives.Update_IRLS( phi_m_last = phim, phi_d_last = phid )
update_Jacobi = Directives.Update_lin_PreCond(onlyOnStart=False)
save_log = Directives.SaveOutputEveryIteration()
save_log.fileName = 'LogName_blabla'
inv = Inversion.BaseInversion(invProb, directiveList=[beta,IRLS,update_beta,update_Jacobi,save_log])
m0 = mrec
# Run inversion
mrec = inv.run(m0)
m_out = actvMap*mrec
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l0l2.sus',m_out)
pred = prob.fields(mrec)
#%% Plot obs data
PF.Magnetics.plot_obs_2D(rxLoc,pred,'Predicted Data', vmin = np.min(d), vmax = np.max(d))
PF.Magnetics.plot_obs_2D(rxLoc,d,'Observed Data')
print "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
#%% Plot out a section of the model
yslice = midx
m_out = actvMap*reg.l2model
m_out[m_out==-100] = np.nan
# Write result
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l2l2.sus',m_out)
plt.figure()
ax = plt.subplot(221)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-5, clim = (mrec.min(), mrec.max()), pcolorOpts = {'cmap':'bwr'})
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-5, clim = (mrec.min(), mrec.max()))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.title('Z: ' + str(mesh.vectorCCz[-5]) + ' m')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
ax = plt.subplot(222)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-8, clim = (mrec.min(), mrec.max()), pcolorOpts = {'cmap':'bwr'})
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-8, clim = (mrec.min(), mrec.max()))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.title('Z: ' + str(mesh.vectorCCz[-8]) + ' m')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
ax = plt.subplot(212)
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (mrec.min(), mrec.max()))
plt.title('Cross Section')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
plt.figure()
ax = plt.subplot(121)
plt.hist(reg.l2model,100)
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model values - Smooth')
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*reg.l2model,100)
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model gradient values - Smooth')
#%% Plot out a section of the model
yslice = midx
m_out = actvMap*mrec
m_out[m_out==-100] = np.nan
plt.figure()
ax = plt.subplot(221)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-5, clim = (mrec.min(), mrec.max()))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.title('Z: ' + str(mesh.vectorCCz[-5]) + ' m')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
ax = plt.subplot(222)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-8, clim = (mrec.min(), mrec.max()))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.title('Z: ' + str(mesh.vectorCCz[-8]) + ' m')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
ax = plt.subplot(212)
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (mrec.min(), mrec.max()), pcolorOpts = {'cmap':'bwr'})
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (mrec.min(), mrec.max()))
plt.title('Cross Section')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
@@ -263,8 +187,10 @@ plt.figure()
ax = plt.subplot(121)
plt.hist(mrec,100)
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model values - Sparse lp:'+str(lpnorms[0]))
plt.title('Histogram of model values - Compact')
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*mrec,100)
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model gradient values - Sparse lqx: ' + str(lpnorms[1]) + ' lqy:'+ str(lpnorms[2]) + ' lqz:' + str(lpnorms[3]))
plt.title('Histogram of model gradient values - Compact')
plt.show()
@@ -5,10 +5,13 @@ import pylab as plt
import os
import numpy as np
#home_dir = 'C:\Egnyte\Private\craigm\PHD\LdM\Gravity\Bouguer\SIMPEG\models'
home_dir = 'C:\Users\dominiquef.MIRAGEOSCIENCE\Documents\GIT\SimPEG\simpegpf\simpegPF\Dev\GRAV'
#inpfile = 'PYGRAV3D_inv_LdM_Craig.inp'
inpfile = 'PYGRAV3D_inv_checkerboard.inp'
#home_dir = 'C:\Egnyte\Private\craigm\PHD\LdM\Gravity\Bouguer\SIMPEG\models\\all_models\\density_-1.2_0.3'
home_dir = '.\\'
inpfile = 'PYGRAV3D_inv_LdM_Craig.inp'
#inpfile = 'PYGRAV3D_inv_checkerboard.inp'
dsep = '\\'
os.chdir(home_dir)
plt.close('all')
@@ -17,66 +20,35 @@ plt.close('all')
# Initial beta
beta_in = 1e-2
# Treshold values for compact norm
eps_p = 0.01 # Compact model values
eps_q = 0.01 # ompact model gradient
# Plotting parameter
vmin = -0.1
vmax = 0.2
vmin = -1.2
vmax = 1.2
#weight exponent for default weighting
wgtexp = 3. #dont forget the "."
#%%
# Read input file
[mshfile, obsfile, topofile, mstart, mref, wgtfile, chi, alphas, bounds, lpnorms] = PF.Gravity.read_GRAVinv_inp(home_dir + dsep + inpfile)
driver = PF.GravityDriver.GravityDriver_Inv(home_dir + dsep + 'PYGRAV3D_inv.inp')
mesh = driver.mesh
survey = driver.survey
# Load mesh file
mesh = Mesh.TensorMesh.readUBC(mshfile)
# Load in observation file
survey = PF.Gravity.readUBCgravObs(obsfile)
# Get obs location and data
rxLoc = survey.srcField.rxList[0].locs
d = survey.dobs
wd = survey.std
ndata = survey.srcField.rxList[0].locs.shape[0]
# Load in topofile or create flat surface
if topofile == 'null':
# All active
actv = np.asarray(range(mesh.nC))
else:
topo = np.genfromtxt(topofile,skip_header=1)
# Find the active cells
actv = PF.Magnetics.getActiveTopo(mesh,topo,'N')
actv = driver.activeCells
nC = len(actv)
# Create active map to go from reduce set to full
actvMap = Maps.InjectActiveCells(mesh, actv, -100)
# Creat reduced identity map
idenMap = Maps.IdentityMap(nP = nC)
# Create reduced identity map
idenMap = Maps.IdentityMap(nP=nC)
# Load starting model file
if isinstance(mstart, float):
mstart = np.ones(nC) * mstart
else:
mstart = Mesh.TensorMesh.readModelUBC(mesh,mstart)
mstart = mstart[actv]
# Load reference file
if isinstance(mref, float):
mref = np.ones(nC) * mref
else:
mref = Mesh.TensorMesh.readModelUBC(mesh,mref)
mref = mref[actv]
# Get index of the center for plotting
# Get index of the center
midx = int(mesh.nCx/2)
midy = int(mesh.nCy/2)
@@ -91,24 +63,11 @@ prob.solverOpts['accuracyTol'] = 1e-4
survey.pair(prob)
# Write out the predicted file and generate the forward operator
pred = prob.fields(mstart)
PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred0.dat',survey,pred)
# Make depth weighting
#wr = np.sum(prob.G**2.,axis=0)**0.5 / mesh.vol[actv]
#wr = ( wr/np.max(wr) )
#wr_out = actvMap * wr
#A different weighting function from Dominic
#wr = PF.Magnetics.get_dist_wgt(mesh, rxLoc, actv, 2., np.min(mesh.hx)/4.)
#wr = wr**2.
pred = prob.fields(driver.m0)
# Load weighting file
if wgtfile is None:
wr = PF.Magnetics.get_dist_wgt(mesh, rxLoc, actv, 2., np.min(mesh.hx)/4.)
if driver.wgtfile == 'DEFAULT':
wr = PF.Magnetics.get_dist_wgt(mesh, rxLoc, actv, wgtexp, np.min(mesh.hx)/4.)
wr = wr**2.
else:
wr = Mesh.TensorMesh.readModelUBC(mesh, home_dir + dsep + wgtfile)
@@ -119,205 +78,198 @@ else:
#%% Plot depth weighting
plt.figure()
ax = plt.subplot()
datwgt=mesh.plotSlice(actvMap*wr, ax = ax, normal = 'Y', ind=midx+1 ,clim = (-1e-1, wr.max()))
ax = plt.subplot(211)
datwgt=mesh.plotSlice(actvMap*wr, ax = ax, normal = 'Y', ind=midx+1 ,clim = (-1e-1, wr.max()), pcolorOpts={'cmap':'jet'})
plt.title('Distance weighting')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(datwgt[0],orientation="vertical")
cb.set_label('Weighting')
plt.savefig(home_dir + dsep + 'Weighting.png', dpi=300)
ax=plt.subplot(212)
plt.hist(wr,bins=100)
plt.yscale('log', nonposy='clip')
plt.title('Distribution of weights')
plt.tight_layout()
plt.savefig(home_dir + dsep + 'Weighting_' +str(wgtexp) +'.png', dpi=300)
#%% Create inversion objects
print '\nRun smooth inversion \n'
# First start with an l2 (smooth model) regularization
reg = Regularization.Simple(mesh, indActive = actv, mapping = idenMap)
reg.mref = mref
reg.wght = wr
reg = Regularization.Sparse(mesh, indActive=actv, mapping=idenMap)
reg.mref = driver.mref
reg.cell_weights = wr*mesh.vol[actv]
eps_p = driver.eps[0]
eps_q = driver.eps[1]
# Create pre-conditioner
diagA = np.sum(prob.G**2.,axis=0) + beta_in*(reg.W.T*reg.W).diagonal()
PC = Utils.sdiag(diagA**-1.)
# Data misfit function
opt = Optimization.ProjectedGNCG(maxIter=100 ,lower=-2.,upper=2., maxIterLS = 20, maxIterCG= 10, tolCG = 1e-3)
dmis = DataMisfit.l2_DataMisfit(survey)
dmis.Wd = 1./wd
opt = Optimization.ProjectedGNCG(maxIter=20,lower=bounds[0],upper=bounds[1], maxIterCG= 20, tolCG = 1e-3)
opt.approxHinv = PC
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta = beta_in)
beta = Directives.BetaSchedule(coolingFactor=2, coolingRate=1)
target = Directives.TargetMisfit()
inv = Inversion.BaseInversion(invProb, directiveList=[beta,target])
m0 = mstart
invProb = InvProblem.BaseInvProblem(dmis, reg, opt)
#beta = Directives.BetaSchedule(coolingFactor=1, coolingRate=1)
#update_beta = Directives.Scale_Beta(tol = 0.05, coolingRate=5)
betaest = Directives.BetaEstimate_ByEig()
IRLS = Directives.Update_IRLS( norms=driver.lpnorms, eps_p=eps_p, eps_q=eps_q, f_min_change = 1e-2)
update_Jacobi = Directives.Update_lin_PreCond()
inv = Inversion.BaseInversion(invProb, directiveList=[IRLS,betaest,update_Jacobi])
# Run inversion
mrec = inv.run(m0)
mrec = inv.run(driver.m0)
m_out = actvMap*reg.l2model
m_out = actvMap*mrec
# Write result
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l2l2.den',m_out)
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l2l2_' +str(wgtexp) + '.den', m_out)
#Utils.meshutils.writeUBCTensorModel(home_dir+dsep+'wr.dat',mesh,wr_out)
# Plot predicted
pred_compact = prob.fields(mrec)
PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred_compact' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.dat',survey,pred_compact)
pred = prob.fields(mrec)
# Plot predicted
#pred_smooth = prob.fields(mrec)
#PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred_smooth' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.dat',survey,pred_smooth)
#PF.Magnetics.plot_obs_2D(rxLoc,pred,wd,'Predicted Data')
#PF.Magnetics.plot_obs_2D(rxLoc,(d-pred),wd,'Residual Data')
print "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
print "Misfit sum(obs-calc)/nobs: %.3f mGal" %np.divide(np.sum(np.abs(d-pred)), len(d))
print "RMS misfit: %.3f mGal" %np.sqrt(np.divide(np.sum((d-pred)**2),len(d)))
#%% Plot out sections of the smooth model
yslice = midx+1
m_out[m_out==-100]=np.nan # set "air" to nan
print "\nMax density:" + str(np.nanmax(m_out))
print "\nMin density:" + str(np.nanmin(m_out))
plt.figure(figsize=(15,10))
plt.suptitle('Smooth Inversion')
plt.suptitle('Smooth Inversion: Depth weight = ' + str(wgtexp))
ax = plt.subplot(221)
dat1=mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-5, clim = (vmin,vmax))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='w',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-5]) + ' m')
dat1=mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-10, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-10]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (kg/m3)')
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(222)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-8, clim = (vmin,vmax))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='w',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-8]) + ' m')
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-13, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-13]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (kg/m3)')
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(212)
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax))
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.title('Cross Section')
plt.xlabel('Easting(m)');plt.ylabel('Elevation')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (kg/m3)')
plt.savefig(home_dir + str('\Figure1.png'), dpi=300, bb_inches='tight')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4), cmap='bwr')
cb.set_label('Density (g/cc$^3$)')
plt.savefig(home_dir + str('\Figure1_' +str(wgtexp) + '.png'), dpi=300, bb_inches='tight')
#plot histograms
plt.figure(figsize=(15,10))
ax = plt.subplot(121)
plt.hist(reg.l2model,100)
plt.yscale('log', nonposy='clip')
plt.xlim(reg.l2model.mean() - 6.*(reg.l2model.std()), reg.l2model.mean() + 6.*(reg.l2model.std()))
plt.xlabel('Density (g/cc$^3$)')
plt.title('Histogram of model values - Smooth')
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*reg.l2model,100)
plt.yscale('log', nonposy='clip')
plt.xlim(reg.l2model.mean() - 2.*(reg.l2model.std()), reg.l2model.mean() + 2.*(reg.l2model.std()))
plt.xlabel('Density (g/cc$^3$)')
plt.title('Histogram of model gradient values - Smooth')
plt.savefig(home_dir + str('\Figure2_' +str(wgtexp) + '.png'), dpi=300, bb_inches='tight')
#%% Plot obs data
PF.Magnetics.plot_obs_2D(rxLoc,pred_compact,'Predicted Data', vmin = np.min(d), vmax = np.max(d))
plt.savefig(home_dir + str('\Figure3_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.png'), dpi=300, bb_inches='tight')
PF.Magnetics.plot_obs_2D(rxLoc,d,'Observed Data')
plt.savefig(home_dir + str('\Figure4.png'), dpi=300, bb_inches='tight')
print "\nFinal misfit:" + str(np.sum( ((d-pred_compact)/wd)**2. ) )
print "Misfit sum(obs-calc)/nobs: %.3f mGal" %np.divide(np.sum(np.abs(d-pred_compact)), len(d))
print "RMS misfit: %.3f mGal" %np.sqrt(np.divide(np.sum((d-pred_compact)**2),len(d)))
#%% Plot out a section of the compact model
m_out = actvMap*mrec
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l0l2_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.den',m_out)
yslice = midx
m_out[m_out==-100]=np.nan # set "air" to nan
print "\nMax density:" + str(np.nanmax(m_out))
print "\nMin density:" + str(np.nanmin(m_out))
plt.figure(figsize=(15,10))
plt.suptitle('Compact Inversion: Depth weight = ' + str(wgtexp) + ': $\epsilon_p$ = ' + str(eps_p) + ': $\epsilon_q$ = ' + str(eps_q))
ax = plt.subplot(221)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-10, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-10]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(222)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-13, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-13]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(212)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.title('Cross Section')
plt.xlabel('Easting (m)');plt.ylabel('Elevation (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
plt.savefig(home_dir + str('\Figure5_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.png'), dpi=300, bb_inches='tight')
#plot histograms
plt.figure(figsize=(15,10))
ax = plt.subplot(121)
plt.hist(mrec,100)
#plt.xlim(mrec.mean() - 6.*(mrec.std()), mrec.mean() + 6.*(mrec.std()))
plt.yscale('log', nonposy='clip')
plt.xlim(mrec.mean() - 4.*(mrec.std()), mrec.mean() + 4.*(mrec.std()))
plt.title('Histogram of model values - Smooth')
plt.xlabel('Density (g/cc$^3$)')
plt.title('Histogram of model values - Sparse lp:'+str(driver.lpnorms[0]))
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*mrec,100)
#plt.xlim(mrec.mean() - 4.*(mrec.std()), mrec.mean() + 4.*(mrec.std()))
plt.xlabel('Density (g/cc$^3$)')
plt.yscale('log', nonposy='clip')
plt.xlim(mrec.mean() - 4.*(mrec.std()), mrec.mean() + 4.*(mrec.std()))
plt.title('Histogram of model gradient values - Smooth')
plt.savefig(home_dir + str('\Figure2.png'), dpi=300, bb_inches='tight')
#%% Run one more round for sparsity (Compact model)
print '\nRun compact inversion \n'
phim = invProb.phi_m_last
phid = invProb.phi_d
plt.title('Histogram of model gradient values - Sparse lqx: ' + str(driver.lpnorms[1]) + ' lqy:'+ str(driver.lpnorms[2]) + ' lqz:' + str(driver.lpnorms[3]))
plt.savefig(home_dir + str('\Figure6_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.png'), dpi=300, bb_inches='tight')
reg = Regularization.Sparse(mesh, indActive = actv, mapping = idenMap)
reg.recModel = mrec
reg.mref = mref
reg.wght = wr
reg.eps_p = eps_p
reg.eps_q = eps_q
reg.norms = lpnorms
diagA = np.sum(prob.G**2.,axis=0) + beta_in*(reg.W.T*reg.W).diagonal()
PC = Utils.sdiag(diagA**-1.)
#reg.alpha_s = 1.
dmis = DataMisfit.l2_DataMisfit(survey)
dmis.Wd = 1./wd
opt = Optimization.ProjectedGNCG(maxIter=10 ,lower=bounds[0],upper=bounds[1], maxIterCG= 25, tolCG = 1e-4)
opt.approxHinv = PC
#opt.phim_last = reg.eval(mrec)
# opt = Optimization.InexactGaussNewton(maxIter=6)
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta = invProb.beta)
beta = Directives.BetaSchedule(coolingFactor=1, coolingRate=1)
#betaest = Directives.BetaEstimate_ByEig()
target = Directives.TargetMisfit()
IRLS =Directives.Update_IRLS( phi_m_last = phim, phi_d_last = phid )
inv = Inversion.BaseInversion(invProb, directiveList=[beta,IRLS])
m0 = mrec
# Run inversion
mrec = inv.run(m0)
m_out = actvMap*mrec
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l0l2.den',m_out)
pred = prob.fields(mrec)
#%% Plot obs data
PF.Magnetics.plot_obs_2D(rxLoc,pred,'Predicted Data', vmin = np.min(d), vmax = np.max(d))
plt.savefig(home_dir + str('\Figure3.png'), dpi=300, bb_inches='tight')
PF.Magnetics.plot_obs_2D(rxLoc,d,'Observed Data')
plt.savefig(home_dir + str('\Figure4.png'), dpi=300, bb_inches='tight')
print "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
#%% Plot out a section of the compact model
yslice = midx
plt.figure(figsize=(15,10))
plt.suptitle('Compact Inversion')
ax = plt.subplot(221)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-5, clim = (vmin,vmax))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='w',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-5]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (kg/m3)')
ax = plt.subplot(222)
mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-8, clim = (vmin,vmax))
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='w',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='w',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-8]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (kg/m3)')
ax = plt.subplot(212)
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax))
plt.title('Cross Section')
plt.xlabel('Easting (m)');plt.ylabel('Elevation (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (kg/m3)')
plt.savefig(home_dir + str('\Figure5.png'), dpi=300, bb_inches='tight')
plt.figure(figsize=(15,10))
ax = plt.subplot(121)
plt.hist(mrec,100)
plt.xlim(mrec.mean() - 4.*(mrec.std()), mrec.mean() + 4.*(mrec.std()))
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model values - Sparse lp:'+str(lpnorms[0]))
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*mrec,100)
plt.xlim(mrec.mean() - 4.*(mrec.std()), mrec.mean() + 4.*(mrec.std()))
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model gradient values - Sparse lqx: ' + str(lpnorms[1]) + ' lqy:'+ str(lpnorms[2]) + ' lqz:' + str(lpnorms[3]))
plt.savefig(home_dir + str('\Figure6.png'), dpi=300, bb_inches='tight')
#make a plot of the obs -calc, ie residual
plt.figure(figsize=(10,8))
residual = d - pred_compact
plt.hist(residual, 100)
plt.savefig(home_dir + str('\Figure7_residuals.png'), dpi=300, bb_inches='tight')
@@ -0,0 +1,395 @@
#%%
from SimPEG import *
import simpegPF as PF
import pylab as plt
import os
import numpy as np
home_dir = 'C:\Egnyte\Private\craigm\PHD\LdM\Gravity\Bouguer\SIMPEG\models\surface_layer_model_-500'
inpfile = 'PYGRAV3D_inv_LdM_surface_layer_fixed.inp'
dsep = '\\'
os.chdir(home_dir)
plt.close('all')
#%% User input
# Initial beta
beta_in = 1e-2
# Treshold values for compact norm
eps_p = 0.2# Compact model values #refer to histograms to choose appropriate value
eps_q = 0.1 # Compact model gradient
# Plotting parameter
vmin = -0.5
vmax = 0.5
#weight exponent for default weighting
wgtexp = 3. #dont forget the "."
#value of fixed cells
fixedcell = -0.5
#%%
# Read input file
[mshfile, obsfile, topofile, mstart, mref, wgtfile, chi, alphas, bounds, lpnorms] = PF.Gravity.read_GRAVinv_inp(home_dir + dsep + inpfile)
# Load mesh file
mesh = Mesh.TensorMesh.readUBC(mshfile)
# Load in observation file
survey = PF.Gravity.readUBCgravObs(obsfile)
# Get obs location and data
rxLoc = survey.srcField.rxList[0].locs
d = survey.dobs
wd = survey.std
ndata = survey.srcField.rxList[0].locs.shape[0]
# Load in topofile or create flat surface
if topofile == 'null':
# All active
actv = np.asarray(range(mesh.nC))
else:
topo = np.genfromtxt(topofile,skip_header=1)
# Find the active cells
actv = PF.Magnetics.getActiveTopo(mesh,topo,'N')
nC = len(actv)
# Create active map to go from reduce set to full
actvMap = Maps.InjectActiveCells(mesh, actv, -100)
# Creat reduced identity map
#idenMap = Maps.IdentityMap(nP = nC)
# Load starting model file
if isinstance(mstart, float):
mstart = np.ones(nC) * mstart
else:
mstart = Mesh.TensorMesh.readModelUBC(mesh,mstart)
mstart = mstart[actv]
# Extract cells under topography and create new index for inactive
#m0 = Mesh.TensorMesh.readModelUBC(mesh, mstart)
#m0 = m0[actv]
ind_act = mstart!= fixedcell
actvCells = Maps.InjectActiveCells(None, ind_act, fixedcell, nC=nC)
mstart = mstart[ind_act]
# Load reference file
if isinstance(mref, float):
mref = np.ones(nC) * mref
else:
mref = Mesh.TensorMesh.readModelUBC(mesh,mref)
mref = mref[actv]
mref = mref[ind_act]
# Get index of the center for plotting
midx = int(mesh.nCx/2)
midy = int(mesh.nCy/2)
#%% Plot obs data
#PF.Gravity.plot_obs_2D(survey,'Observed Data')
#%% Run inversion
prob = PF.Gravity.GravityIntegral(mesh, mapping = actvCells, actInd = actv)
prob.solverOpts['accuracyTol'] = 1e-4
survey.pair(prob)
# Write out the predicted file and generate the forward operator
pred_start = prob.fields(mstart)
#PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred_start' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.dat',survey,pred_start)
# Make depth weighting
#wr = np.sum(prob.G**2.,axis=0)**0.5 / mesh.vol[actv]
#wr = ( wr/np.max(wr) )
#wr_out = actvMap * wr
#A different weighting function from Dominic
#wr = PF.Magnetics.get_dist_wgt(mesh, rxLoc, actv, 2., np.min(mesh.hx)/4.)
#wr = wr**2.
# Load weighting file
if wgtfile is None:
wr = PF.Magnetics.get_dist_wgt(mesh, rxLoc, actv, wgtexp, np.min(mesh.hx)/4.)
wr = wr**2.
else:
wr = Mesh.TensorMesh.readModelUBC(mesh, home_dir + dsep + wgtfile)
wr = wr[actv]
wr = wr**2.
#%% Plot depth weighting
plt.figure()
ax = plt.subplot(211)
datwgt=mesh.plotSlice(actvMap*wr, ax = ax, normal = 'Y', ind=midx+1 ,clim = (-1e-1, wr.max()), pcolorOpts={'cmap':'jet'})
plt.title('Distance weighting')
plt.xlabel('x');plt.ylabel('z')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(datwgt[0],orientation="vertical")
cb.set_label('Weighting')
ax=plt.subplot(212)
plt.hist(wr,bins=100)
plt.yscale('log', nonposy='clip')
plt.title('Distribution of weights')
plt.tight_layout()
plt.savefig(home_dir + dsep + 'Weighting_' +str(wgtexp) +'.png', dpi=300)
#%% Create inversion objects
print '\nRun smooth inversion \n'
# First start with an l2 (smooth model) regularization
reg = Regularization.Simple(mesh, indActive = actv, mapping = actvCells)
reg.mref = mref
reg.wght = wr
# Create pre-conditioner # should be without the *wr at the end but works better with it
#diagA = np.sum(prob.G**2.,axis=0) + beta_in*(reg.W.T*reg.W).diagonal()
#PC = Utils.sdiag(diagA**-1.)
# Data misfit function
dmis = DataMisfit.l2_DataMisfit(survey)
dmis.Wd = 1./wd
opt = Optimization.ProjectedGNCG(maxIter=20,lower=bounds[0],upper=bounds[1], maxIterCG= 20, tolCG = 1e-3)
#opt.approxHinv = PC
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta = beta_in)
beta = Directives.BetaSchedule(coolingFactor=2, coolingRate=1)
update_beta = Directives.Scale_Beta(tol = 0.05)
target = Directives.TargetMisfit()
update_Jacobi = Directives.Update_lin_PreCond(onlyOnStart=True)
save_log = Directives.SaveOutputEveryIteration()
save_log.fileName = home_dir + dsep + 'SimPEG_inv_l2l2_log_' +str(wgtexp)
inv = Inversion.BaseInversion(invProb, directiveList=[beta,target,update_beta,update_Jacobi,save_log])
#inv = Inversion.BaseInversion(invProb, directiveList=[beta,target])
m0 = mstart
# Run inversion
mrec = inv.run(m0)
m_out = actvMap*actvCells*mrec
# Write result
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l2l2_' +str(wgtexp) + '.den', m_out)
#Utils.meshutils.writeUBCTensorModel(home_dir+dsep+'wr.dat',mesh,wr_out)
# Plot predicted
pred_smooth = prob.fields(mrec)
PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred_smooth' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.dat',survey,pred_smooth)
#PF.Magnetics.plot_obs_2D(rxLoc,pred,wd,'Predicted Data')
#PF.Magnetics.plot_obs_2D(rxLoc,(d-pred),wd,'Residual Data')
print "Final misfit:" + str(np.sum( ((d-pred_smooth)/wd)**2. ) )
print "Misfit sum(obs-calc)/nobs: %.3f mGal" %np.divide(np.sum(np.abs(d-pred_smooth)), len(d))
print "RMS misfit: %.3f mGal" %np.sqrt(np.divide(np.sum((d-pred_smooth)**2),len(d)))
#%% Plot out sections of the smooth model
yslice = midx+1
m_out[m_out==-100]=np.nan # set "air" to nan
print "\nMax density:" + str(np.nanmax(m_out))
print "\nMin density:" + str(np.nanmin(m_out))
plt.figure(figsize=(15,10))
plt.suptitle('Smooth Inversion: Depth weight = ' + str(wgtexp))
ax = plt.subplot(221)
dat1=mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-10, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-10]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(222)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-25, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-25]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(212)
mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.title('Cross Section')
plt.xlabel('Easting(m)');plt.ylabel('Elevation')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat1[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4), cmap='bwr')
cb.set_label('Density (g/cc$^3$)')
plt.savefig(home_dir + str('\Figure1_' +str(wgtexp) + '.png'), dpi=300, bb_inches='tight')
#plot histograms
plt.figure(figsize=(15,10))
ax = plt.subplot(121)
plt.hist(mrec,100)
plt.yscale('log', nonposy='clip')
plt.xlim(mrec.mean() - 6.*(mrec.std()), mrec.mean() + 6.*(mrec.std()))
plt.xlabel('Density (g/cc$^3$)')
plt.title('Histogram of model values - Smooth')
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*(actvCells*mrec),100)
plt.yscale('log', nonposy='clip')
plt.xlim(mrec.mean() - 2.*(mrec.std()), mrec.mean() + 2.*(mrec.std()))
plt.xlabel('Density (g/cc$^3$)')
plt.title('Histogram of model gradient values - Smooth')
plt.savefig(home_dir + str('\Figure2_' +str(wgtexp) + '.png'), dpi=300, bb_inches='tight')
#%% Run one more round for sparsity (Compact model)
print '\nRun compact inversion \n'
phim = invProb.phi_m_last
phid = invProb.phi_d
reg = Regularization.Sparse(mesh, indActive = actv, mapping = actvCells)
reg.recModel = mrec
reg.mref = mref
reg.wght = wr
reg.eps_p = eps_p
reg.eps_q = eps_q
reg.norms = lpnorms
#diagA = np.sum(prob.G**2.,axis=0) + beta_in*(reg.W.T*reg.W).diagonal()
#PC = Utils.sdiag(diagA**-1.)
update_Jacobi = Directives.Update_lin_PreCond()
#reg.alpha_s = 1.
dmis = DataMisfit.l2_DataMisfit(survey)
dmis.Wd = 1./wd
opt = Optimization.ProjectedGNCG(maxIterLS=20, maxIter=20 ,lower=bounds[0],upper=bounds[1], maxIterCG= 50, tolCG = 1e-4)
#opt.approxHinv = PC
#opt.phim_last = reg.eval(mrec)
# opt = Optimization.InexactGaussNewton(maxIter=6)
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta = invProb.beta)
beta = Directives.BetaSchedule(coolingFactor=1, coolingRate=1)
#update beta only if misfit is outside the tolerance
update_beta = Directives.Scale_Beta(tol = 0.05) #Tolerance value is in % of the target
#betaest = Directives.BetaEstimate_ByEig()
target = Directives.TargetMisfit()
IRLS =Directives.Update_IRLS( phi_m_last = phim, phi_d_last = phid )
#save output to logfile
save_log = Directives.SaveOutputEveryIteration()
save_log.fileName = home_dir + dsep + 'SimPEG_inv_l0l2_log_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q)
inv = Inversion.BaseInversion(invProb, directiveList=[beta,IRLS,update_beta,update_Jacobi,save_log])
m0 = mrec
# Run inversion
mrec = inv.run(m0)
m_out = actvMap*actvCells*mrec
Mesh.TensorMesh.writeModelUBC(mesh,'SimPEG_inv_l0l2_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.den',m_out)
pred_compact = prob.fields(mrec)
PF.Gravity.writeUBCobs(home_dir + dsep + 'Pred_compact' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.dat',survey,pred_compact)
#%% Plot obs data
PF.Magnetics.plot_obs_2D(rxLoc,pred_compact,'Predicted Data', vmin = np.min(d), vmax = np.max(d))
plt.savefig(home_dir + str('\Figure3_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.png'), dpi=300, bb_inches='tight')
PF.Magnetics.plot_obs_2D(rxLoc,d,'Observed Data')
plt.savefig(home_dir + str('\Figure4.png'), dpi=300, bb_inches='tight')
print "\nFinal misfit:" + str(np.sum( ((d-pred_compact)/wd)**2. ) )
print "Misfit sum(obs-calc)/nobs: %.3f mGal" %np.divide(np.sum(np.abs(d-pred_compact)), len(d))
print "RMS misfit: %.3f mGal" %np.sqrt(np.divide(np.sum((d-pred_compact)**2),len(d)))
#%% Plot out a section of the compact model
yslice = midx
m_out[m_out==-100]=np.nan # set "air" to nan
print "\nMax density:" + str(np.nanmax(m_out))
print "\nMin density:" + str(np.nanmin(m_out))
plt.figure(figsize=(15,10))
plt.suptitle('Compact Inversion: Depth weight = ' + str(wgtexp) + ': $\epsilon_p$ = ' + str(eps_p) + ': $\epsilon_q$ = ' + str(eps_q))
ax = plt.subplot(221)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-10, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-10]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(222)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Z', ind=-25, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.plot(np.array([mesh.vectorCCx[0],mesh.vectorCCx[-1]]), np.array([mesh.vectorCCy[yslice],mesh.vectorCCy[yslice]]),c='gray',linestyle = '--')
plt.scatter(rxLoc[0:,0], rxLoc[0:,1], color='k',s=1)
plt.title('Z: ' + str(mesh.vectorCCz[-25]) + ' m')
plt.xlabel('Easting (m)');plt.ylabel('Northing (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
ax = plt.subplot(212)
dat = mesh.plotSlice(m_out, ax = ax, normal = 'Y', ind=yslice, clim = (vmin,vmax), pcolorOpts={'cmap':'bwr'})
plt.title('Cross Section')
plt.xlabel('Easting (m)');plt.ylabel('Elevation (m)')
plt.gca().set_aspect('equal', adjustable='box')
cb = plt.colorbar(dat[0],orientation="vertical", ticks=np.linspace(vmin, vmax, 4))
cb.set_label('Density (g/cc$^3$)')
plt.savefig(home_dir + str('\Figure5_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.png'), dpi=300, bb_inches='tight')
#plot histograms
plt.figure(figsize=(15,10))
ax = plt.subplot(121)
plt.hist(mrec,100)
#plt.xlim(mrec.mean() - 6.*(mrec.std()), mrec.mean() + 6.*(mrec.std()))
plt.yscale('log', nonposy='clip')
plt.xlabel('Density (g/cc$^3$)')
plt.title('Histogram of model values - Sparse lp:'+str(lpnorms[0]))
ax = plt.subplot(122)
plt.hist(reg.regmesh.cellDiffxStencil*(actvCells*mrec),100)
#plt.xlim(mrec.mean() - 4.*(mrec.std()), mrec.mean() + 4.*(mrec.std()))
plt.xlabel('Density (g/cc$^3$)')
plt.yscale('log', nonposy='clip')
plt.title('Histogram of model gradient values - Sparse lqx: ' + str(lpnorms[1]) + ' lqy:'+ str(lpnorms[2]) + ' lqz:' + str(lpnorms[3]))
plt.savefig(home_dir + str('\Figure6_' +str(wgtexp) + '_' + str(eps_p) + '_' + str(eps_q) +'.png'), dpi=300, bb_inches='tight')
+2 -1
View File
@@ -7,4 +7,5 @@ DEFAULT ! Cell based weight file
1 ! target chi factor | DEFAULT=1
1 1 1 1 ! alpha s, x ,y ,z
VALUE -1 1 ! Lower and Upper Bounds for p-component
VALUE 0 1 1 1 1 ! lp-norm for amplitude inversion FILE pqxqyqzr.dat ! Norms VALUE p, qx, qy, qz, r | FILE m-by-5 matrix
VALUE 0 1 1 1 2 ! lp-norm for amplitude inversion FILE pqxqyqzr.dat ! Norms VALUE p, qx, qy, qz, r | FILE m-by-5 matrix
VALUE 1e-2 1e-3 ! Threshold value for the norm on model and model gradient VALUE eps_p, eps_q | DEFAULT
@@ -0,0 +1,617 @@
616
1.050000e+02 1.550000e+02 2.408312e+02 8.699375e-03 2.000000e-03
1.150000e+02 1.550000e+02 2.440469e+02 9.811662e-03 2.000000e-03
1.250000e+02 1.550000e+02 2.471986e+02 1.102523e-02 2.000000e-03
1.350000e+02 1.550000e+02 2.502569e+02 1.230640e-02 2.000000e-03
1.450000e+02 1.550000e+02 2.531923e+02 1.361237e-02 2.000000e-03
1.550000e+02 1.550000e+02 2.559753e+02 1.488528e-02 2.000000e-03
1.650000e+02 1.550000e+02 2.585770e+02 1.607121e-02 2.000000e-03
1.750000e+02 1.550000e+02 2.609695e+02 1.713245e-02 2.000000e-03
1.850000e+02 1.550000e+02 2.631267e+02 1.804632e-02 2.000000e-03
1.950000e+02 1.550000e+02 2.650244e+02 1.880933e-02 2.000000e-03
2.050000e+02 1.550000e+02 2.666411e+02 1.944187e-02 2.000000e-03
2.150000e+02 1.550000e+02 2.679578e+02 1.997736e-02 2.000000e-03
2.250000e+02 1.550000e+02 2.689593e+02 2.045576e-02 2.000000e-03
2.350000e+02 1.550000e+02 2.696337e+02 2.091268e-02 2.000000e-03
2.450000e+02 1.550000e+02 2.699729e+02 2.137452e-02 2.000000e-03
2.550000e+02 1.550000e+02 2.699729e+02 2.185203e-02 2.000000e-03
2.650000e+02 1.550000e+02 2.696337e+02 2.233853e-02 2.000000e-03
2.750000e+02 1.550000e+02 2.689593e+02 2.280835e-02 2.000000e-03
2.850000e+02 1.550000e+02 2.679578e+02 2.321635e-02 2.000000e-03
2.950000e+02 1.550000e+02 2.666411e+02 2.350100e-02 2.000000e-03
3.050000e+02 1.550000e+02 2.650244e+02 2.359380e-02 2.000000e-03
3.150000e+02 1.550000e+02 2.631267e+02 2.342950e-02 2.000000e-03
3.250000e+02 1.550000e+02 2.609695e+02 2.295876e-02 2.000000e-03
3.350000e+02 1.550000e+02 2.585770e+02 2.216118e-02 2.000000e-03
3.450000e+02 1.550000e+02 2.559753e+02 2.105420e-02 2.000000e-03
3.550000e+02 1.550000e+02 2.531923e+02 1.969369e-02 2.000000e-03
3.650000e+02 1.550000e+02 2.502569e+02 1.816297e-02 2.000000e-03
3.750000e+02 1.550000e+02 2.471986e+02 1.655348e-02 2.000000e-03
1.050000e+02 1.650000e+02 2.427601e+02 9.727037e-03 2.000000e-03
1.150000e+02 1.650000e+02 2.460869e+02 1.109189e-02 2.000000e-03
1.250000e+02 1.650000e+02 2.493475e+02 1.259082e-02 2.000000e-03
1.350000e+02 1.650000e+02 2.525115e+02 1.417977e-02 2.000000e-03
1.450000e+02 1.650000e+02 2.555483e+02 1.579232e-02 2.000000e-03
1.550000e+02 1.650000e+02 2.584275e+02 1.734457e-02 2.000000e-03
1.650000e+02 1.650000e+02 2.611190e+02 1.876032e-02 2.000000e-03
1.750000e+02 1.650000e+02 2.635942e+02 1.998648e-02 2.000000e-03
1.850000e+02 1.650000e+02 2.658260e+02 2.099280e-02 2.000000e-03
1.950000e+02 1.650000e+02 2.677892e+02 2.178443e-02 2.000000e-03
2.050000e+02 1.650000e+02 2.694617e+02 2.240013e-02 2.000000e-03
2.150000e+02 1.650000e+02 2.708240e+02 2.289886e-02 2.000000e-03
2.250000e+02 1.650000e+02 2.718600e+02 2.334616e-02 2.000000e-03
2.350000e+02 1.650000e+02 2.725577e+02 2.379862e-02 2.000000e-03
2.450000e+02 1.650000e+02 2.729086e+02 2.429829e-02 2.000000e-03
2.550000e+02 1.650000e+02 2.729086e+02 2.486506e-02 2.000000e-03
2.650000e+02 1.650000e+02 2.725577e+02 2.549431e-02 2.000000e-03
2.750000e+02 1.650000e+02 2.718600e+02 2.615426e-02 2.000000e-03
2.850000e+02 1.650000e+02 2.708240e+02 2.678409e-02 2.000000e-03
2.950000e+02 1.650000e+02 2.694617e+02 2.729680e-02 2.000000e-03
3.050000e+02 1.650000e+02 2.677892e+02 2.758967e-02 2.000000e-03
3.150000e+02 1.650000e+02 2.658260e+02 2.755802e-02 2.000000e-03
3.250000e+02 1.650000e+02 2.635942e+02 2.711665e-02 2.000000e-03
3.350000e+02 1.650000e+02 2.611190e+02 2.622229e-02 2.000000e-03
3.450000e+02 1.650000e+02 2.584275e+02 2.488799e-02 2.000000e-03
3.550000e+02 1.650000e+02 2.555483e+02 2.318678e-02 2.000000e-03
3.650000e+02 1.650000e+02 2.525115e+02 2.123786e-02 2.000000e-03
3.750000e+02 1.650000e+02 2.493475e+02 1.917733e-02 2.000000e-03
1.050000e+02 1.750000e+02 2.445174e+02 1.089525e-02 2.000000e-03
1.150000e+02 1.750000e+02 2.479454e+02 1.257157e-02 2.000000e-03
1.250000e+02 1.750000e+02 2.513052e+02 1.443051e-02 2.000000e-03
1.350000e+02 1.750000e+02 2.545655e+02 1.641078e-02 2.000000e-03
1.450000e+02 1.750000e+02 2.576947e+02 1.841316e-02 2.000000e-03
1.550000e+02 1.750000e+02 2.606614e+02 2.031780e-02 2.000000e-03
1.650000e+02 1.750000e+02 2.634348e+02 2.201065e-02 2.000000e-03
1.750000e+02 1.750000e+02 2.659854e+02 2.341157e-02 2.000000e-03
1.850000e+02 1.750000e+02 2.682850e+02 2.448678e-02 2.000000e-03
1.950000e+02 1.750000e+02 2.703080e+02 2.525725e-02 2.000000e-03
2.050000e+02 1.750000e+02 2.720313e+02 2.579213e-02 2.000000e-03
2.150000e+02 1.750000e+02 2.734350e+02 2.618855e-02 2.000000e-03
2.250000e+02 1.750000e+02 2.745027e+02 2.654720e-02 2.000000e-03
2.350000e+02 1.750000e+02 2.752216e+02 2.695443e-02 2.000000e-03
2.450000e+02 1.750000e+02 2.755831e+02 2.747264e-02 2.000000e-03
2.550000e+02 1.750000e+02 2.755831e+02 2.813471e-02 2.000000e-03
2.650000e+02 1.750000e+02 2.752216e+02 2.894005e-02 2.000000e-03
2.750000e+02 1.750000e+02 2.745027e+02 2.985075e-02 2.000000e-03
2.850000e+02 1.750000e+02 2.734350e+02 3.078824e-02 2.000000e-03
2.950000e+02 1.750000e+02 2.720313e+02 3.163485e-02 2.000000e-03
3.050000e+02 1.750000e+02 2.703080e+02 3.224142e-02 2.000000e-03
3.150000e+02 1.750000e+02 2.682850e+02 3.244573e-02 2.000000e-03
3.250000e+02 1.750000e+02 2.659854e+02 3.210562e-02 2.000000e-03
3.350000e+02 1.750000e+02 2.634348e+02 3.113619e-02 2.000000e-03
3.450000e+02 1.750000e+02 2.606614e+02 2.953886e-02 2.000000e-03
3.550000e+02 1.750000e+02 2.576947e+02 2.741092e-02 2.000000e-03
3.650000e+02 1.750000e+02 2.545655e+02 2.492491e-02 2.000000e-03
3.750000e+02 1.750000e+02 2.513052e+02 2.228314e-02 2.000000e-03
1.050000e+02 1.850000e+02 2.460835e+02 1.219901e-02 2.000000e-03
1.150000e+02 1.850000e+02 2.496018e+02 1.425707e-02 2.000000e-03
1.250000e+02 1.850000e+02 2.530500e+02 1.656703e-02 2.000000e-03
1.350000e+02 1.850000e+02 2.563960e+02 1.904267e-02 2.000000e-03
1.450000e+02 1.850000e+02 2.596076e+02 2.154309e-02 2.000000e-03
1.550000e+02 1.850000e+02 2.626524e+02 2.389251e-02 2.000000e-03
1.650000e+02 1.850000e+02 2.654988e+02 2.591841e-02 2.000000e-03
1.750000e+02 1.850000e+02 2.681164e+02 2.750129e-02 2.000000e-03
1.850000e+02 1.850000e+02 2.704766e+02 2.860300e-02 2.000000e-03
1.950000e+02 1.850000e+02 2.725528e+02 2.927297e-02 2.000000e-03
2.050000e+02 1.850000e+02 2.743215e+02 2.963033e-02 2.000000e-03
2.150000e+02 1.850000e+02 2.757621e+02 2.982855e-02 2.000000e-03
2.250000e+02 1.850000e+02 2.768578e+02 3.001789e-02 2.000000e-03
2.350000e+02 1.850000e+02 2.775956e+02 3.032229e-02 2.000000e-03
2.450000e+02 1.850000e+02 2.779668e+02 3.082928e-02 2.000000e-03
2.550000e+02 1.850000e+02 2.779668e+02 3.158715e-02 2.000000e-03
2.650000e+02 1.850000e+02 2.775956e+02 3.260165e-02 2.000000e-03
2.750000e+02 1.850000e+02 2.768578e+02 3.383103e-02 2.000000e-03
2.850000e+02 1.850000e+02 2.757621e+02 3.517975e-02 2.000000e-03
2.950000e+02 1.850000e+02 2.743215e+02 3.649394e-02 2.000000e-03
3.050000e+02 1.850000e+02 2.725528e+02 3.756451e-02 2.000000e-03
3.150000e+02 1.850000e+02 2.704766e+02 3.814891e-02 2.000000e-03
3.250000e+02 1.850000e+02 2.681164e+02 3.801821e-02 2.000000e-03
3.350000e+02 1.850000e+02 2.654988e+02 3.701774e-02 2.000000e-03
3.450000e+02 1.850000e+02 2.626524e+02 3.512216e-02 2.000000e-03
3.550000e+02 1.850000e+02 2.596076e+02 3.245988e-02 2.000000e-03
3.650000e+02 1.850000e+02 2.563960e+02 2.928500e-02 2.000000e-03
3.750000e+02 1.850000e+02 2.530500e+02 2.589943e-02 2.000000e-03
1.050000e+02 1.950000e+02 2.474409e+02 1.361651e-02 2.000000e-03
1.150000e+02 1.950000e+02 2.510374e+02 1.613214e-02 2.000000e-03
1.250000e+02 1.950000e+02 2.545621e+02 1.899787e-02 2.000000e-03
1.350000e+02 1.950000e+02 2.579825e+02 2.209962e-02 2.000000e-03
1.450000e+02 1.950000e+02 2.612655e+02 2.523764e-02 2.000000e-03
1.550000e+02 1.950000e+02 2.643779e+02 2.814896e-02 2.000000e-03
1.650000e+02 1.950000e+02 2.672876e+02 3.057396e-02 2.000000e-03
1.750000e+02 1.950000e+02 2.699634e+02 3.233584e-02 2.000000e-03
1.850000e+02 1.950000e+02 2.723760e+02 3.339213e-02 2.000000e-03
1.950000e+02 1.950000e+02 2.744984e+02 3.384416e-02 2.000000e-03
2.050000e+02 1.950000e+02 2.763063e+02 3.389061e-02 2.000000e-03
2.150000e+02 1.950000e+02 2.777790e+02 3.376532e-02 2.000000e-03
2.250000e+02 1.950000e+02 2.788990e+02 3.368327e-02 2.000000e-03
2.350000e+02 1.950000e+02 2.796533e+02 3.381201e-02 2.000000e-03
2.450000e+02 1.950000e+02 2.800326e+02 3.426693e-02 2.000000e-03
2.550000e+02 1.950000e+02 2.800326e+02 3.511322e-02 2.000000e-03
2.650000e+02 1.950000e+02 2.796533e+02 3.636463e-02 2.000000e-03
2.750000e+02 1.950000e+02 2.788990e+02 3.797921e-02 2.000000e-03
2.850000e+02 1.950000e+02 2.777790e+02 3.984870e-02 2.000000e-03
2.950000e+02 1.950000e+02 2.763063e+02 4.178252e-02 2.000000e-03
3.050000e+02 1.950000e+02 2.744984e+02 4.350037e-02 2.000000e-03
3.150000e+02 1.950000e+02 2.723760e+02 4.465226e-02 2.000000e-03
3.250000e+02 1.950000e+02 2.699634e+02 4.488142e-02 2.000000e-03
3.350000e+02 1.950000e+02 2.672876e+02 4.392264e-02 2.000000e-03
3.450000e+02 1.950000e+02 2.643779e+02 4.169861e-02 2.000000e-03
3.550000e+02 1.950000e+02 2.612655e+02 3.837439e-02 2.000000e-03
3.650000e+02 1.950000e+02 2.579825e+02 3.432473e-02 2.000000e-03
3.750000e+02 1.950000e+02 2.545621e+02 3.000183e-02 2.000000e-03
1.050000e+02 2.050000e+02 2.485739e+02 1.510182e-02 2.000000e-03
1.150000e+02 2.050000e+02 2.522356e+02 1.814747e-02 2.000000e-03
1.250000e+02 2.050000e+02 2.558243e+02 2.167883e-02 2.000000e-03
1.350000e+02 2.050000e+02 2.593068e+02 2.555595e-02 2.000000e-03
1.450000e+02 2.050000e+02 2.626493e+02 2.949671e-02 2.000000e-03
1.550000e+02 2.050000e+02 2.658182e+02 3.311197e-02 2.000000e-03
1.650000e+02 2.050000e+02 2.687807e+02 3.601228e-02 2.000000e-03
1.750000e+02 2.050000e+02 2.715050e+02 3.793456e-02 2.000000e-03
1.850000e+02 2.050000e+02 2.739614e+02 3.884049e-02 2.000000e-03
1.950000e+02 2.050000e+02 2.761223e+02 3.891959e-02 2.000000e-03
2.050000e+02 2.050000e+02 2.779631e+02 3.848912e-02 2.000000e-03
2.150000e+02 2.050000e+02 2.794624e+02 3.789228e-02 2.000000e-03
2.250000e+02 2.050000e+02 2.806028e+02 3.742200e-02 2.000000e-03
2.350000e+02 2.050000e+02 2.813707e+02 3.729294e-02 2.000000e-03
2.450000e+02 2.050000e+02 2.817570e+02 3.764819e-02 2.000000e-03
2.550000e+02 2.050000e+02 2.817570e+02 3.856623e-02 2.000000e-03
2.650000e+02 2.050000e+02 2.813707e+02 4.006947e-02 2.000000e-03
2.750000e+02 2.050000e+02 2.806028e+02 4.212125e-02 2.000000e-03
2.850000e+02 2.050000e+02 2.794624e+02 4.460758e-02 2.000000e-03
2.950000e+02 2.050000e+02 2.779631e+02 4.730731e-02 2.000000e-03
3.050000e+02 2.050000e+02 2.761223e+02 4.986451e-02 2.000000e-03
3.150000e+02 2.050000e+02 2.739614e+02 5.179647e-02 2.000000e-03
3.250000e+02 2.050000e+02 2.715050e+02 5.257176e-02 2.000000e-03
3.350000e+02 2.050000e+02 2.687807e+02 5.175914e-02 2.000000e-03
3.450000e+02 2.050000e+02 2.658182e+02 4.918940e-02 2.000000e-03
3.550000e+02 2.050000e+02 2.626493e+02 4.506732e-02 2.000000e-03
3.650000e+02 2.050000e+02 2.593068e+02 3.993836e-02 2.000000e-03
3.750000e+02 2.050000e+02 2.558243e+02 3.447183e-02 2.000000e-03
1.050000e+02 2.150000e+02 2.494692e+02 1.657621e-02 2.000000e-03
1.150000e+02 2.150000e+02 2.531825e+02 2.020364e-02 2.000000e-03
1.250000e+02 2.150000e+02 2.568218e+02 2.449411e-02 2.000000e-03
1.350000e+02 2.150000e+02 2.603533e+02 2.928618e-02 2.000000e-03
1.450000e+02 2.150000e+02 2.637429e+02 3.420118e-02 2.000000e-03
1.550000e+02 2.150000e+02 2.669565e+02 3.867855e-02 2.000000e-03
1.650000e+02 2.150000e+02 2.699606e+02 4.213023e-02 2.000000e-03
1.750000e+02 2.150000e+02 2.727234e+02 4.417469e-02 2.000000e-03
1.850000e+02 2.150000e+02 2.752143e+02 4.480084e-02 2.000000e-03
1.950000e+02 2.150000e+02 2.774056e+02 4.433000e-02 2.000000e-03
2.050000e+02 2.150000e+02 2.792724e+02 4.324514e-02 2.000000e-03
2.150000e+02 2.150000e+02 2.807928e+02 4.202631e-02 2.000000e-03
2.250000e+02 2.150000e+02 2.819493e+02 4.105517e-02 2.000000e-03
2.350000e+02 2.150000e+02 2.827280e+02 4.059277e-02 2.000000e-03
2.450000e+02 2.150000e+02 2.831197e+02 4.080158e-02 2.000000e-03
2.550000e+02 2.150000e+02 2.831197e+02 4.176505e-02 2.000000e-03
2.650000e+02 2.150000e+02 2.827280e+02 4.351334e-02 2.000000e-03
2.750000e+02 2.150000e+02 2.819493e+02 4.602149e-02 2.000000e-03
2.850000e+02 2.150000e+02 2.807928e+02 4.917818e-02 2.000000e-03
2.950000e+02 2.150000e+02 2.792724e+02 5.274213e-02 2.000000e-03
3.050000e+02 2.150000e+02 2.774056e+02 5.628755e-02 2.000000e-03
3.150000e+02 2.150000e+02 2.752143e+02 5.918564e-02 2.000000e-03
3.250000e+02 2.150000e+02 2.727234e+02 6.069202e-02 2.000000e-03
3.350000e+02 2.150000e+02 2.699606e+02 6.014912e-02 2.000000e-03
3.450000e+02 2.150000e+02 2.669565e+02 5.724081e-02 2.000000e-03
3.550000e+02 2.150000e+02 2.637429e+02 5.220764e-02 2.000000e-03
3.650000e+02 2.150000e+02 2.603533e+02 4.582334e-02 2.000000e-03
3.750000e+02 2.150000e+02 2.568218e+02 3.904765e-02 2.000000e-03
1.050000e+02 2.250000e+02 2.501165e+02 1.792863e-02 2.000000e-03
1.150000e+02 2.250000e+02 2.538671e+02 2.214366e-02 2.000000e-03
1.250000e+02 2.250000e+02 2.575429e+02 2.723102e-02 2.000000e-03
1.350000e+02 2.250000e+02 2.611099e+02 3.302249e-02 2.000000e-03
1.450000e+02 2.250000e+02 2.645335e+02 3.904061e-02 2.000000e-03
1.550000e+02 2.250000e+02 2.677793e+02 4.450854e-02 2.000000e-03
1.650000e+02 2.250000e+02 2.708137e+02 4.856805e-02 2.000000e-03
1.750000e+02 2.250000e+02 2.736041e+02 5.068488e-02 2.000000e-03
1.850000e+02 2.250000e+02 2.761201e+02 5.090222e-02 2.000000e-03
1.950000e+02 2.250000e+02 2.783334e+02 4.972460e-02 2.000000e-03
2.050000e+02 2.250000e+02 2.802189e+02 4.784310e-02 2.000000e-03
2.150000e+02 2.250000e+02 2.817546e+02 4.589326e-02 2.000000e-03
2.250000e+02 2.250000e+02 2.829227e+02 4.434959e-02 2.000000e-03
2.350000e+02 2.250000e+02 2.837092e+02 4.350819e-02 2.000000e-03
2.450000e+02 2.250000e+02 2.841048e+02 4.353322e-02 2.000000e-03
2.550000e+02 2.250000e+02 2.841048e+02 4.450796e-02 2.000000e-03
2.650000e+02 2.250000e+02 2.837092e+02 4.646693e-02 2.000000e-03
2.750000e+02 2.250000e+02 2.829227e+02 4.939724e-02 2.000000e-03
2.850000e+02 2.250000e+02 2.817546e+02 5.320034e-02 2.000000e-03
2.950000e+02 2.250000e+02 2.802189e+02 5.762526e-02 2.000000e-03
3.050000e+02 2.250000e+02 2.783334e+02 6.218955e-02 2.000000e-03
3.150000e+02 2.250000e+02 2.761201e+02 6.612435e-02 2.000000e-03
3.250000e+02 2.250000e+02 2.736041e+02 6.846167e-02 2.000000e-03
3.350000e+02 2.250000e+02 2.708137e+02 6.828188e-02 2.000000e-03
3.450000e+02 2.250000e+02 2.677793e+02 6.507469e-02 2.000000e-03
3.550000e+02 2.250000e+02 2.645335e+02 5.910062e-02 2.000000e-03
3.650000e+02 2.250000e+02 2.611099e+02 5.140639e-02 2.000000e-03
3.750000e+02 2.250000e+02 2.575429e+02 4.329021e-02 2.000000e-03
1.050000e+02 2.350000e+02 2.505080e+02 1.902566e-02 2.000000e-03
1.150000e+02 2.350000e+02 2.542811e+02 2.376254e-02 2.000000e-03
1.250000e+02 2.350000e+02 2.579790e+02 2.958497e-02 2.000000e-03
1.350000e+02 2.350000e+02 2.615674e+02 3.633584e-02 2.000000e-03
1.450000e+02 2.350000e+02 2.650117e+02 4.345350e-02 2.000000e-03
1.550000e+02 2.350000e+02 2.682770e+02 4.992846e-02 2.000000e-03
1.650000e+02 2.350000e+02 2.713296e+02 5.459254e-02 2.000000e-03
1.750000e+02 2.350000e+02 2.741368e+02 5.674079e-02 2.000000e-03
1.850000e+02 2.350000e+02 2.766679e+02 5.648464e-02 2.000000e-03
1.950000e+02 2.350000e+02 2.788945e+02 5.454128e-02 2.000000e-03
2.050000e+02 2.350000e+02 2.807913e+02 5.182869e-02 2.000000e-03
2.150000e+02 2.350000e+02 2.823363e+02 4.914221e-02 2.000000e-03
2.250000e+02 2.350000e+02 2.835114e+02 4.703298e-02 2.000000e-03
2.350000e+02 2.350000e+02 2.843026e+02 4.581478e-02 2.000000e-03
2.450000e+02 2.350000e+02 2.847007e+02 4.564345e-02 2.000000e-03
2.550000e+02 2.350000e+02 2.847007e+02 4.659324e-02 2.000000e-03
2.650000e+02 2.350000e+02 2.843026e+02 4.869864e-02 2.000000e-03
2.750000e+02 2.350000e+02 2.835114e+02 5.195559e-02 2.000000e-03
2.850000e+02 2.350000e+02 2.823363e+02 5.627910e-02 2.000000e-03
2.950000e+02 2.350000e+02 2.807913e+02 6.141810e-02 2.000000e-03
3.050000e+02 2.350000e+02 2.788945e+02 6.684790e-02 2.000000e-03
3.150000e+02 2.350000e+02 2.766679e+02 7.168410e-02 2.000000e-03
3.250000e+02 2.350000e+02 2.741368e+02 7.476565e-02 2.000000e-03
3.350000e+02 2.350000e+02 2.713296e+02 7.493779e-02 2.000000e-03
3.450000e+02 2.350000e+02 2.682770e+02 7.149806e-02 2.000000e-03
3.550000e+02 2.350000e+02 2.650117e+02 6.471227e-02 2.000000e-03
3.650000e+02 2.350000e+02 2.615674e+02 5.588432e-02 2.000000e-03
3.750000e+02 2.350000e+02 2.579791e+02 4.662537e-02 2.000000e-03
1.050000e+02 2.450000e+02 2.506390e+02 1.973230e-02 2.000000e-03
1.150000e+02 2.450000e+02 2.544197e+02 2.484061e-02 2.000000e-03
1.250000e+02 2.450000e+02 2.581250e+02 3.120525e-02 2.000000e-03
1.350000e+02 2.450000e+02 2.617206e+02 3.869321e-02 2.000000e-03
1.450000e+02 2.450000e+02 2.651717e+02 4.668984e-02 2.000000e-03
1.550000e+02 2.450000e+02 2.684435e+02 5.399194e-02 2.000000e-03
1.650000e+02 2.450000e+02 2.715022e+02 5.915683e-02 2.000000e-03
1.750000e+02 2.450000e+02 2.743151e+02 6.132492e-02 2.000000e-03
1.850000e+02 2.450000e+02 2.768512e+02 6.066492e-02 2.000000e-03
1.950000e+02 2.450000e+02 2.790823e+02 5.807989e-02 2.000000e-03
2.050000e+02 2.450000e+02 2.809829e+02 5.468171e-02 2.000000e-03
2.150000e+02 2.450000e+02 2.825310e+02 5.139590e-02 2.000000e-03
2.250000e+02 2.450000e+02 2.837084e+02 4.882997e-02 2.000000e-03
2.350000e+02 2.450000e+02 2.845013e+02 4.730120e-02 2.000000e-03
2.450000e+02 2.450000e+02 2.849001e+02 4.695304e-02 2.000000e-03
2.550000e+02 2.450000e+02 2.849001e+02 4.784636e-02 2.000000e-03
2.650000e+02 2.450000e+02 2.845013e+02 5.000952e-02 2.000000e-03
2.750000e+02 2.450000e+02 2.837084e+02 5.344154e-02 2.000000e-03
2.850000e+02 2.450000e+02 2.825310e+02 5.806444e-02 2.000000e-03
2.950000e+02 2.450000e+02 2.809829e+02 6.362712e-02 2.000000e-03
3.050000e+02 2.450000e+02 2.790823e+02 6.957772e-02 2.000000e-03
3.150000e+02 2.450000e+02 2.768512e+02 7.495865e-02 2.000000e-03
3.250000e+02 2.450000e+02 2.743151e+02 7.848830e-02 2.000000e-03
3.350000e+02 2.450000e+02 2.715022e+02 7.886686e-02 2.000000e-03
3.450000e+02 2.450000e+02 2.684435e+02 7.527199e-02 2.000000e-03
3.550000e+02 2.450000e+02 2.651717e+02 6.797572e-02 2.000000e-03
3.650000e+02 2.450000e+02 2.617206e+02 5.844707e-02 2.000000e-03
3.750000e+02 2.450000e+02 2.581250e+02 4.849373e-02 2.000000e-03
1.050000e+02 2.550000e+02 2.505080e+02 1.994464e-02 2.000000e-03
1.150000e+02 2.550000e+02 2.542811e+02 2.520154e-02 2.000000e-03
1.250000e+02 2.550000e+02 2.579790e+02 3.179745e-02 2.000000e-03
1.350000e+02 2.550000e+02 2.615674e+02 3.962153e-02 2.000000e-03
1.450000e+02 2.550000e+02 2.650117e+02 4.804544e-02 2.000000e-03
1.550000e+02 2.550000e+02 2.682770e+02 5.577527e-02 2.000000e-03
1.650000e+02 2.550000e+02 2.713296e+02 6.122440e-02 2.000000e-03
1.750000e+02 2.550000e+02 2.741368e+02 6.343705e-02 2.000000e-03
1.850000e+02 2.550000e+02 2.766679e+02 6.259204e-02 2.000000e-03
1.950000e+02 2.550000e+02 2.788945e+02 5.968460e-02 2.000000e-03
2.050000e+02 2.550000e+02 2.807913e+02 5.593163e-02 2.000000e-03
2.150000e+02 2.550000e+02 2.823363e+02 5.233032e-02 2.000000e-03
2.250000e+02 2.550000e+02 2.835114e+02 4.951558e-02 2.000000e-03
2.350000e+02 2.550000e+02 2.843026e+02 4.780490e-02 2.000000e-03
2.450000e+02 2.550000e+02 2.847007e+02 4.733203e-02 2.000000e-03
2.550000e+02 2.550000e+02 2.847007e+02 4.814662e-02 2.000000e-03
2.650000e+02 2.550000e+02 2.843026e+02 5.026818e-02 2.000000e-03
2.750000e+02 2.550000e+02 2.835114e+02 5.368927e-02 2.000000e-03
2.850000e+02 2.550000e+02 2.823363e+02 5.832827e-02 2.000000e-03
2.950000e+02 2.550000e+02 2.807913e+02 6.393007e-02 2.000000e-03
3.050000e+02 2.550000e+02 2.788945e+02 6.993202e-02 2.000000e-03
3.150000e+02 2.550000e+02 2.766679e+02 7.535884e-02 2.000000e-03
3.250000e+02 2.550000e+02 2.741368e+02 7.890994e-02 2.000000e-03
3.350000e+02 2.550000e+02 2.713296e+02 7.926954e-02 2.000000e-03
3.450000e+02 2.550000e+02 2.682770e+02 7.560738e-02 2.000000e-03
3.550000e+02 2.550000e+02 2.650117e+02 6.820847e-02 2.000000e-03
3.650000e+02 2.550000e+02 2.615674e+02 5.857505e-02 2.000000e-03
3.750000e+02 2.550000e+02 2.579791e+02 4.853885e-02 2.000000e-03
1.050000e+02 2.650000e+02 2.501165e+02 1.962030e-02 2.000000e-03
1.150000e+02 2.650000e+02 2.538671e+02 2.476949e-02 2.000000e-03
1.250000e+02 2.650000e+02 2.575429e+02 3.122760e-02 2.000000e-03
1.350000e+02 2.650000e+02 2.611099e+02 3.889153e-02 2.000000e-03
1.450000e+02 2.650000e+02 2.645335e+02 4.715893e-02 2.000000e-03
1.550000e+02 2.650000e+02 2.677793e+02 5.478282e-02 2.000000e-03
1.650000e+02 2.650000e+02 2.708137e+02 6.022048e-02 2.000000e-03
1.750000e+02 2.650000e+02 2.736041e+02 6.250966e-02 2.000000e-03
1.850000e+02 2.650000e+02 2.761201e+02 6.177780e-02 2.000000e-03
1.950000e+02 2.650000e+02 2.783334e+02 5.897860e-02 2.000000e-03
2.050000e+02 2.650000e+02 2.802189e+02 5.530960e-02 2.000000e-03
2.150000e+02 2.650000e+02 2.817546e+02 5.176463e-02 2.000000e-03
2.250000e+02 2.650000e+02 2.829227e+02 4.897063e-02 2.000000e-03
2.350000e+02 2.650000e+02 2.837092e+02 4.724657e-02 2.000000e-03
2.450000e+02 2.650000e+02 2.841048e+02 4.672441e-02 2.000000e-03
2.550000e+02 2.650000e+02 2.841048e+02 4.744984e-02 2.000000e-03
2.650000e+02 2.650000e+02 2.837092e+02 4.943386e-02 2.000000e-03
2.750000e+02 2.650000e+02 2.829227e+02 5.265515e-02 2.000000e-03
2.850000e+02 2.650000e+02 2.817546e+02 5.701701e-02 2.000000e-03
2.950000e+02 2.650000e+02 2.802189e+02 6.225742e-02 2.000000e-03
3.050000e+02 2.650000e+02 2.783334e+02 6.782030e-02 2.000000e-03
3.150000e+02 2.650000e+02 2.761201e+02 7.277295e-02 2.000000e-03
3.250000e+02 2.650000e+02 2.736041e+02 7.590280e-02 2.000000e-03
3.350000e+02 2.650000e+02 2.708137e+02 7.601587e-02 2.000000e-03
3.450000e+02 2.650000e+02 2.677793e+02 7.238941e-02 2.000000e-03
3.550000e+02 2.650000e+02 2.645335e+02 6.532399e-02 2.000000e-03
3.650000e+02 2.650000e+02 2.611099e+02 5.621253e-02 2.000000e-03
3.750000e+02 2.650000e+02 2.575429e+02 4.673007e-02 2.000000e-03
1.050000e+02 2.750000e+02 2.494692e+02 1.879447e-02 2.000000e-03
1.150000e+02 2.750000e+02 2.531825e+02 2.359757e-02 2.000000e-03
1.250000e+02 2.750000e+02 2.568218e+02 2.957201e-02 2.000000e-03
1.350000e+02 2.750000e+02 2.603533e+02 3.661365e-02 2.000000e-03
1.450000e+02 2.750000e+02 2.637429e+02 4.417920e-02 2.000000e-03
1.550000e+02 2.750000e+02 2.669565e+02 5.118231e-02 2.000000e-03
1.650000e+02 2.750000e+02 2.699606e+02 5.629954e-02 2.000000e-03
1.750000e+02 2.750000e+02 2.727234e+02 5.866051e-02 2.000000e-03
1.850000e+02 2.750000e+02 2.752143e+02 5.830526e-02 2.000000e-03
1.950000e+02 2.750000e+02 2.774056e+02 5.602097e-02 2.000000e-03
2.050000e+02 2.750000e+02 2.792724e+02 5.285814e-02 2.000000e-03
2.150000e+02 2.750000e+02 2.807928e+02 4.972599e-02 2.000000e-03
2.250000e+02 2.750000e+02 2.819493e+02 4.721877e-02 2.000000e-03
2.350000e+02 2.750000e+02 2.827280e+02 4.565059e-02 2.000000e-03
2.450000e+02 2.750000e+02 2.831197e+02 4.516085e-02 2.000000e-03
2.550000e+02 2.750000e+02 2.831197e+02 4.579836e-02 2.000000e-03
2.650000e+02 2.750000e+02 2.827280e+02 4.756779e-02 2.000000e-03
2.750000e+02 2.750000e+02 2.819493e+02 5.043112e-02 2.000000e-03
2.850000e+02 2.750000e+02 2.807928e+02 5.427250e-02 2.000000e-03
2.950000e+02 2.750000e+02 2.792724e+02 5.881957e-02 2.000000e-03
3.050000e+02 2.750000e+02 2.774056e+02 6.354358e-02 2.000000e-03
3.150000e+02 2.750000e+02 2.752143e+02 6.761114e-02 2.000000e-03
3.250000e+02 2.750000e+02 2.727234e+02 6.998698e-02 2.000000e-03
3.350000e+02 2.750000e+02 2.699606e+02 6.970280e-02 2.000000e-03
3.450000e+02 2.750000e+02 2.669565e+02 6.622704e-02 2.000000e-03
3.550000e+02 2.750000e+02 2.637429e+02 5.987040e-02 2.000000e-03
3.650000e+02 2.750000e+02 2.603533e+02 5.179432e-02 2.000000e-03
3.750000e+02 2.750000e+02 2.568218e+02 4.337758e-02 2.000000e-03
1.050000e+02 2.850000e+02 2.485739e+02 1.756811e-02 2.000000e-03
1.150000e+02 2.850000e+02 2.522356e+02 2.185255e-02 2.000000e-03
1.250000e+02 2.850000e+02 2.558243e+02 2.710533e-02 2.000000e-03
1.350000e+02 2.850000e+02 2.593068e+02 3.321254e-02 2.000000e-03
1.450000e+02 2.850000e+02 2.626493e+02 3.971518e-02 2.000000e-03
1.550000e+02 2.850000e+02 2.658182e+02 4.575280e-02 2.000000e-03
1.650000e+02 2.850000e+02 2.687807e+02 5.030714e-02 2.000000e-03
1.750000e+02 2.850000e+02 2.715050e+02 5.267778e-02 2.000000e-03
1.850000e+02 2.850000e+02 2.739614e+02 5.282390e-02 2.000000e-03
1.950000e+02 2.850000e+02 2.761223e+02 5.129906e-02 2.000000e-03
2.050000e+02 2.850000e+02 2.779631e+02 4.892335e-02 2.000000e-03
2.150000e+02 2.850000e+02 2.794624e+02 4.645518e-02 2.000000e-03
2.250000e+02 2.850000e+02 2.806028e+02 4.442776e-02 2.000000e-03
2.350000e+02 2.850000e+02 2.813707e+02 4.314617e-02 2.000000e-03
2.450000e+02 2.850000e+02 2.817570e+02 4.275783e-02 2.000000e-03
2.550000e+02 2.850000e+02 2.817570e+02 4.331657e-02 2.000000e-03
2.650000e+02 2.850000e+02 2.813707e+02 4.482491e-02 2.000000e-03
2.750000e+02 2.850000e+02 2.806028e+02 4.723090e-02 2.000000e-03
2.850000e+02 2.850000e+02 2.794624e+02 5.040037e-02 2.000000e-03
2.950000e+02 2.850000e+02 2.779631e+02 5.405946e-02 2.000000e-03
3.050000e+02 2.850000e+02 2.761223e+02 5.773115e-02 2.000000e-03
3.150000e+02 2.850000e+02 2.739614e+02 6.072162e-02 2.000000e-03
3.250000e+02 2.850000e+02 2.715050e+02 6.222356e-02 2.000000e-03
3.350000e+02 2.850000e+02 2.687807e+02 6.153243e-02 2.000000e-03
3.450000e+02 2.850000e+02 2.658182e+02 5.832177e-02 2.000000e-03
3.550000e+02 2.850000e+02 2.626493e+02 5.288882e-02 2.000000e-03
3.650000e+02 2.850000e+02 2.593068e+02 4.611380e-02 2.000000e-03
3.750000e+02 2.850000e+02 2.558243e+02 3.902933e-02 2.000000e-03
1.050000e+02 2.950000e+02 2.474409e+02 1.607976e-02 2.000000e-03
1.150000e+02 2.950000e+02 2.510374e+02 1.976018e-02 2.000000e-03
1.250000e+02 2.950000e+02 2.545621e+02 2.419038e-02 2.000000e-03
1.350000e+02 2.950000e+02 2.579825e+02 2.924939e-02 2.000000e-03
1.450000e+02 2.950000e+02 2.612655e+02 3.457584e-02 2.000000e-03
1.550000e+02 2.950000e+02 2.643779e+02 3.954108e-02 2.000000e-03
1.650000e+02 2.950000e+02 2.672876e+02 4.342082e-02 2.000000e-03
1.750000e+02 2.950000e+02 2.699634e+02 4.570327e-02 2.000000e-03
1.850000e+02 2.950000e+02 2.723760e+02 4.630547e-02 2.000000e-03
1.950000e+02 2.950000e+02 2.744984e+02 4.556288e-02 2.000000e-03
2.050000e+02 2.950000e+02 2.763063e+02 4.404763e-02 2.000000e-03
2.150000e+02 2.950000e+02 2.777790e+02 4.233733e-02 2.000000e-03
2.250000e+02 2.950000e+02 2.788990e+02 4.087702e-02 2.000000e-03
2.350000e+02 2.950000e+02 2.796533e+02 3.994809e-02 2.000000e-03
2.450000e+02 2.950000e+02 2.800326e+02 3.970013e-02 2.000000e-03
2.550000e+02 2.950000e+02 2.800326e+02 4.019297e-02 2.000000e-03
2.650000e+02 2.950000e+02 2.796533e+02 4.142705e-02 2.000000e-03
2.750000e+02 2.950000e+02 2.788990e+02 4.334188e-02 2.000000e-03
2.850000e+02 2.950000e+02 2.777790e+02 4.579594e-02 2.000000e-03
2.950000e+02 2.950000e+02 2.763063e+02 4.853257e-02 2.000000e-03
3.050000e+02 2.950000e+02 2.744984e+02 5.114824e-02 2.000000e-03
3.150000e+02 2.950000e+02 2.723760e+02 5.310412e-02 2.000000e-03
3.250000e+02 2.950000e+02 2.699634e+02 5.381973e-02 2.000000e-03
3.350000e+02 2.950000e+02 2.672876e+02 5.282953e-02 2.000000e-03
3.450000e+02 2.950000e+02 2.643779e+02 4.996518e-02 2.000000e-03
3.550000e+02 2.950000e+02 2.612655e+02 4.548661e-02 2.000000e-03
3.650000e+02 2.950000e+02 2.579825e+02 4.001789e-02 2.000000e-03
3.750000e+02 2.950000e+02 2.545621e+02 3.427976e-02 2.000000e-03
1.050000e+02 3.050000e+02 2.460835e+02 1.447201e-02 2.000000e-03
1.150000e+02 3.050000e+02 2.496018e+02 1.754251e-02 2.000000e-03
1.250000e+02 3.050000e+02 2.530500e+02 2.116683e-02 2.000000e-03
1.350000e+02 3.050000e+02 2.563960e+02 2.523018e-02 2.000000e-03
1.450000e+02 3.050000e+02 2.596076e+02 2.946229e-02 2.000000e-03
1.550000e+02 3.050000e+02 2.626524e+02 3.343020e-02 2.000000e-03
1.650000e+02 3.050000e+02 2.654988e+02 3.664512e-02 2.000000e-03
1.750000e+02 3.050000e+02 2.681164e+02 3.875291e-02 2.000000e-03
1.850000e+02 3.050000e+02 2.704766e+02 3.966383e-02 2.000000e-03
1.950000e+02 3.050000e+02 2.725528e+02 3.955962e-02 2.000000e-03
2.050000e+02 3.050000e+02 2.743215e+02 3.880132e-02 2.000000e-03
2.150000e+02 3.050000e+02 2.757621e+02 3.779493e-02 2.000000e-03
2.250000e+02 3.050000e+02 2.768578e+02 3.688419e-02 2.000000e-03
2.350000e+02 3.050000e+02 2.775956e+02 3.630888e-02 2.000000e-03
2.450000e+02 3.050000e+02 2.779668e+02 3.620911e-02 2.000000e-03
2.550000e+02 3.050000e+02 2.779668e+02 3.664635e-02 2.000000e-03
2.650000e+02 3.050000e+02 2.775956e+02 3.761980e-02 2.000000e-03
2.750000e+02 3.050000e+02 2.768578e+02 3.906756e-02 2.000000e-03
2.850000e+02 3.050000e+02 2.757621e+02 4.085554e-02 2.000000e-03
2.950000e+02 3.050000e+02 2.743215e+02 4.276132e-02 2.000000e-03
3.050000e+02 3.050000e+02 2.725528e+02 4.446581e-02 2.000000e-03
3.150000e+02 3.050000e+02 2.704766e+02 4.557673e-02 2.000000e-03
3.250000e+02 3.050000e+02 2.681164e+02 4.570216e-02 2.000000e-03
3.350000e+02 3.050000e+02 2.654988e+02 4.455673e-02 2.000000e-03
3.450000e+02 3.050000e+02 2.626524e+02 4.207252e-02 2.000000e-03
3.550000e+02 3.050000e+02 2.596076e+02 3.845928e-02 2.000000e-03
3.650000e+02 3.050000e+02 2.563960e+02 3.414187e-02 2.000000e-03
3.750000e+02 3.050000e+02 2.530500e+02 2.960411e-02 2.000000e-03
1.050000e+02 3.150000e+02 2.445174e+02 1.286330e-02 2.000000e-03
1.150000e+02 3.150000e+02 2.479454e+02 1.537271e-02 2.000000e-03
1.250000e+02 3.150000e+02 2.513052e+02 1.828041e-02 2.000000e-03
1.350000e+02 3.150000e+02 2.545655e+02 2.148831e-02 2.000000e-03
1.450000e+02 3.150000e+02 2.576947e+02 2.480036e-02 2.000000e-03
1.550000e+02 3.150000e+02 2.606614e+02 2.792960e-02 2.000000e-03
1.650000e+02 3.150000e+02 2.634348e+02 3.055705e-02 2.000000e-03
1.750000e+02 3.150000e+02 2.659854e+02 3.244136e-02 2.000000e-03
1.850000e+02 3.150000e+02 2.682850e+02 3.350260e-02 2.000000e-03
1.950000e+02 3.150000e+02 2.703080e+02 3.383039e-02 2.000000e-03
2.050000e+02 3.150000e+02 2.720313e+02 3.363891e-02 2.000000e-03
2.150000e+02 3.150000e+02 2.734350e+02 3.319420e-02 2.000000e-03
2.250000e+02 3.150000e+02 2.745027e+02 3.274280e-02 2.000000e-03
2.350000e+02 3.150000e+02 2.752216e+02 3.247345e-02 2.000000e-03
2.450000e+02 3.150000e+02 2.755831e+02 3.250518e-02 2.000000e-03
2.550000e+02 3.150000e+02 2.755831e+02 3.289339e-02 2.000000e-03
2.650000e+02 3.150000e+02 2.752216e+02 3.363749e-02 2.000000e-03
2.750000e+02 3.150000e+02 2.745027e+02 3.468145e-02 2.000000e-03
2.850000e+02 3.150000e+02 2.734350e+02 3.590957e-02 2.000000e-03
2.950000e+02 3.150000e+02 2.720313e+02 3.714307e-02 2.000000e-03
3.050000e+02 3.150000e+02 2.703080e+02 3.814419e-02 2.000000e-03
3.150000e+02 3.150000e+02 2.682850e+02 3.864184e-02 2.000000e-03
3.250000e+02 3.150000e+02 2.659854e+02 3.838378e-02 2.000000e-03
3.350000e+02 3.150000e+02 2.634348e+02 3.720601e-02 2.000000e-03
3.450000e+02 3.150000e+02 2.606614e+02 3.509582e-02 2.000000e-03
3.550000e+02 3.150000e+02 2.576947e+02 3.221210e-02 2.000000e-03
3.650000e+02 3.150000e+02 2.545655e+02 2.883800e-02 2.000000e-03
3.750000e+02 3.150000e+02 2.513052e+02 2.529472e-02 2.000000e-03
1.050000e+02 3.250000e+02 2.427601e+02 1.133669e-02 2.000000e-03
1.150000e+02 3.250000e+02 2.460869e+02 1.336098e-02 2.000000e-03
1.250000e+02 3.250000e+02 2.493475e+02 1.566903e-02 2.000000e-03
1.350000e+02 3.250000e+02 2.525115e+02 1.818275e-02 2.000000e-03
1.450000e+02 3.250000e+02 2.555483e+02 2.076366e-02 2.000000e-03
1.550000e+02 3.250000e+02 2.584275e+02 2.322337e-02 2.000000e-03
1.650000e+02 3.250000e+02 2.611190e+02 2.535788e-02 2.000000e-03
1.750000e+02 3.250000e+02 2.635942e+02 2.700472e-02 2.000000e-03
1.850000e+02 3.250000e+02 2.658260e+02 2.809600e-02 2.000000e-03
1.950000e+02 3.250000e+02 2.677892e+02 2.867004e-02 2.000000e-03
2.050000e+02 3.250000e+02 2.694617e+02 2.884924e-02 2.000000e-03
2.150000e+02 3.250000e+02 2.708240e+02 2.879968e-02 2.000000e-03
2.250000e+02 3.250000e+02 2.718600e+02 2.868793e-02 2.000000e-03
2.350000e+02 3.250000e+02 2.725577e+02 2.865140e-02 2.000000e-03
2.450000e+02 3.250000e+02 2.729086e+02 2.878238e-02 2.000000e-03
2.550000e+02 3.250000e+02 2.729086e+02 2.912579e-02 2.000000e-03
2.650000e+02 3.250000e+02 2.725577e+02 2.968094e-02 2.000000e-03
2.750000e+02 3.250000e+02 2.718600e+02 3.040166e-02 2.000000e-03
2.850000e+02 3.250000e+02 2.708240e+02 3.119605e-02 2.000000e-03
2.950000e+02 3.250000e+02 2.694617e+02 3.192918e-02 2.000000e-03
3.050000e+02 3.250000e+02 2.677892e+02 3.243227e-02 2.000000e-03
3.150000e+02 3.250000e+02 2.658260e+02 3.252519e-02 2.000000e-03
3.250000e+02 3.250000e+02 2.635942e+02 3.205254e-02 2.000000e-03
3.350000e+02 3.250000e+02 2.611190e+02 3.092642e-02 2.000000e-03
3.450000e+02 3.250000e+02 2.584275e+02 2.915945e-02 2.000000e-03
3.550000e+02 3.250000e+02 2.555483e+02 2.686725e-02 2.000000e-03
3.650000e+02 3.250000e+02 2.525115e+02 2.423840e-02 2.000000e-03
3.750000e+02 3.250000e+02 2.493475e+02 2.148640e-02 2.000000e-03
1.050000e+02 3.350000e+02 2.408312e+02 9.941922e-03 2.000000e-03
1.150000e+02 3.350000e+02 2.440469e+02 1.156254e-02 2.000000e-03
1.250000e+02 3.350000e+02 2.471986e+02 1.338630e-02 2.000000e-03
1.350000e+02 3.350000e+02 2.502569e+02 1.535354e-02 2.000000e-03
1.450000e+02 3.350000e+02 2.531923e+02 1.736823e-02 2.000000e-03
1.550000e+02 3.350000e+02 2.559753e+02 1.930648e-02 2.000000e-03
1.650000e+02 3.350000e+02 2.585770e+02 2.103686e-02 2.000000e-03
1.750000e+02 3.350000e+02 2.609695e+02 2.245160e-02 2.000000e-03
1.850000e+02 3.350000e+02 2.631267e+02 2.349602e-02 2.000000e-03
1.950000e+02 3.350000e+02 2.650244e+02 2.418070e-02 2.000000e-03
2.050000e+02 3.350000e+02 2.666411e+02 2.457191e-02 2.000000e-03
2.150000e+02 3.350000e+02 2.679578e+02 2.476979e-02 2.000000e-03
2.250000e+02 3.350000e+02 2.689593e+02 2.488188e-02 2.000000e-03
2.350000e+02 3.350000e+02 2.696337e+02 2.500175e-02 2.000000e-03
2.450000e+02 3.350000e+02 2.699729e+02 2.519563e-02 2.000000e-03
2.550000e+02 3.350000e+02 2.699729e+02 2.549683e-02 2.000000e-03
2.650000e+02 3.350000e+02 2.696337e+02 2.590408e-02 2.000000e-03
2.750000e+02 3.350000e+02 2.689593e+02 2.638174e-02 2.000000e-03
2.850000e+02 3.350000e+02 2.679578e+02 2.686149e-02 2.000000e-03
2.950000e+02 3.350000e+02 2.666411e+02 2.724651e-02 2.000000e-03
3.050000e+02 3.350000e+02 2.650244e+02 2.742183e-02 2.000000e-03
3.150000e+02 3.350000e+02 2.631267e+02 2.727229e-02 2.000000e-03
3.250000e+02 3.350000e+02 2.609695e+02 2.670598e-02 2.000000e-03
3.350000e+02 3.350000e+02 2.585770e+02 2.567965e-02 2.000000e-03
3.450000e+02 3.350000e+02 2.559753e+02 2.421447e-02 2.000000e-03
3.550000e+02 3.350000e+02 2.531923e+02 2.239399e-02 2.000000e-03
3.650000e+02 3.350000e+02 2.502569e+02 2.034502e-02 2.000000e-03
3.750000e+02 3.350000e+02 2.471986e+02 1.821014e-02 2.000000e-03
1.050000e+02 3.450000e+02 2.387514e+02 8.700295e-03 2.000000e-03
1.150000e+02 3.450000e+02 2.418474e+02 9.994043e-03 2.000000e-03
1.250000e+02 3.450000e+02 2.448817e+02 1.143375e-02 2.000000e-03
1.350000e+02 3.450000e+02 2.478261e+02 1.297678e-02 2.000000e-03
1.450000e+02 3.450000e+02 2.506521e+02 1.455633e-02 2.000000e-03
1.550000e+02 3.450000e+02 2.533315e+02 1.609073e-02 2.000000e-03
1.650000e+02 3.450000e+02 2.558362e+02 1.749413e-02 2.000000e-03
1.750000e+02 3.450000e+02 2.581396e+02 1.869352e-02 2.000000e-03
1.850000e+02 3.450000e+02 2.602165e+02 1.964746e-02 2.000000e-03
1.950000e+02 3.450000e+02 2.620435e+02 2.035288e-02 2.000000e-03
2.050000e+02 3.450000e+02 2.635999e+02 2.084311e-02 2.000000e-03
2.150000e+02 3.450000e+02 2.648676e+02 2.117625e-02 2.000000e-03
2.250000e+02 3.450000e+02 2.658318e+02 2.141826e-02 2.000000e-03
2.350000e+02 3.450000e+02 2.664810e+02 2.162950e-02 2.000000e-03
2.450000e+02 3.450000e+02 2.668076e+02 2.185433e-02 2.000000e-03
2.550000e+02 3.450000e+02 2.668076e+02 2.211540e-02 2.000000e-03
2.650000e+02 3.450000e+02 2.664810e+02 2.241087e-02 2.000000e-03
2.750000e+02 3.450000e+02 2.658318e+02 2.271456e-02 2.000000e-03
2.850000e+02 3.450000e+02 2.648676e+02 2.297828e-02 2.000000e-03
2.950000e+02 3.450000e+02 2.635999e+02 2.313594e-02 2.000000e-03
3.050000e+02 3.450000e+02 2.620435e+02 2.311177e-02 2.000000e-03
3.150000e+02 3.450000e+02 2.602165e+02 2.283466e-02 2.000000e-03
3.250000e+02 3.450000e+02 2.581396e+02 2.225286e-02 2.000000e-03
3.350000e+02 3.450000e+02 2.558362e+02 2.134775e-02 2.000000e-03
3.450000e+02 3.450000e+02 2.533315e+02 2.014201e-02 2.000000e-03
3.550000e+02 3.450000e+02 2.506521e+02 1.869606e-02 2.000000e-03
3.650000e+02 3.450000e+02 2.478261e+02 1.709628e-02 2.000000e-03
3.750000e+02 3.450000e+02 2.448817e+02 1.543918e-02 2.000000e-03
1.050000e+02 3.550000e+02 2.365428e+02 7.613911e-03 2.000000e-03
1.150000e+02 3.550000e+02 2.395115e+02 8.647298e-03 2.000000e-03
1.250000e+02 3.550000e+02 2.424211e+02 9.786237e-03 2.000000e-03
1.350000e+02 3.550000e+02 2.452446e+02 1.100079e-02 2.000000e-03
1.450000e+02 3.550000e+02 2.479545e+02 1.224611e-02 2.000000e-03
1.550000e+02 3.550000e+02 2.505237e+02 1.346689e-02 2.000000e-03
1.650000e+02 3.550000e+02 2.529255e+02 1.460571e-02 2.000000e-03
1.750000e+02 3.550000e+02 2.551343e+02 1.561255e-02 2.000000e-03
1.850000e+02 3.550000e+02 2.571258e+02 1.645653e-02 2.000000e-03
1.950000e+02 3.550000e+02 2.588778e+02 1.712919e-02 2.000000e-03
2.050000e+02 3.550000e+02 2.603702e+02 1.764484e-02 2.000000e-03
2.150000e+02 3.550000e+02 2.615858e+02 1.803522e-02 2.000000e-03
2.250000e+02 3.550000e+02 2.625104e+02 1.833890e-02 2.000000e-03
2.350000e+02 3.550000e+02 2.631330e+02 1.859274e-02 2.000000e-03
2.450000e+02 3.550000e+02 2.634461e+02 1.882440e-02 2.000000e-03
2.550000e+02 3.550000e+02 2.634461e+02 1.904792e-02 2.000000e-03
2.650000e+02 3.550000e+02 2.631330e+02 1.926108e-02 2.000000e-03
2.750000e+02 3.550000e+02 2.625104e+02 1.944546e-02 2.000000e-03
2.850000e+02 3.550000e+02 2.615858e+02 1.956845e-02 2.000000e-03
2.950000e+02 3.550000e+02 2.603702e+02 1.958670e-02 2.000000e-03
3.050000e+02 3.550000e+02 2.588778e+02 1.945233e-02 2.000000e-03
3.150000e+02 3.550000e+02 2.571258e+02 1.912335e-02 2.000000e-03
3.250000e+02 3.550000e+02 2.551343e+02 1.857233e-02 2.000000e-03
3.350000e+02 3.550000e+02 2.529255e+02 1.779329e-02 2.000000e-03
3.450000e+02 3.550000e+02 2.505237e+02 1.680720e-02 2.000000e-03
3.550000e+02 3.550000e+02 2.479545e+02 1.565863e-02 2.000000e-03
3.650000e+02 3.550000e+02 2.452446e+02 1.440777e-02 2.000000e-03
3.750000e+02 3.550000e+02 2.424211e+02 1.311967e-02 2.000000e-03
1.050000e+02 3.650000e+02 2.342278e+02 6.675879e-03 2.000000e-03
1.150000e+02 3.650000e+02 2.370632e+02 7.501534e-03 2.000000e-03
1.250000e+02 3.650000e+02 2.398421e+02 8.406384e-03 2.000000e-03
1.350000e+02 3.650000e+02 2.425387e+02 9.366917e-03 2.000000e-03
1.450000e+02 3.650000e+02 2.451270e+02 1.035317e-02 2.000000e-03
1.550000e+02 3.650000e+02 2.475808e+02 1.132872e-02 2.000000e-03
1.650000e+02 3.650000e+02 2.498748e+02 1.225382e-02 2.000000e-03
1.750000e+02 3.650000e+02 2.519843e+02 1.309303e-02 2.000000e-03
1.850000e+02 3.650000e+02 2.538864e+02 1.382311e-02 2.000000e-03
1.950000e+02 3.650000e+02 2.555596e+02 1.443470e-02 2.000000e-03
2.050000e+02 3.650000e+02 2.569850e+02 1.493134e-02 2.000000e-03
2.150000e+02 3.650000e+02 2.581461e+02 1.532861e-02 2.000000e-03
2.250000e+02 3.650000e+02 2.590291e+02 1.564824e-02 2.000000e-03
2.350000e+02 3.650000e+02 2.596237e+02 1.591135e-02 2.000000e-03
2.450000e+02 3.650000e+02 2.599228e+02 1.613371e-02 2.000000e-03
2.550000e+02 3.650000e+02 2.599228e+02 1.632286e-02 2.000000e-03
2.650000e+02 3.650000e+02 2.596237e+02 1.647652e-02 2.000000e-03
2.750000e+02 3.650000e+02 2.590291e+02 1.658239e-02 2.000000e-03
2.850000e+02 3.650000e+02 2.581461e+02 1.661913e-02 2.000000e-03
2.950000e+02 3.650000e+02 2.569850e+02 1.655899e-02 2.000000e-03
3.050000e+02 3.650000e+02 2.555596e+02 1.637349e-02 2.000000e-03
3.150000e+02 3.650000e+02 2.538864e+02 1.603953e-02 2.000000e-03
3.250000e+02 3.650000e+02 2.519843e+02 1.554295e-02 2.000000e-03
3.350000e+02 3.650000e+02 2.498748e+02 1.488428e-02 2.000000e-03
3.450000e+02 3.650000e+02 2.475808e+02 1.408257e-02 2.000000e-03
3.550000e+02 3.650000e+02 2.451270e+02 1.317151e-02 2.000000e-03
3.650000e+02 3.650000e+02 2.425387e+02 1.219236e-02 2.000000e-03
3.750000e+02 3.650000e+02 2.398421e+02 1.118891e-02 2.000000e-03
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

File diff suppressed because it is too large Load Diff
+235
View File
@@ -0,0 +1,235 @@
import re, os
from SimPEG import Mesh, np
import BaseGrav, Gravity
class GravityDriver_Inv(object):
"""docstring for GravityDriver_Inv"""
def __init__(self, input_file=None):
if input_file is not None:
self.basePath = os.path.sep.join(input_file.split(os.path.sep)[:-1])
if len(self.basePath) > 0:
self.basePath += os.path.sep
self.readDriverFile(input_file.split(os.path.sep)[-1])
def readDriverFile(self, input_file):
"""
Read input files for forward modeling GRAV data with integral form
INPUT:
input_file: File name containing the forward parameter
OUTPUT:
mshfile
obsfile
topofile
start model
ref model
weightfile
chi_target
as, ax ,ay, az
upper, lower bounds
lp, lqx, lqy, lqz
eps_p, eps_q
# All files should be in the working directory, otherwise the path must
# be specified.
"""
fid = open(self.basePath + input_file,'r')
# Line 1
line = fid.readline()
l_input = line.split('!')
mshfile = l_input[0].rstrip()
# Line 2
line = fid.readline()
l_input = line.split('!')
obsfile = l_input[0].rstrip()
# Line 3
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input=='null':
topofile = []
else:
topofile = l_input[0].rstrip()
# Line 4
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input[0]=='VALUE':
mstart = float(l_input[1])
else:
mstart = l_input[0].rstrip()
# Line 5
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input[0]=='VALUE':
mref = float(l_input[1])
else:
mref = l_input[0].rstrip()
# Line 6
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input=='DEFAULT':
wgtfile = []
else:
wgtfile = l_input[0].rstrip()
# Line 7
line = fid.readline()
l_input = re.split('[!\s]',line)
chi = float(l_input[0])
# Line 8
line = fid.readline()
l_input = re.split('[!\s]',line)
val = np.array(l_input[0:4])
alphas = val.astype(np.float)
# Line 9
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input[0]=='VALUE':
val = np.array(l_input[1:3])
bounds = val.astype(np.float)
else:
bounds = l_input[0].rstrip()
# Line 10
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input[0]=='VALUE':
val = np.array(l_input[1:6])
lpnorms = val.astype(np.float)
else:
lpnorms = l_input[0].rstrip()
# Line 11
line = fid.readline()
l_input = re.split('[!\s]',line)
if l_input[0]=='VALUE':
val = np.array(l_input[1:3])
eps = val.astype(np.float)
else:
eps = l_input[0].rstrip()
self.mshfile = mshfile
self.obsfile = obsfile
self.topofile = topofile
self.mstart = mstart
self._mrefInput = mref
self.wgtfile = wgtfile
self.chi = chi
self.alphas = alphas
self.bounds = bounds
self.lpnorms = lpnorms
self.eps = eps
@property
def mesh(self):
if getattr(self, '_mesh', None) is None:
self._mesh = Mesh.TensorMesh.readUBC(self.basePath + self.mshfile)
return self._mesh
@property
def survey(self):
if getattr(self, '_survey', None) is None:
self._survey = self.readGravityObservations(self.obsfile)
return self._survey
@property
def activeCells(self):
if getattr(self, '_activeCells', None) is None:
if self.topofile == 'null':
self._activeCells = np.arange(mesh.nC)
else:
topo = np.genfromtxt(self.basePath + self.topofile, skip_header=1)
# Find the active cells
self._activeCells = Gravity.getActiveTopo(self.mesh,topo,'N')
return self._activeCells
@property
def nC(self):
if getattr(self, '_nC', None) is None:
self._nC = len(self.activeCells)
return self._nC
@property
def m0(self):
if getattr(self, '_m0', None) is None:
if isinstance(self.mstart, float):
self._m0 = np.ones(self.nC) * self.mstart
else:
self._m0 = Utils.meshutils.readUBCTensorModel(self.basePath + self.mstart,self.mesh)
self._m0 = self._m0[self.activeCells]
return self._m0
@property
def mref(self):
if getattr(self, '_mref', None) is None:
if isinstance(self._mrefInput, float):
self._mref = np.ones(self.nC) * self._mrefInput
else:
self._mref = Utils.meshutils.readUBCTensorModel(self.basePath + self._mrefInput, self.mesh)
self._mref = self._mref[self.activeCells]
return self._mref
def readGravityObservations(self, obs_file):
"""
Read UBC grav file format
INPUT:
:param fileName, path to the UBC obs grav file
OUTPUT:
:param survey
"""
fid = open(obs_file,'r')
# First line has the number of rows
line = fid.readline()
ndat = np.array(line.split(),dtype=int)
# Pre-allocate space for obsx, obsy, obsz, data, uncert
line = fid.readline()
temp = np.array(line.split(),dtype=float)
d = np.zeros(ndat, dtype=float)
wd = np.zeros(ndat, dtype=float)
locXYZ = np.zeros( (ndat,3), dtype=float)
for ii in range(ndat):
temp = np.array(line.split(),dtype=float)
locXYZ[ii,:] = temp[:3]
d[ii] = temp[3]
wd[ii] = temp[4]
line = fid.readline()
rxLoc = BaseGrav.RxObs(locXYZ)
srcField = BaseGrav.SrcField([rxLoc])
survey = BaseGrav.LinearSurvey(srcField)
survey.dobs = d
survey.std = wd
return survey
+1
View File
@@ -4,3 +4,4 @@ import Magnetics
import BaseGrav
import Gravity
import MagneticsDriver
import GravityDriver