From d097dff110730af2fcd30371f00a2edc616d3826 Mon Sep 17 00:00:00 2001 From: "Olivier J.N. Bertrand" <olivier.bertrand@uni-bielefeld.de> Date: Wed, 6 Jun 2018 16:56:29 +0200 Subject: [PATCH] Fix convention issues in test function of agent --- navipy/moving/agent.py | 2 +- navipy/moving/test_agent.py | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/navipy/moving/agent.py b/navipy/moving/agent.py index 7b30f17..baa501a 100644 --- a/navipy/moving/agent.py +++ b/navipy/moving/agent.py @@ -49,7 +49,7 @@ class DefaultBrain(): class AbstractAgent(): - def __init__(self, convention='rxyz'): + def __init__(self, convention='rzyx'): self._brain = DefaultBrain() self._alter_posorientvel = defaultcallback tuples = [('location', 'x'), ('location', 'y'), diff --git a/navipy/moving/test_agent.py b/navipy/moving/test_agent.py index 3319808..46c46ff 100644 --- a/navipy/moving/test_agent.py +++ b/navipy/moving/test_agent.py @@ -18,7 +18,7 @@ version = float(nx.__version__) class BrainTest(Brain): def __init__(self, renderer=None): Brain.__init__(self, renderer=renderer) - convention = 'rxyz' + convention = 'rzyx' tuples = [('location', 'x'), ('location', 'y'), ('location', 'z'), (convention, 'alpha_0'), (convention, 'alpha_1'), (convention, 'alpha_2')] @@ -48,21 +48,23 @@ class TestNavipyMovingAgent(unittest.TestCase): self.mydb_filename = pkg_resources.resource_filename( 'navipy', 'resources/database.db') self.mydb = navidb.DataBaseLoad(self.mydb_filename) + self.convention = 'rzyx' self.brain = BrainTest(self.mydb) - convention = 'rxyz' tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), (convention, 'alpha_0'), - (convention, 'alpha_1'), (convention, 'alpha_2')] + ('location', 'z'), (self.convention, 'alpha_0'), + (self.convention, 'alpha_1'), (self.convention, 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) self.__posorient_col = index tuples_vel = [('location', 'x'), ('location', 'y'), - ('location', 'z'), (convention, 'alpha_0'), - (convention, 'alpha_1'), (convention, 'alpha_2'), + ('location', 'z'), (self.convention, 'alpha_0'), + (self.convention, 'alpha_1'), + (self.convention, 'alpha_2'), ('location', 'dx'), ('location', 'dy'), - ('location', 'dz'), (convention, 'dalpha_0'), - (convention, 'dalpha_1'), (convention, 'dalpha_2')] + ('location', 'dz'), (self.convention, 'dalpha_0'), + (self.convention, 'dalpha_1'), + (self.convention, 'dalpha_2')] index_vel = pd.MultiIndex.from_tuples(tuples_vel, names=['position', 'orientation']) @@ -87,7 +89,7 @@ class TestNavipyMovingAgent(unittest.TestCase): # GridAgent # def test_move_gridagent(self): - agent = naviagent.GridAgent(self.brain, 'rxyz') + agent = naviagent.GridAgent(self.brain, self.convention) initposorient = None with warnings.catch_warnings(record=True): initposorient = self.brain.posorients.loc[13, :] @@ -114,7 +116,7 @@ class TestNavipyMovingAgent(unittest.TestCase): obtained, initposorient.loc[obtained.index])) def test_fly_gridagent(self): - agent = naviagent.GridAgent(self.brain, 'rxyz') + agent = naviagent.GridAgent(self.brain, self.convention) initposorient = None with warnings.catch_warnings(record=True): initposorient = self.brain.posorients.loc[13, :] -- GitLab