mirror of
https://github.com/wassname/simpeg.git
synced 2026-06-30 18:16:21 +08:00
Separate out the input files.
This commit is contained in:
+5
-6
@@ -117,7 +117,7 @@ class LinearSurvey(Survey.BaseSurvey):
|
||||
|
||||
def eval(self, u):
|
||||
return u
|
||||
|
||||
|
||||
@property
|
||||
def nD(self):
|
||||
return self.prob.G.shape[0]
|
||||
@@ -137,9 +137,8 @@ class SrcField(Survey.BaseSrc):
|
||||
|
||||
param = None #: Inducing field param (Amp, Incl, Decl)
|
||||
|
||||
def __init__(self, rxList, param = None, **kwargs):
|
||||
self.param = param
|
||||
super(SrcField, self).__init__(rxList, **kwargs)
|
||||
def __init__(self, rxList, **kwargs):
|
||||
super(SrcField, self).__init__(rxList, **kwargs)
|
||||
|
||||
class RxObs(Survey.BaseRx):
|
||||
"""A station location must have be located in 3-D"""
|
||||
@@ -185,10 +184,10 @@ class WeightMap(Maps.IdentityMap):
|
||||
self.mesh = None
|
||||
self.weight = weight
|
||||
|
||||
def _transform(self, m):
|
||||
def _transform(self, m):
|
||||
return m*self.weight
|
||||
|
||||
def deriv(self, m):
|
||||
return Utils.sdiag(self.weight)
|
||||
return Utils.sdiag(self.weight)
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +1,12 @@
|
||||
#%%
|
||||
from SimPEG import *
|
||||
import simpegPF as PF
|
||||
import pylab as plt
|
||||
|
||||
import os
|
||||
|
||||
#home_dir = 'C:\Users\dominiquef.MIRAGEOSCIENCE\Documents\GIT\SimPEG\simpegpf\simpegPF\Dev'
|
||||
#home_dir = 'C:\\Users\\dominiquef.MIRAGEOSCIENCE\\ownCloud\\Research\\Modelling\\Synthetic\\Nut_Cracker\\Induced_MAG3C'
|
||||
home_dir = '.\\'
|
||||
#home_dir = '.\\'
|
||||
|
||||
inpfile = 'PYMAG3D_inv.inp'
|
||||
|
||||
dsep = '\\'
|
||||
os.chdir(home_dir)
|
||||
## New scripts to be added to basecode
|
||||
#from fwr_MAG_data import fwr_MAG_data
|
||||
#from read_MAGfwr_inp import read_MAGfwr_inp
|
||||
plt.close('all')
|
||||
#%%
|
||||
# Read input file
|
||||
[mshfile, obsfile, topofile, mstart, mref, magfile, wgtfile, chi, alphas, bounds, lpnorms] = PF.Magnetics.read_MAGinv_inp(home_dir + dsep + inpfile)
|
||||
|
||||
# Load mesh file
|
||||
mesh = Mesh.TensorMesh.readUBC(mshfile)
|
||||
#mesh = Utils.meshutils.readUBCTensorMesh(mshfile)
|
||||
|
||||
# Load in observation file
|
||||
survey = PF.Magnetics.readUBCmagObs(obsfile)
|
||||
driver = PF.MagneticsIO.MagneticsDriver_Inv('PYMAG3D_inv.inp')
|
||||
mesh = driver.mesh
|
||||
survey = driver.survey
|
||||
|
||||
rxLoc = survey.srcField.rxList[0].locs
|
||||
d = survey.dobs
|
||||
@@ -38,48 +17,24 @@ ndata = survey.srcField.rxList[0].locs.shape[0]
|
||||
beta_in = 1e+5
|
||||
eps_p = 1e-4
|
||||
eps_q = 1e-4
|
||||
# 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.ActiveCells(mesh, actv, -100)
|
||||
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 = Utils.meshutils.readUBCTensorModel(mstart,mesh)
|
||||
mstart = mstart[actv]
|
||||
mstart = driver.m0
|
||||
|
||||
# Load reference file
|
||||
if isinstance(mref, float):
|
||||
mref = np.ones(nC) * mref
|
||||
else:
|
||||
mref = Utils.meshutils.readUBCTensorModel(mref,mesh)
|
||||
mref = mref[actv]
|
||||
|
||||
mref = driver.mref
|
||||
|
||||
# Get magnetization vector for MOF
|
||||
if magfile=='DEFAULT':
|
||||
|
||||
M_xyz = PF.Magnetics.dipazm_2_xyz(np.ones(nC) * survey.srcField.param[1], np.ones(nC) * survey.srcField.param[2])
|
||||
|
||||
else:
|
||||
M_xyz = np.genfromtxt(magfile,delimiter=' \n',dtype=np.str,comments='!')
|
||||
M_xyz = driver.magnetizationModel
|
||||
|
||||
# Get index of the center
|
||||
midx = int(mesh.nCx/2)
|
||||
@@ -95,17 +50,15 @@ midy = int(mesh.nCy/2)
|
||||
PF.Magnetics.plot_obs_2D(rxLoc,d,'Observed Data')
|
||||
|
||||
#%% Run inversion
|
||||
prob = PF.Magnetics.MagneticIntegral(mesh, mapping = idenMap, actInd = actv)
|
||||
prob = PF.Magnetics.MagneticIntegral(mesh, mapping=idenMap, actInd=actv)
|
||||
prob.solverOpts['accuracyTol'] = 1e-4
|
||||
|
||||
#survey = Survey.LinearSurvey()
|
||||
survey.pair(prob)
|
||||
#survey.makeSyntheticData(data, std=0.01)
|
||||
#survey.dobs=d
|
||||
#survey.mtrue = model
|
||||
# Write out the predicted
|
||||
pred = prob.fields(mstart)
|
||||
PF.Magnetics.writeUBCobs(home_dir + dsep + 'Pred.dat',survey,pred)
|
||||
PF.Magnetics.writeUBCobs('Pred.dat', survey, pred)
|
||||
|
||||
wr = np.sum(prob.G**2.,axis=0)**0.5 / mesh.vol[actv]
|
||||
wr = ( wr/np.max(wr) )
|
||||
@@ -113,28 +66,28 @@ wr_out = actvMap * wr
|
||||
|
||||
plt.figure()
|
||||
ax = plt.subplot()
|
||||
mesh.plotSlice(wr_out, ax = ax, normal = 'Y', ind=midx ,clim = (-1e-3, wr.max()))
|
||||
mesh.plotSlice(wr_out, ax=ax, normal='Y', ind=midx ,clim=(-1e-3, wr.max()))
|
||||
plt.title('Distance weighting')
|
||||
plt.xlabel('x');plt.ylabel('z')
|
||||
plt.gca().set_aspect('equal', adjustable='box')
|
||||
|
||||
reg = Regularization.Simple(mesh, indActive = actv, mapping = idenMap)
|
||||
reg = Regularization.Simple(mesh, indActive=actv, mapping=idenMap)
|
||||
reg.mref = mref
|
||||
reg.wght = wr
|
||||
#reg.alpha_s = 1.
|
||||
|
||||
# Create pre-conditioner
|
||||
# Create pre-conditioner
|
||||
diagA = np.sum(prob.G**2.,axis=0) + beta_in*(reg.W.T*reg.W).diagonal()
|
||||
PC = Utils.sdiag(diagA**-1.)
|
||||
|
||||
|
||||
dmis = DataMisfit.l2_DataMisfit(survey)
|
||||
dmis.Wd = 1/wd
|
||||
opt = Optimization.ProjectedGNCG(maxIter=10,lower=0.,upper=1., maxIterCG= 20, tolCG = 1e-3)
|
||||
opt = Optimization.ProjectedGNCG(maxIter=10,lower=0.,upper=1., maxIterCG= 20, tolCG=1e-3)
|
||||
opt.approxHinv = PC
|
||||
|
||||
# opt = Optimization.InexactGaussNewton(maxIter=6)
|
||||
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta = beta_in)
|
||||
invProb = InvProblem.BaseInvProblem(dmis, reg, opt, beta=beta_in)
|
||||
beta = Directives.BetaSchedule(coolingFactor=2, coolingRate=1)
|
||||
#betaest = Directives.BetaEstimate_ByEig()
|
||||
target = Directives.TargetMisfit()
|
||||
@@ -157,7 +110,7 @@ pred = prob.fields(mrec)
|
||||
#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 "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
|
||||
|
||||
#%% Plot out a section of the model
|
||||
|
||||
@@ -196,7 +149,7 @@ reg.mref = mref
|
||||
reg.wght = wr
|
||||
reg.eps_p = eps_p
|
||||
reg.eps_q = eps_q
|
||||
reg.norms = lpnorms
|
||||
reg.norms = driver.lpnorms
|
||||
|
||||
|
||||
diagA = np.sum(prob.G**2.,axis=0) + beta_in*(reg.W.T*reg.W).diagonal()
|
||||
@@ -234,7 +187,7 @@ pred = prob.fields(mrec)
|
||||
#%% Plot obs data
|
||||
PF.Magnetics.plot_obs_2D(rxLoc,pred,'Predicted Data')
|
||||
PF.Magnetics.plot_obs_2D(rxLoc,d,'Observed Data')
|
||||
print "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
|
||||
print "Final misfit:" + str(np.sum( ((d-pred)/wd)**2. ) )
|
||||
#%% Plot out a section of the model
|
||||
|
||||
yslice = midx
|
||||
@@ -260,4 +213,7 @@ 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.gca().set_aspect('equal', adjustable='box')
|
||||
|
||||
|
||||
plt.show()
|
||||
|
||||
@@ -13,13 +13,11 @@ def spheremodel(mesh, x0, y0, z0, r):
|
||||
ind = np.sqrt( (mesh.gridCC[:,0]-x0)**2+(mesh.gridCC[:,1]-y0)**2+(mesh.gridCC[:,2]-z0)**2 ) < r
|
||||
return ind
|
||||
|
||||
|
||||
|
||||
def MagSphereAnaFun(x, y, z, R, x0, y0, z0, mu1, mu2, H0, flag='total'):
|
||||
"""
|
||||
test
|
||||
Analytic function for Magnetics problem. The set up here is
|
||||
magnetic sphere in whole-space assuming that the inducing field is oriented in the x-direction.
|
||||
magnetic sphere in whole-space assuming that the inducing field is oriented in the x-direction.
|
||||
|
||||
* (x0,y0,z0)
|
||||
* (x0, y0, z0 ): is the center location of sphere
|
||||
@@ -215,19 +213,19 @@ def MagSphereFreeSpace(x, y, z, R, xc, yc, zc, chi, Bo):
|
||||
z = Utils.mkvc(z)
|
||||
|
||||
nobs = len(x)
|
||||
|
||||
|
||||
Bot = np.sqrt(sum(Bo**2))
|
||||
|
||||
|
||||
mx = np.ones([nobs]) * Bo[0,0] * R**3 / 3. * chi
|
||||
my = np.ones([nobs]) * Bo[0,1] * R**3 / 3. * chi
|
||||
mz = np.ones([nobs]) * Bo[0,2] * R**3 / 3. * chi
|
||||
|
||||
M = np.c_[mx, my, mz]
|
||||
|
||||
|
||||
rx = (x - xc)
|
||||
ry = (y - yc)
|
||||
rz = (zc - z)
|
||||
|
||||
|
||||
rvec = np.c_[rx, ry, rz]
|
||||
r = np.sqrt((rx)**2+(ry)**2+(rz)**2 )
|
||||
|
||||
@@ -238,7 +236,7 @@ def MagSphereFreeSpace(x, y, z, R, xc, yc, zc, chi, Bo):
|
||||
Bz = B[:,2]
|
||||
|
||||
return Bx, By, Bz
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
hxind = [(0,25,1.3),(21, 12.5),(0,25,1.3)]
|
||||
|
||||
+2
-172
@@ -1163,6 +1163,8 @@ def getActiveTopo(mesh,topo,flag):
|
||||
"""
|
||||
import scipy.interpolate as interpolation
|
||||
|
||||
print "Please remove this function! use SimPEG.Utils.surface2ind_topo(mesh, topo, gridLoc='CC')"
|
||||
|
||||
if (flag=='N'):
|
||||
Zn = np.zeros((mesh.nNx,mesh.nNy))
|
||||
# wght = np.zeros((mesh.nNx,mesh.nNy))
|
||||
@@ -1248,61 +1250,7 @@ def plot_obs_2D(rxLoc,d = None ,varstr = 'Mag Obs', vmin = None, vmax = None, le
|
||||
plt.title(varstr)
|
||||
plt.gca().set_aspect('equal', adjustable='box')
|
||||
|
||||
def readUBCmagObs(obs_file):
|
||||
|
||||
"""
|
||||
Read and write UBC mag file format
|
||||
|
||||
INPUT:
|
||||
:param fileName, path to the UBC obs mag file
|
||||
|
||||
OUTPUT:
|
||||
:param survey
|
||||
:param M, magnetization orentiaton (MI, MD)
|
||||
|
||||
"""
|
||||
|
||||
fid = open(obs_file,'r')
|
||||
|
||||
# First line has the inclination,declination and amplitude of B0
|
||||
line = fid.readline()
|
||||
B = np.array(line.split(),dtype=float)
|
||||
|
||||
# Second line has the magnetization orientation and a flag
|
||||
line = fid.readline()
|
||||
M = np.array(line.split(),dtype=float)
|
||||
|
||||
# Third 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]
|
||||
|
||||
if len(temp) > 3:
|
||||
d[ii] = temp[3]
|
||||
|
||||
if len(temp)==5:
|
||||
wd[ii] = temp[4]
|
||||
|
||||
line = fid.readline()
|
||||
|
||||
rxLoc = MAG.RxObs(locXYZ)
|
||||
srcField = MAG.SrcField([rxLoc],(B[2],B[0],B[1]))
|
||||
survey = MAG.LinearSurvey(srcField)
|
||||
survey.dobs = d
|
||||
survey.std = wd
|
||||
return survey
|
||||
|
||||
def read_MAGfwr_inp(input_file):
|
||||
|
||||
@@ -1358,121 +1306,3 @@ def read_MAGfwr_inp(input_file):
|
||||
|
||||
return mshfile, obsfile, modfile, magfile, topofile
|
||||
|
||||
def read_MAGinv_inp(input_file):
|
||||
"""Read input files for forward modeling MAG data with integral form
|
||||
INPUT:
|
||||
input_file: File name containing the forward parameter
|
||||
|
||||
OUTPUT:
|
||||
mshfile
|
||||
obsfile
|
||||
topofile
|
||||
start model
|
||||
ref model
|
||||
mag model
|
||||
weightfile
|
||||
chi_target
|
||||
as, ax ,ay, az
|
||||
upper, lower bounds
|
||||
lp, lqx, lqy, lqz
|
||||
|
||||
# All files should be in the working directory, otherwise the path must
|
||||
# be specified.
|
||||
|
||||
Created on Dec 21th, 2015
|
||||
|
||||
@author: dominiquef
|
||||
"""
|
||||
|
||||
|
||||
fid = open(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':
|
||||
magfile = []
|
||||
|
||||
else:
|
||||
magfile = l_input[0].rstrip()
|
||||
|
||||
# Line 7
|
||||
line = fid.readline()
|
||||
l_input = re.split('[!\s]',line)
|
||||
if l_input=='DEFAULT':
|
||||
wgtfile = []
|
||||
|
||||
else:
|
||||
wgtfile = l_input[0].rstrip()
|
||||
|
||||
# Line 8
|
||||
line = fid.readline()
|
||||
l_input = re.split('[!\s]',line)
|
||||
chi = float(l_input[0])
|
||||
|
||||
# Line 9
|
||||
line = fid.readline()
|
||||
l_input = re.split('[!\s]',line)
|
||||
val = np.array(l_input[0:4])
|
||||
alphas = val.astype(np.float)
|
||||
|
||||
# Line 10
|
||||
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 11
|
||||
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()
|
||||
|
||||
return mshfile, obsfile, topofile, mstart, mref, magfile, wgtfile, chi, alphas, bounds, lpnorms
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
import re, os
|
||||
from SimPEG import Mesh, np
|
||||
import BaseMag, Magnetics
|
||||
|
||||
class MagneticsDriver_Inv(object):
|
||||
"""docstring for MagneticsDriver_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 MAG data with integral form
|
||||
INPUT:
|
||||
input_file: File name containing the forward parameter
|
||||
|
||||
OUTPUT:
|
||||
mshfile
|
||||
obsfile
|
||||
topofile
|
||||
start model
|
||||
ref model
|
||||
mag model
|
||||
weightfile
|
||||
chi_target
|
||||
as, ax ,ay, az
|
||||
upper, lower bounds
|
||||
lp, lqx, lqy, lqz
|
||||
|
||||
# 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':
|
||||
magfile = []
|
||||
|
||||
else:
|
||||
magfile = l_input[0].rstrip()
|
||||
|
||||
# Line 7
|
||||
line = fid.readline()
|
||||
l_input = re.split('[!\s]',line)
|
||||
if l_input=='DEFAULT':
|
||||
wgtfile = []
|
||||
|
||||
else:
|
||||
wgtfile = l_input[0].rstrip()
|
||||
|
||||
# Line 8
|
||||
line = fid.readline()
|
||||
l_input = re.split('[!\s]',line)
|
||||
chi = float(l_input[0])
|
||||
|
||||
# Line 9
|
||||
line = fid.readline()
|
||||
l_input = re.split('[!\s]',line)
|
||||
val = np.array(l_input[0:4])
|
||||
alphas = val.astype(np.float)
|
||||
|
||||
# Line 10
|
||||
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 11
|
||||
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()
|
||||
|
||||
self.mshfile = mshfile
|
||||
self.obsfile = obsfile
|
||||
self.topofile = topofile
|
||||
self.mstart = mstart
|
||||
self._mrefInput = mref
|
||||
self.magfile = magfile
|
||||
self.wgtfile = wgtfile
|
||||
self.chi = chi
|
||||
self.alphas = alphas
|
||||
self.bounds = bounds
|
||||
self.lpnorms = lpnorms
|
||||
|
||||
@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.readMagneticsObservations(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 = Magnetics.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
|
||||
|
||||
|
||||
@property
|
||||
def magnetizationModel(self):
|
||||
"""
|
||||
magnetization vector
|
||||
"""
|
||||
|
||||
if self.magfile == 'DEFAULT':
|
||||
return Magnetics.dipazm_2_xyz(np.ones(self.nC) * self.survey.srcField.param[1], np.ones(self.nC) * self.survey.srcField.param[2])
|
||||
|
||||
else:
|
||||
raise NotImplementedError("this will require you to read in a three column vector model")
|
||||
self._mref = Utils.meshutils.readUBCTensorModel(self.basePath + self._mrefInput, self.mesh)
|
||||
return np.genfromtxt(self.magfile,delimiter=' \n',dtype=np.str,comments='!')
|
||||
|
||||
def readMagneticsObservations(self, obs_file):
|
||||
"""
|
||||
Read and write UBC mag file format
|
||||
|
||||
INPUT:
|
||||
:param fileName, path to the UBC obs mag file
|
||||
|
||||
OUTPUT:
|
||||
:param survey
|
||||
:param M, magnetization orentiaton (MI, MD)
|
||||
"""
|
||||
|
||||
fid = open(self.basePath + obs_file,'r')
|
||||
|
||||
# First line has the inclination,declination and amplitude of B0
|
||||
line = fid.readline()
|
||||
B = np.array(line.split(),dtype=float)
|
||||
|
||||
# Second line has the magnetization orientation and a flag
|
||||
line = fid.readline()
|
||||
M = np.array(line.split(),dtype=float)
|
||||
|
||||
# Third 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]
|
||||
|
||||
if len(temp) > 3:
|
||||
d[ii] = temp[3]
|
||||
|
||||
if len(temp)==5:
|
||||
wd[ii] = temp[4]
|
||||
|
||||
line = fid.readline()
|
||||
|
||||
rxLoc = BaseMag.RxObs(locXYZ)
|
||||
srcField = BaseMag.SrcField([rxLoc],param=(B[2],B[0],B[1]))
|
||||
survey = BaseMag.LinearSurvey(srcField)
|
||||
survey.dobs = d
|
||||
survey.std = wd
|
||||
return survey
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
||||
47 47 20
|
||||
-60.00 -60.00 280.00
|
||||
50.00 30.00 20.00 41*10.00 20.00 30.00 50.00
|
||||
50.00 30.00 20.00 41*10.00 20.00 30.00 50.00
|
||||
17*10.00 20.00 30.00 50
|
||||
@@ -0,0 +1,619 @@
|
||||
90 0 50000
|
||||
90 0 1
|
||||
616
|
||||
105 155 240.831177 -0.7588417 1
|
||||
115 155 244.046936 -0.7915504 1
|
||||
125 155 247.198578 -0.805861 1
|
||||
135 155 250.256927 -0.798687 1
|
||||
145 155 253.192322 -0.7701055 1
|
||||
155 155 255.975342 -0.7241221 1
|
||||
165 155 258.576965 -0.6681905 1
|
||||
175 155 260.969513 -0.6113366 1
|
||||
185 155 263.126709 -0.5615882 1
|
||||
195 155 265.024445 -0.5237785 1
|
||||
205 155 266.641052 -0.4986475 1
|
||||
215 155 267.957825 -0.4833724 1
|
||||
225 155 268.95929 -0.4730379 1
|
||||
235 155 269.633667 -0.4623284 1
|
||||
245 155 269.9729 -0.4469757 1
|
||||
255 155 269.9729 -0.4247823 1
|
||||
265 155 269.633667 -0.39628 1
|
||||
275 155 268.95929 -0.3650762 1
|
||||
285 155 267.957825 -0.3378048 1
|
||||
295 155 266.641052 -0.3234333 1
|
||||
305 155 265.024445 -0.3316285 1
|
||||
315 155 263.126709 -0.3701661 1
|
||||
325 155 260.969513 -0.4418891 1
|
||||
335 155 258.576965 -0.5423904 1
|
||||
345 155 255.975342 -0.659748 1
|
||||
355 155 253.192322 -0.7770281 1
|
||||
365 155 250.256927 -0.8768104 1
|
||||
375 155 247.198608 -0.9458876 1
|
||||
105 165 242.760101 -0.8195894 1
|
||||
115 165 246.086945 -0.8419799 1
|
||||
125 165 249.347504 -0.8356238 1
|
||||
135 165 252.511536 -0.7963749 1
|
||||
145 165 255.54834 -0.7257527 1
|
||||
155 165 258.42749 -0.6322459 1
|
||||
165 165 261.119019 -0.5301054 1
|
||||
175 165 263.594238 -0.4354313 1
|
||||
185 165 265.825958 -0.3611376 1
|
||||
195 165 267.789246 -0.3131647 1
|
||||
205 165 269.4617 -0.2895989 1
|
||||
215 165 270.823975 -0.2825252 1
|
||||
225 165 271.860046 -0.281212 1
|
||||
235 165 272.557739 -0.2751351 1
|
||||
245 165 272.90863 -0.2561399 1
|
||||
255 165 272.90863 -0.2197196 1
|
||||
265 165 272.557739 -0.1658328 1
|
||||
275 165 271.860046 -0.09951203 1
|
||||
285 165 270.823975 -0.03119349 1
|
||||
295 165 269.4617 0.0236968 1
|
||||
305 165 267.789246 0.04674543 1
|
||||
315 165 265.825958 0.02064035 1
|
||||
325 165 263.594238 -0.06508273 1
|
||||
335 165 261.119019 -0.208611 1
|
||||
345 165 258.42749 -0.393637 1
|
||||
355 165 255.54834 -0.5925498 1
|
||||
365 165 252.511536 -0.7744437 1
|
||||
375 165 249.347534 -0.9143868 1
|
||||
105 175 244.517365 -0.8731715 1
|
||||
115 175 247.945435 -0.8756285 1
|
||||
125 175 251.305176 -0.83312 1
|
||||
135 175 254.56546 -0.739917 1
|
||||
145 175 257.694702 -0.6004066 1
|
||||
155 175 260.661377 -0.4314286 1
|
||||
165 175 263.434845 -0.2595249 1
|
||||
175 175 265.985352 -0.1129547 1
|
||||
185 175 268.284973 -0.01194964 1
|
||||
195 175 270.307983 0.03755872 1
|
||||
205 175 272.031311 0.04395232 1
|
||||
215 175 273.435028 0.0249682 1
|
||||
225 175 274.502655 0.001294248 1
|
||||
235 175 275.221558 -0.008426053 1
|
||||
245 175 275.58313 0.009649532 1
|
||||
255 175 275.58313 0.0634047 1
|
||||
265 175 275.221558 0.154099 1
|
||||
275 175 274.502655 0.2754614 1
|
||||
285 175 273.435028 0.4125105 1
|
||||
295 175 272.031311 0.5409548 1
|
||||
305 175 270.307983 0.6288864 1
|
||||
315 175 268.284973 0.6424912 1
|
||||
325 175 265.985352 0.5560076 1
|
||||
335 175 263.434845 0.3630851 1
|
||||
345 175 260.661377 0.08384954 1
|
||||
355 175 257.694702 -0.237926 1
|
||||
365 175 254.56546 -0.548451 1
|
||||
375 175 251.305176 -0.8018905 1
|
||||
105 185 246.083527 -0.9140503 1
|
||||
115 185 249.601807 -0.8826051 1
|
||||
125 185 253.049957 -0.7811191 1
|
||||
135 185 256.396027 -0.6012919 1
|
||||
145 185 259.607605 -0.3526822 1
|
||||
155 185 262.652374 -0.06704467 1
|
||||
165 185 265.498779 0.2074117 1
|
||||
175 185 268.116394 0.4220746 1
|
||||
185 185 270.476563 0.5463553 1
|
||||
195 185 272.552795 0.5775926 1
|
||||
205 185 274.321503 0.5378997 1
|
||||
215 185 275.762146 0.4625557 1
|
||||
225 185 276.857849 0.3880164 1
|
||||
235 185 277.595642 0.3444396 1
|
||||
245 185 277.966797 0.3530179 1
|
||||
255 185 277.966797 0.4259006 1
|
||||
265 185 277.595642 0.5663478 1
|
||||
275 185 276.857849 0.7675966 1
|
||||
285 185 275.762146 1.010183 1
|
||||
295 185 274.321503 1.259027 1
|
||||
305 185 272.552795 1.463291 1
|
||||
315 185 270.476563 1.563029 1
|
||||
325 185 268.116394 1.504866 1
|
||||
335 185 265.498779 1.263533 1
|
||||
345 185 262.652374 0.8593219 1
|
||||
355 185 259.607605 0.3588987 1
|
||||
365 185 256.396027 -0.1463404 1
|
||||
375 185 253.049988 -0.5744338 1
|
||||
105 195 247.440887 -0.9365266 1
|
||||
115 195 251.037354 -0.8525355 1
|
||||
125 195 254.562134 -0.6607845 1
|
||||
135 195 257.982544 -0.3485086 1
|
||||
145 195 261.265472 0.06623109 1
|
||||
155 195 264.37793 0.5262602 1
|
||||
165 195 267.287598 0.9466072 1
|
||||
175 195 269.963379 1.245725 1
|
||||
185 195 272.375977 1.379536 1
|
||||
195 195 274.498352 1.355977 1
|
||||
205 195 276.306335 1.223446 1
|
||||
215 195 277.778992 1.046257 1
|
||||
225 195 278.899048 0.8838316 1
|
||||
235 195 279.653259 0.7809416 1
|
||||
245 195 280.032623 0.7668838 1
|
||||
255 195 280.032623 0.8582527 1
|
||||
265 195 279.653259 1.060967 1
|
||||
275 195 278.899048 1.369147 1
|
||||
285 195 277.778992 1.760239 1
|
||||
295 195 276.306335 2.187949 1
|
||||
305 195 274.498352 2.577668 1
|
||||
315 195 272.375977 2.831963 1
|
||||
325 195 269.963379 2.852671 1
|
||||
335 195 267.287598 2.577787 1
|
||||
345 195 264.37793 2.01826 1
|
||||
355 195 261.265472 1.27011 1
|
||||
365 195 257.982544 0.4833555 1
|
||||
375 195 254.562134 -0.2003685 1
|
||||
105 205 248.573853 -0.9364405 1
|
||||
115 205 252.235565 -0.7778356 1
|
||||
125 205 255.82428 -0.4572914 1
|
||||
135 205 259.306763 0.0458342 1
|
||||
145 205 262.649292 0.7008426 1
|
||||
155 205 265.818176 1.409817 1
|
||||
165 205 268.78067 2.028682 1
|
||||
175 205 271.505005 2.42519 1
|
||||
185 205 273.961365 2.539679 1
|
||||
195 205 276.122253 2.404351 1
|
||||
205 205 277.963074 2.113149 1
|
||||
215 205 279.462433 1.774462 1
|
||||
225 205 280.602814 1.47808 1
|
||||
235 205 281.370697 1.284939 1
|
||||
245 205 281.756958 1.231368 1
|
||||
255 205 281.756958 1.337238 1
|
||||
265 205 281.370697 1.611238 1
|
||||
275 205 280.602814 2.050138 1
|
||||
285 205 279.462433 2.631077 1
|
||||
295 205 277.963074 3.2984 1
|
||||
305 205 276.122253 3.951254 1
|
||||
315 205 273.961365 4.444233 1
|
||||
325 205 271.505005 4.614739 1
|
||||
335 205 268.78067 4.339799 1
|
||||
345 205 265.818176 3.603591 1
|
||||
355 205 262.649292 2.534426 1
|
||||
365 205 259.306763 1.366716 1
|
||||
375 205 255.82431 0.3338567 1
|
||||
105 215 249.469238 -0.9136291 1
|
||||
115 215 253.182526 -0.6589502 1
|
||||
125 215 256.821808 -0.1698693 1
|
||||
135 215 260.353333 0.5874462 1
|
||||
145 215 263.74292 1.565753 1
|
||||
155 215 266.956482 2.607309 1
|
||||
165 215 269.960632 3.479923 1
|
||||
175 215 272.723358 3.978535 1
|
||||
185 215 275.214325 4.028715 1
|
||||
195 215 277.40564 3.707969 1
|
||||
205 215 279.2724 3.180547 1
|
||||
215 215 280.792847 2.615157 1
|
||||
225 215 281.94931 2.13744 1
|
||||
235 215 282.727997 1.823207 1
|
||||
245 215 283.11969 1.71236 1
|
||||
255 215 283.11969 1.825263 1
|
||||
265 215 282.727997 2.172536 1
|
||||
275 215 281.94931 2.755052 1
|
||||
285 215 280.792847 3.553031 1
|
||||
295 215 279.2724 4.505293 1
|
||||
305 215 277.40564 5.485875 1
|
||||
315 215 275.214325 6.295436 1
|
||||
325 215 272.723358 6.690773 1
|
||||
335 215 269.960632 6.463354 1
|
||||
345 215 266.956482 5.547766 1
|
||||
355 215 263.74292 4.10083 1
|
||||
365 215 260.353333 2.465151 1
|
||||
375 215 256.821838 1.000294 1
|
||||
105 225 250.116516 -0.8743188 1
|
||||
115 225 253.867065 -0.5101706 1
|
||||
125 225 257.542908 0.1755437 1
|
||||
135 225 261.109894 1.236342 1
|
||||
145 225 264.533508 2.606781 1
|
||||
155 225 267.779327 4.051729 1
|
||||
165 225 270.81366 5.220251 1
|
||||
175 225 273.604126 5.813692 1
|
||||
185 225 276.120087 5.748304 1
|
||||
195 225 278.333435 5.170528 1
|
||||
205 225 280.218872 4.338887 1
|
||||
215 225 281.754639 3.495014 1
|
||||
225 225 282.922668 2.801622 1
|
||||
235 225 283.709198 2.344926 1
|
||||
245 225 284.104828 2.16313 1
|
||||
255 225 284.104828 2.273224 1
|
||||
265 225 283.709198 2.685922 1
|
||||
275 225 282.922668 3.40649 1
|
||||
285 225 281.754639 4.420648 1
|
||||
295 225 280.218872 5.665849 1
|
||||
305 225 278.333435 6.995332 1
|
||||
315 225 276.120087 8.157348 1
|
||||
325 225 273.604126 8.82303 1
|
||||
335 225 270.81366 8.684887 1
|
||||
345 225 267.779327 7.610068 1
|
||||
355 225 264.533508 5.774337 1
|
||||
365 225 261.109894 3.638668 1
|
||||
375 225 257.542908 1.709743 1
|
||||
105 235 250.507996 -0.8317488 1
|
||||
115 235 254.281128 -0.3622331 1
|
||||
125 235 257.979034 0.5184553 1
|
||||
135 235 261.567444 1.888687 1
|
||||
145 235 265.011658 3.667592 1
|
||||
155 235 268.276978 5.534542 1
|
||||
165 235 271.32959 7.004851 1
|
||||
175 235 274.13678 7.678418 1
|
||||
185 235 276.667908 7.464011 1
|
||||
195 235 278.894531 6.593227 1
|
||||
205 235 280.791321 5.432199 1
|
||||
215 235 282.336304 4.298311 1
|
||||
225 235 283.511383 3.386243 1
|
||||
235 235 284.302643 2.786252 1
|
||||
245 235 284.700653 2.529866 1
|
||||
255 235 284.700653 2.62728 1
|
||||
265 235 284.302643 3.087025 1
|
||||
275 235 283.511383 3.917431 1
|
||||
285 235 282.336304 5.109731 1
|
||||
295 235 280.791321 6.60235 1
|
||||
305 235 278.894531 8.233635 1
|
||||
315 235 276.667908 9.70905 1
|
||||
325 235 274.13678 10.62564 1
|
||||
335 235 271.32959 10.58569 1
|
||||
345 235 268.276978 9.389627 1
|
||||
355 235 265.011658 7.223036 1
|
||||
365 235 261.567444 4.651613 1
|
||||
375 235 257.979065 2.317601 1
|
||||
105 245 250.639008 -0.8031906 1
|
||||
115 245 254.419678 -0.2567715 1
|
||||
125 245 258.125 0.7720825 1
|
||||
135 245 261.720581 2.386057 1
|
||||
145 245 265.171661 4.496398 1
|
||||
155 245 268.443542 6.708923 1
|
||||
165 245 271.502228 8.428509 1
|
||||
175 245 274.315063 9.166789 1
|
||||
185 245 276.851227 8.817329 1
|
||||
195 245 279.082336 7.692689 1
|
||||
205 245 280.98291 6.255138 1
|
||||
215 245 282.531006 4.884361 1
|
||||
225 245 283.708405 3.796578 1
|
||||
235 245 284.501251 3.0811 1
|
||||
245 245 284.900055 2.761007 1
|
||||
255 245 284.900055 2.838641 1
|
||||
265 245 284.501251 3.318654 1
|
||||
275 245 283.708405 4.209807 1
|
||||
285 245 282.531006 5.506134 1
|
||||
295 245 280.98291 7.146722 1
|
||||
305 245 279.082336 8.961084 1
|
||||
315 245 276.851227 10.62863 1
|
||||
325 245 274.315063 11.70051 1
|
||||
335 245 271.502228 11.72266 1
|
||||
345 245 268.443542 10.45331 1
|
||||
355 245 265.171661 8.084093 1
|
||||
365 245 261.720581 5.24673 1
|
||||
375 245 258.125 2.668323 1
|
||||
105 255 250.507996 -0.8032413 1
|
||||
115 255 254.281128 -0.2308932 1
|
||||
125 255 257.979034 0.8544926 1
|
||||
135 255 261.567444 2.570146 1
|
||||
145 255 265.011658 4.828936 1
|
||||
155 255 268.276978 7.205737 1
|
||||
165 255 271.32959 9.052127 1
|
||||
175 255 274.13678 9.832447 1
|
||||
185 255 276.667908 9.425632 1
|
||||
195 255 278.894531 8.181864 1
|
||||
205 255 280.791321 6.61156 1
|
||||
215 255 282.336304 5.126034 1
|
||||
225 255 283.511383 3.951786 1
|
||||
235 255 284.302643 3.176769 1
|
||||
245 255 284.700653 2.818616 1
|
||||
255 255 284.700653 2.874094 1
|
||||
265 255 284.302643 3.343708 1
|
||||
275 255 283.511383 4.233653 1
|
||||
285 255 282.336304 5.536428 1
|
||||
295 255 280.791321 7.189605 1
|
||||
305 255 278.894531 9.020029 1
|
||||
315 255 276.667908 10.70241 1
|
||||
325 255 274.13678 11.78181 1
|
||||
335 255 271.32959 11.79881 1
|
||||
345 255 268.276978 10.51058 1
|
||||
355 255 265.011658 8.114479 1
|
||||
365 255 261.567444 5.25268 1
|
||||
375 255 257.979065 2.659622 1
|
||||
105 265 250.116516 -0.8364838 1
|
||||
115 265 253.867065 -0.2987034 1
|
||||
125 265 257.542908 0.730639 1
|
||||
135 265 261.109894 2.367063 1
|
||||
145 265 264.533508 4.533685 1
|
||||
155 265 267.779327 6.832248 1
|
||||
165 265 270.81366 8.639468 1
|
||||
175 265 273.604126 9.430596 1
|
||||
185 265 276.120087 9.076918 1
|
||||
195 265 278.333435 7.902471 1
|
||||
205 265 280.218872 6.395443 1
|
||||
215 265 281.754639 4.956879 1
|
||||
225 265 282.922668 3.811898 1
|
||||
235 265 283.709198 3.049655 1
|
||||
245 265 284.104828 2.688498 1
|
||||
255 265 284.104828 2.724281 1
|
||||
265 265 283.709198 3.154537 1
|
||||
275 265 282.922668 3.980581 1
|
||||
285 265 281.754639 5.189228 1
|
||||
295 265 280.218872 6.714512 1
|
||||
305 265 278.333435 8.387216 1
|
||||
315 265 276.120087 9.900153 1
|
||||
325 265 273.604126 10.83422 1
|
||||
335 265 270.81366 10.77838 1
|
||||
345 265 267.779327 9.531084 1
|
||||
355 265 264.533508 7.293797 1
|
||||
365 265 261.109894 4.659332 1
|
||||
375 265 257.542908 2.288398 1
|
||||
105 275 249.469238 -0.8944128 1
|
||||
115 275 253.182526 -0.4425263 1
|
||||
125 275 256.821808 0.4343149 1
|
||||
135 275 260.353333 1.834889 1
|
||||
145 275 263.74292 3.697208 1
|
||||
155 275 266.956482 5.696558 1
|
||||
165 275 269.960632 7.30593 1
|
||||
175 275 272.723358 8.066821 1
|
||||
185 275 275.214325 7.854281 1
|
||||
195 275 277.40564 6.91226 1
|
||||
205 275 279.2724 5.644381 1
|
||||
215 275 280.792847 4.401628 1
|
||||
225 275 281.94931 3.394523 1
|
||||
235 275 282.727997 2.714301 1
|
||||
245 275 283.11969 2.385276 1
|
||||
255 275 283.11969 2.406946 1
|
||||
265 275 282.727997 2.775713 1
|
||||
275 275 281.94931 3.487118 1
|
||||
285 275 280.792847 4.520212 1
|
||||
295 275 279.2724 5.80555 1
|
||||
305 275 277.40564 7.185402 1
|
||||
315 275 275.214325 8.390831 1
|
||||
325 275 272.723358 9.072539 1
|
||||
335 275 269.960632 8.907607 1
|
||||
345 275 266.956482 7.763454 1
|
||||
355 275 263.74292 5.837826 1
|
||||
365 275 260.353333 3.625323 1
|
||||
375 275 256.821838 1.653854 1
|
||||
105 285 248.573853 -0.9591397 1
|
||||
115 285 252.235565 -0.6212285 1
|
||||
125 285 255.82428 0.051057 1
|
||||
135 285 259.306763 1.132654 1
|
||||
145 285 262.649292 2.578346 1
|
||||
155 285 265.818176 4.151248 1
|
||||
165 285 268.78067 5.462206 1
|
||||
175 285 271.505005 6.15344 1
|
||||
185 285 273.961365 6.103346 1
|
||||
195 285 276.122253 5.464153 1
|
||||
205 285 277.963074 4.527912 1
|
||||
215 285 279.462433 3.569985 1
|
||||
225 285 280.602814 2.771323 1
|
||||
235 285 281.370697 2.220876 1
|
||||
245 285 281.756958 1.949892 1
|
||||
255 285 281.756958 1.963643 1
|
||||
265 285 281.370697 2.258935 1
|
||||
275 285 280.602814 2.826297 1
|
||||
285 285 279.462433 3.638017 1
|
||||
295 285 277.963074 4.624463 1
|
||||
305 285 276.122253 5.647346 1
|
||||
315 285 273.961365 6.489984 1
|
||||
325 285 271.505005 6.89047 1
|
||||
335 285 268.78067 6.628548 1
|
||||
345 285 265.818176 5.643015 1
|
||||
355 285 262.649292 4.113403 1
|
||||
365 285 259.306763 2.412046 1
|
||||
375 285 255.82431 0.9149938 1
|
||||
105 295 247.440887 -1.011423 1
|
||||
115 295 251.037354 -0.7896024 1
|
||||
125 295 254.562134 -0.3250723 1
|
||||
135 295 257.982544 0.4339865 1
|
||||
145 295 261.265472 1.458079 1
|
||||
155 295 264.37793 2.590895 1
|
||||
165 295 267.287598 3.574395 1
|
||||
175 295 269.963379 4.158915 1
|
||||
185 295 272.375977 4.235457 1
|
||||
195 295 274.498352 3.878613 1
|
||||
205 295 276.306335 3.27391 1
|
||||
215 295 277.778992 2.615522 1
|
||||
225 295 278.899048 2.044877 1
|
||||
235 295 279.653259 1.641445 1
|
||||
245 295 280.032623 1.439964 1
|
||||
255 295 280.032623 1.450583 1
|
||||
265 295 279.653259 1.671221 1
|
||||
275 295 278.899048 2.089455 1
|
||||
285 295 277.778992 2.674484 1
|
||||
295 295 276.306335 3.36202 1
|
||||
305 295 274.498352 4.039838 1
|
||||
315 295 272.375977 4.548412 1
|
||||
325 295 269.963379 4.711965 1
|
||||
335 295 267.287598 4.401741 1
|
||||
345 295 264.37793 3.60888 1
|
||||
355 295 261.265472 2.480467 1
|
||||
365 295 257.982544 1.271313 1
|
||||
375 295 254.562134 0.2239833 1
|
||||
105 305 246.083527 -1.037815 1
|
||||
115 305 249.601807 -0.9153721 1
|
||||
125 305 253.049957 -0.6277985 1
|
||||
135 305 256.396027 -0.1413393 1
|
||||
145 305 259.607605 0.5270341 1
|
||||
155 305 262.652374 1.283511 1
|
||||
165 305 265.498779 1.970314 1
|
||||
175 305 268.116394 2.427473 1
|
||||
185 305 270.476563 2.56995 1
|
||||
195 305 272.552795 2.421773 1
|
||||
205 305 274.321503 2.085502 1
|
||||
215 305 275.762146 1.684076 1
|
||||
225 305 276.857849 1.317886 1
|
||||
235 305 277.595642 1.051018 1
|
||||
245 305 277.966797 0.9164558 1
|
||||
255 305 277.966797 0.9264848 1
|
||||
265 305 277.595642 1.080114 1
|
||||
275 305 276.857849 1.364457 1
|
||||
285 305 275.762146 1.750175 1
|
||||
295 305 274.321503 2.183568 1
|
||||
305 305 272.552795 2.581238 1
|
||||
315 305 270.476563 2.836312 1
|
||||
325 305 268.116394 2.843435 1
|
||||
335 305 265.498779 2.53956 1
|
||||
345 305 262.652374 1.942758 1
|
||||
355 305 259.607605 1.161767 1
|
||||
365 305 256.396027 0.3578575 1
|
||||
375 305 253.049988 -0.3240296 1
|
||||
105 315 244.517365 -1.033498 1
|
||||
115 315 247.945435 -0.9854098 1
|
||||
125 315 251.305176 -0.8302344 1
|
||||
135 315 254.56546 -0.5464416 1
|
||||
145 315 257.694702 -0.1422417 1
|
||||
155 315 260.661377 0.3302703 1
|
||||
165 315 263.434845 0.7810533 1
|
||||
175 315 265.985352 1.11401 1
|
||||
185 315 268.284973 1.26902 1
|
||||
195 315 270.307983 1.245204 1
|
||||
205 315 272.031311 1.091521 1
|
||||
215 315 273.435028 0.8779288 1
|
||||
225 315 274.502655 0.6689956 1
|
||||
235 315 275.221558 0.5111202 1
|
||||
245 315 275.58313 0.4313801 1
|
||||
255 315 275.58313 0.4413795 1
|
||||
265 315 275.221558 0.5408217 1
|
||||
275 315 274.502655 0.7183567 1
|
||||
285 315 273.435028 0.9495843 1
|
||||
295 315 272.031311 1.194077 1
|
||||
305 315 270.307983 1.395294 1
|
||||
315 315 268.284973 1.488117 1
|
||||
325 315 265.985352 1.416343 1
|
||||
335 315 263.434845 1.155969 1
|
||||
345 315 260.661377 0.7327568 1
|
||||
355 315 257.694702 0.2205752 1
|
||||
365 315 254.56546 -0.2842715 1
|
||||
375 315 251.305176 -0.6998433 1
|
||||
105 325 242.760101 -1.001009 1
|
||||
115 325 246.086945 -1.002393 1
|
||||
125 325 249.347504 -0.9365406 1
|
||||
135 325 252.511536 -0.7895898 1
|
||||
145 325 255.54834 -0.5643467 1
|
||||
155 325 258.42749 -0.2877616 1
|
||||
165 325 261.119019 -0.008496879 1
|
||||
175 325 263.594238 0.2185697 1
|
||||
185 325 265.825958 0.3539491 1
|
||||
195 325 267.789246 0.3879928 1
|
||||
205 325 269.4617 0.3399999 1
|
||||
215 325 270.823975 0.245651 1
|
||||
225 325 271.860046 0.1425535 1
|
||||
235 325 272.557739 0.06089945 1
|
||||
245 325 272.90863 0.02018288 1
|
||||
255 325 272.90863 0.02955809 1
|
||||
265 325 272.557739 0.08900298 1
|
||||
275 325 271.860046 0.1897431 1
|
||||
285 325 270.823975 0.3137744 1
|
||||
295 325 269.4617 0.4335785 1
|
||||
305 325 267.789246 0.5141889 1
|
||||
315 325 265.825958 0.5195781 1
|
||||
325 325 263.594238 0.423505 1
|
||||
335 325 261.119019 0.2213678 1
|
||||
345 325 258.42749 -0.06328931 1
|
||||
355 325 255.54834 -0.383331 1
|
||||
365 325 252.511536 -0.6835498 1
|
||||
375 325 249.347534 -0.9195023 1
|
||||
105 335 240.831177 -0.9470594 1
|
||||
115 335 244.046936 -0.9776354 1
|
||||
125 335 247.198578 -0.9667871 1
|
||||
135 335 250.256927 -0.9053537 1
|
||||
145 335 253.192322 -0.7932306 1
|
||||
155 335 255.975342 -0.643329 1
|
||||
165 335 258.576965 -0.4807753 1
|
||||
175 335 260.969513 -0.3357394 1
|
||||
185 335 263.126709 -0.2327569 1
|
||||
195 335 265.024445 -0.1823665 1
|
||||
205 335 266.641052 -0.1795066 1
|
||||
215 335 267.957825 -0.2082184 1
|
||||
225 335 268.95929 -0.2487825 1
|
||||
235 335 269.633667 -0.2835538 1
|
||||
245 335 269.9729 -0.300115 1
|
||||
255 335 269.9729 -0.2922643 1
|
||||
265 335 269.633667 -0.2600168 1
|
||||
275 335 268.95929 -0.209445 1
|
||||
285 335 267.957825 -0.1524777 1
|
||||
295 335 266.641052 -0.1060946 1
|
||||
305 335 265.024445 -0.08997072 1
|
||||
315 335 263.126709 -0.121989 1
|
||||
325 335 260.969513 -0.212178 1
|
||||
335 335 258.576965 -0.3573267 1
|
||||
345 335 255.975342 -0.5393556 1
|
||||
355 335 253.192322 -0.7294713 1
|
||||
365 335 250.256927 -0.8969562 1
|
||||
375 335 247.198608 -1.018534 1
|
||||
105 345 238.751434 -0.8795042 1
|
||||
115 345 241.847382 -0.9247606 1
|
||||
125 345 244.881653 -0.9446973 1
|
||||
135 345 247.82608 -0.9330818 1
|
||||
145 345 250.65213 -0.8885093 1
|
||||
155 345 253.331451 -0.8165421 1
|
||||
165 345 255.836212 -0.7295913 1
|
||||
175 345 258.139618 -0.6437526 1
|
||||
185 345 260.216461 -0.5736571 1
|
||||
195 345 262.043518 -0.5278839 1
|
||||
205 345 263.599884 -0.5071621 1
|
||||
215 345 264.867584 -0.5057246 1
|
||||
225 345 265.831787 -0.5144912 1
|
||||
235 345 266.481018 -0.5243066 1
|
||||
245 345 266.807617 -0.5281933 1
|
||||
255 345 266.807617 -0.5225207 1
|
||||
265 345 266.481018 -0.5073952 1
|
||||
275 345 265.831787 -0.4866288 1
|
||||
285 345 264.867584 -0.4673505 1
|
||||
295 345 263.599884 -0.4590167 1
|
||||
305 345 262.043518 -0.4715563 1
|
||||
315 345 260.216461 -0.5125949 1
|
||||
325 345 258.139618 -0.5843691 1
|
||||
335 345 255.836212 -0.6815979 1
|
||||
345 345 253.331451 -0.7916309 1
|
||||
355 345 250.65213 -0.8974017 1
|
||||
365 345 247.82608 -0.9822296 1
|
||||
375 345 244.881653 -1.034367 1
|
||||
105 355 236.542786 -0.8053916 1
|
||||
115 355 239.511536 -0.8559309 1
|
||||
125 355 242.421112 -0.8909921 1
|
||||
135 355 245.244568 -0.9062259 1
|
||||
145 355 247.954498 -0.8998395 1
|
||||
155 355 250.523712 -0.8737812 1
|
||||
165 355 252.925537 -0.8338691 1
|
||||
175 355 255.134338 -0.7884543 1
|
||||
185 355 257.125824 -0.7460073 1
|
||||
195 355 258.877808 -0.712674 1
|
||||
205 355 260.370239 -0.6909303 1
|
||||
215 355 261.585815 -0.6797073 1
|
||||
225 355 262.510406 -0.6756343 1
|
||||
235 355 263.132996 -0.6746618 1
|
||||
245 355 263.446106 -0.6734288 1
|
||||
255 355 263.446106 -0.6701413 1
|
||||
265 355 263.132996 -0.6649869 1
|
||||
275 355 262.510406 -0.6601467 1
|
||||
285 355 261.585815 -0.6594277 1
|
||||
295 355 260.370239 -0.667488 1
|
||||
305 355 258.877808 -0.6886132 1
|
||||
315 355 257.125824 -0.7251665 1
|
||||
325 355 255.134338 -0.7761745 1
|
||||
335 355 252.925537 -0.8366687 1
|
||||
345 355 250.523712 -0.8982714 1
|
||||
355 355 247.954498 -0.9510985 1
|
||||
365 355 245.244568 -0.986296 1
|
||||
375 355 242.421143 -0.9982168 1
|
||||
105 365 234.227783 -0.7301244 1
|
||||
115 365 237.063202 -0.7803932 1
|
||||
125 365 239.842102 -0.8211433 1
|
||||
135 365 242.538727 -0.8492868 1
|
||||
145 365 245.126953 -0.8630885 1
|
||||
155 365 247.58078 -0.8628479 1
|
||||
165 365 249.874756 -0.8510816 1
|
||||
175 365 251.984314 -0.8319991 1
|
||||
185 365 253.886353 -0.8103872 1
|
||||
195 365 255.559631 -0.7903531 1
|
||||
205 365 256.985046 -0.7744435 1
|
||||
215 365 258.146057 -0.7634233 1
|
||||
225 365 259.029114 -0.756661 1
|
||||
235 365 259.623718 -0.7528488 1
|
||||
245 365 259.922791 -0.7507278 1
|
||||
255 365 259.922791 -0.7496345 1
|
||||
265 365 259.623718 -0.7497882 1
|
||||
275 365 259.029114 -0.7523054 1
|
||||
285 365 258.146057 -0.7589456 1
|
||||
295 365 256.985046 -0.7716019 1
|
||||
305 365 255.559631 -0.7915938 1
|
||||
315 365 253.886353 -0.8188929 1
|
||||
325 365 251.984314 -0.8515587 1
|
||||
335 365 249.874756 -0.8856623 1
|
||||
345 365 247.58078 -0.9158597 1
|
||||
355 365 245.126953 -0.9365292 1
|
||||
365 365 242.538727 -0.9430979 1
|
||||
375 365 239.842102 -0.9330602 1
|
||||
@@ -0,0 +1,11 @@
|
||||
Mesh_10m.msh ! Mesh file
|
||||
Obs_loc_TMI.obs ! Obsfile
|
||||
Gaussian.topo ! Topofile | null
|
||||
VALUE 1e-4 ! Starting model
|
||||
VALUE 0 ! Reference model
|
||||
DEFAULT !..\AzmDip.dat ! Magnetization vector model
|
||||
DEFAULT ! Cell based weight file
|
||||
1 ! target chi factor | DEFAULT=1
|
||||
1 1 1 1 ! alpha s, x ,y ,z
|
||||
VALUE 0 1 ! Lower and Upper Bounds for p-component
|
||||
VALUE 0 1 1 1 1 ! lp-norm for amplitude inversion FILE pqxqyqzr.dat ! Norms VALUE p, qx, qy, qz, r | FILE m-by-5 matrix
|
||||
@@ -0,0 +1,29 @@
|
||||
import unittest
|
||||
from SimPEG import *
|
||||
from simpegPF import BaseMag
|
||||
import matplotlib.pyplot as plt
|
||||
import simpegPF as PF
|
||||
from scipy.constants import mu_0
|
||||
|
||||
|
||||
|
||||
class MagSensProblemTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def test_magnetics_inversion(self):
|
||||
|
||||
driver = PF.MagneticsIO.MagneticsDriver_Inv('assets/magnetics/SimPEG_MAG3D_inv.inp')
|
||||
|
||||
print driver.mesh
|
||||
print driver.survey
|
||||
print driver.m0
|
||||
print driver.mref
|
||||
print driver.activeCells
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -3,3 +3,4 @@ import BaseMag
|
||||
import Magnetics
|
||||
import BaseGrav
|
||||
import Gravity
|
||||
import MagneticsIO
|
||||
|
||||
Reference in New Issue
Block a user