resolved conflicts

This commit is contained in:
seogi
2014-02-28 16:44:12 -08:00
parent 5816f75728
commit 18546d038b
6 changed files with 693 additions and 215 deletions
+47 -16
View File
@@ -11,10 +11,14 @@ class BaseMagData(Data.BaseData):
def __init__(self, **kwargs):
Data.BaseData.__init__(self, **kwargs)
#TODO: change to inc, dec, intensity
def setBackgroundField(self, x=1., y=0., z=0.):
# Primary field in x-direction (background)
self.B0 = np.r_[x,y,z]
def setBackgroundField(self, Inc, Dec, Btot):
Bx = Btot*np.cos(Inc/180.*np.pi)*np.sin(Dec/180.*np.pi)
By = Btot*np.cos(Inc/180.*np.pi)*np.cos(Dec/180.*np.pi)
Bz = -Btot*np.sin(Inc/180.*np.pi)
self.B0 = np.r_[Bx,By,Bz]
@property
def Qfx(self):
@@ -34,36 +38,63 @@ class BaseMagData(Data.BaseData):
self._Qfz = self.prob.mesh.getInterpolationMat(self.rxLoc,'Fz')
return self._Qfz
def projectFields(self, B):
def projectFields(self, u):
"""
This function projects the fields onto the data space.
Esepcially, here for we use total magnetic intensity (TMI) data,
which is common in practice.
First we project our B on to data location
.. math::
d_\\text{pred} = \mathbf{P} u(m)
\mathbf{B}_{rec} = \mathbf{P} \mathbf{B}
then we take the dot product between B and b_0
.. math ::
\\text{TMI} = \\vec{B}_s \cdot \hat{B}_0
"""
#TODO: There can be some different tyes of data like |B| or B
# bfx = self.Qfx*B
# bfy = self.Qfy*B
bfz = self.Qfz*B
return bfz
bfx = self.Qfx*u['B']
bfy = self.Qfy*u['B']
bfz = self.Qfz*u['B']
# return np.sqrt(bfx**2 + bfy**2 + bfz**2)
# Generate unit vector
B0 = self.prob.data.B0
Bot = np.sqrt(B0[0]**2+B0[1]**2+B0[2]**2)
box = B0[0]/Bot
boy = B0[1]/Bot
boz = B0[2]/Bot
# return bfx*box + bfx*boy + bfx*boz
return bfx*box + bfy*boy + bfz*boz
# return np.sqrt(bfx**2 + bfy**2 + bfz**2)
@Utils.count
def projectFieldsDeriv(self, B):
"""
This function projects the fields onto the data space.
.. math::
\\frac{\partial d_\\text{pred}}{\partial u} = \mathbf{P}
\\frac{\partial d_\\text{pred}}{\partial \mathbf{B}} = \mathbf{P}
Esepcially, this function is for TMI data type
"""
return self.Qfz
# Generate unit vector
B0 = self.prob.data.B0
Bot = np.sqrt(B0[0]**2+B0[1]**2+B0[2]**2)
box = B0[0]/Bot
boy = B0[1]/Bot
boz = B0[2]/Bot
return self.Qfx*box+self.Qfy*boy+self.Qfz*boz
def projectFieldsAsVector(self, B):