From 93f010bba961e175c3ac4f71175d182ba2eaba9a Mon Sep 17 00:00:00 2001 From: rowanc1 Date: Thu, 15 May 2014 09:14:41 -0700 Subject: [PATCH] remove txPair from fields obj. --- SimPEG/Survey.py | 11 ++++------- SimPEG/Tests/test_Survey.py | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/SimPEG/Survey.py b/SimPEG/Survey.py index c32a0440..0791be19 100644 --- a/SimPEG/Survey.py +++ b/SimPEG/Survey.py @@ -219,10 +219,9 @@ class Fields(object): """ - knownFields = None #: Known fields, a dict with locations, e.g. {"phi": "CC", "b": "F"} - aliasFields = None #: Aliased fields, a dict with [alias, location, and function or float], e.g. {"b":["e",lambda(F,e)]} - txPair = BaseTx - dtype = float #: dtype is the type of the storage matrix. This can be a dictionary. + knownFields = None #: Known fields, a dict with locations, e.g. {"e": "E", "phi": "CC"} + aliasFields = None #: Aliased fields, a dict with [alias, function], e.g. {"b":["e",lambda(F,e,ind)]} + dtype = float #: dtype is the type of the storage matrix. This can be a dictionary. def __init__(self, mesh, survey, **kwargs): self.survey = survey @@ -269,8 +268,6 @@ class Fields(object): if type(txTestList) is not list: txTestList = [txTestList] for txTest in txTestList: - if not isinstance(txTest, self.txPair): - raise KeyError('First index must be a Transmitter') if txTest not in self.survey.txList: raise KeyError('Invalid Transmitter, not in survey list.') @@ -349,7 +346,7 @@ class Fields(object): def _getAliasField(self, name, ind): alias, func = self.aliasFields[name] - return func(self, self._fields[alias][:,ind]) + return func(self, self._fields[alias][:,ind], ind) def __contains__(self, other): if other in self.aliasFields: diff --git a/SimPEG/Tests/test_Survey.py b/SimPEG/Tests/test_Survey.py index 0c3e70f8..2bb56505 100644 --- a/SimPEG/Tests/test_Survey.py +++ b/SimPEG/Tests/test_Survey.py @@ -124,7 +124,7 @@ class FieldsTest_Alias(unittest.TestCase): txList = [Tx0,Tx1,Tx2,Tx3,Tx4] survey = Survey.BaseSurvey(txList=txList) self.D = Survey.Data(survey) - self.F = Survey.Fields(mesh, survey, knownFields={'e':'E'}, aliasFields={'b':['e',(lambda F, e: F.mesh.edgeCurl * e)]}) + self.F = Survey.Fields(mesh, survey, knownFields={'e':'E'}, aliasFields={'b':['e',(lambda F, e, ind: F.mesh.edgeCurl * e)]}) self.Tx0 = Tx0 self.Tx1 = Tx1 self.mesh = mesh