Data projections

This commit is contained in:
rowanc1
2014-02-13 17:42:51 -08:00
parent cd62bfd17b
commit cc3f2d867c
4 changed files with 45 additions and 4 deletions
+14 -2
View File
@@ -1,4 +1,4 @@
.. _api_TDEM:
.. _api_TDEM_derivation:
.. math::
@@ -229,7 +229,7 @@ with
Implementing **J** times a vector
****************************************
*********************************
Multiplying **J** onto a vector can be broken into three steps
@@ -290,3 +290,15 @@ and
+ \MfMui \dcurl \MeSig^{-1} \vec{p}_e^{(t+1)} + \MfMui \vec{p}_b^{(t+1)} \\
\vec{y}_e^{(t+1)} = \MeSig^{-1} \dcurl^\top \MfMui \vec{y}_b^{(t+1)} - \MeSig^{-1} \vec{p}_e^{(t+1)}
\end{align}
Implementing \\(\\mathbf{J}^\\top\\) times a vector
*********************************
Multiplying \\(\\mathbf{J}^\\top\\) onto a vector can be broken into three steps
* Compute \\(\\vec{u} = \\mathbf{Q}^\\top \\vec{v}\\)
* Solve \\(\\hat{\\mathbf{A}}^\\top \\vec{y} = \\vec{u}\\)
* Compute \\(\\vec{w} = -\\mathbf{G}^\\top y\\)
+5
View File
@@ -77,6 +77,11 @@ class MixinTimeStuff(object):
self._dt = dt
self._nsteps = nsteps
@property
def nTimes(self):
return self.times.size
class ProblemBaseTDEM(MixinTimeStuff, MixinInitialFieldCalc, BaseProblem):
"""docstring for ProblemTDEM1D"""
def __init__(self, mesh, model, **kwargs):
+22 -2
View File
@@ -1,5 +1,6 @@
from SimPEG import Utils
from SimPEG import Utils, np
from SimPEG.Data import BaseData
from FieldsTDEM import FieldsTDEM
class DataTDEM1D(BaseData):
"""
@@ -11,13 +12,32 @@ class DataTDEM1D(BaseData):
rxLoc = None #: rxLoc
rxType = None #: rxType
timeCh = None #: timeCh
nTx = 1 #: Number of transmitters
@property
def nTimeCh(self):
"""Number of time channels"""
return self.timeCh.size
def __init__(self, **kwargs):
BaseData.__init__(self, **kwargs)
Utils.setKwargs(self, **kwargs)
def projectFields(self, u):
return self.Qrx.dot(u.b[:,:,0].T)
#TODO: this is hardcoded to 1Tx
return self.Qrx.dot(u.b[:,:,0].T).T
def projectFieldsAdjoint(self, d):
# TODO: make the following self.nTimeCh
d = d.reshape((self.prob.nTimes, self.nTx), order='F')
#TODO: *Qtime.T need to multiply by a time projection. (outside for loop??)
ii = 0
F = FieldsTDEM(self.prob.mesh, self.nTx, self.prob.nTimes, 'b')
for ii in range(self.prob.nTimes):
b = self.Qrx.T*d[ii,:]
F.set_b(b, ii)
F.set_e(np.zeros((self.prob.mesh.nE,self.nTx)), ii)
return F
####################################################
# Interpolation Matrices
+4
View File
@@ -60,10 +60,14 @@ class FieldsTDEM(object):
if self.b is None:
self.b = np.zeros((self.nTimes, np.sum(self.mesh.nF), self.nTx))
self.b[:] = np.nan
if len(b.shape) == 1:
b = b[:, np.newaxis]
self.b[ind,:,:] = b
def set_e(self, e, ind):
if self.e is None:
self.e = np.zeros((self.nTimes, np.sum(self.mesh.nE), self.nTx))
self.e[:] = np.nan
if len(e.shape) == 1:
e = e[:, np.newaxis]
self.e[ind,:,:] = e