From fb2bc30d965ca9c9d3ec1b9cb1e9ebcac92b0131 Mon Sep 17 00:00:00 2001 From: rowanc1 Date: Sun, 20 Apr 2014 13:11:52 -0700 Subject: [PATCH] TimeRx --- SimPEG/Survey.py | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/SimPEG/Survey.py b/SimPEG/Survey.py index 90d7aad7..4d6a4cf3 100644 --- a/SimPEG/Survey.py +++ b/SimPEG/Survey.py @@ -1,4 +1,4 @@ -import Utils, numpy as np +import Utils, numpy as np, scipy.sparse as sp class BaseSurvey(object): @@ -185,7 +185,7 @@ class BaseSurvey(object): class BaseRx(object): """SimPEG Receiver Object""" - locs = None #: Locations (nRx x 3) + locs = None #: Locations (nRx x nDim) knownRxTypes = None #: Set this to a list of strings to ensure that txType is known @@ -221,8 +221,7 @@ class BaseRx(object): .. note:: - Projection matrices are stored as a nested dict, - First gridLocation, then mesh. + Projection matrices are stored as a dictionary listed by meshes. """ if mesh not in self._Ps: self._Ps[mesh] = mesh.getInterpolationMat(self.locs, self.projGLoc) @@ -230,6 +229,40 @@ class BaseRx(object): return P +class BaseTimeRx(BaseRx): + """SimPEG Receiver Object""" + + times = None #: Times when the receivers were active. + + def __init__(self, locs, times, rxType, **kwargs): + self.times = times + BaseRx.__init__(self, locs, rxType, **kwargs) + + @property + def nD(self): + """Number of data in the receiver.""" + return self.locs.shape[0] * len(self.times) + + def getP(self, mesh, timeMesh): + """ + Returns the projection matrices as a + list for all components collected by + the receivers. + + .. note:: + + Projection matrices are stored as a dictionary (mesh, timeMesh) + """ + if (mesh, timeMesh) not in self._Ps: + Ps = mesh.getInterpolationMat(self.locs, self.projGLoc) + Pt = timeMesh.getInterpolationMat(self.times, 'N') + self._Ps[(mesh, timeMesh)] = sp.kron(Pt, Ps) + + P = self._Ps[(mesh, timeMesh)] + return P + + + class BaseTx(object): """SimPEG Transmitter Object"""