Skip to content
Snippets Groups Projects
Commit d097dff1 authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Fix convention issues in test function of agent

parent c2463643
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ class DefaultBrain(): ...@@ -49,7 +49,7 @@ class DefaultBrain():
class AbstractAgent(): class AbstractAgent():
def __init__(self, convention='rxyz'): def __init__(self, convention='rzyx'):
self._brain = DefaultBrain() self._brain = DefaultBrain()
self._alter_posorientvel = defaultcallback self._alter_posorientvel = defaultcallback
tuples = [('location', 'x'), ('location', 'y'), tuples = [('location', 'x'), ('location', 'y'),
......
...@@ -18,7 +18,7 @@ version = float(nx.__version__) ...@@ -18,7 +18,7 @@ version = float(nx.__version__)
class BrainTest(Brain): class BrainTest(Brain):
def __init__(self, renderer=None): def __init__(self, renderer=None):
Brain.__init__(self, renderer=renderer) Brain.__init__(self, renderer=renderer)
convention = 'rxyz' convention = 'rzyx'
tuples = [('location', 'x'), ('location', 'y'), tuples = [('location', 'x'), ('location', 'y'),
('location', 'z'), (convention, 'alpha_0'), ('location', 'z'), (convention, 'alpha_0'),
(convention, 'alpha_1'), (convention, 'alpha_2')] (convention, 'alpha_1'), (convention, 'alpha_2')]
...@@ -48,21 +48,23 @@ class TestNavipyMovingAgent(unittest.TestCase): ...@@ -48,21 +48,23 @@ class TestNavipyMovingAgent(unittest.TestCase):
self.mydb_filename = pkg_resources.resource_filename( self.mydb_filename = pkg_resources.resource_filename(
'navipy', 'resources/database.db') 'navipy', 'resources/database.db')
self.mydb = navidb.DataBaseLoad(self.mydb_filename) self.mydb = navidb.DataBaseLoad(self.mydb_filename)
self.convention = 'rzyx'
self.brain = BrainTest(self.mydb) self.brain = BrainTest(self.mydb)
convention = 'rxyz'
tuples = [('location', 'x'), ('location', 'y'), tuples = [('location', 'x'), ('location', 'y'),
('location', 'z'), (convention, 'alpha_0'), ('location', 'z'), (self.convention, 'alpha_0'),
(convention, 'alpha_1'), (convention, 'alpha_2')] (self.convention, 'alpha_1'), (self.convention, 'alpha_2')]
index = pd.MultiIndex.from_tuples(tuples, index = pd.MultiIndex.from_tuples(tuples,
names=['position', names=['position',
'orientation']) 'orientation'])
self.__posorient_col = index self.__posorient_col = index
tuples_vel = [('location', 'x'), ('location', 'y'), tuples_vel = [('location', 'x'), ('location', 'y'),
('location', 'z'), (convention, 'alpha_0'), ('location', 'z'), (self.convention, 'alpha_0'),
(convention, 'alpha_1'), (convention, 'alpha_2'), (self.convention, 'alpha_1'),
(self.convention, 'alpha_2'),
('location', 'dx'), ('location', 'dy'), ('location', 'dx'), ('location', 'dy'),
('location', 'dz'), (convention, 'dalpha_0'), ('location', 'dz'), (self.convention, 'dalpha_0'),
(convention, 'dalpha_1'), (convention, 'dalpha_2')] (self.convention, 'dalpha_1'),
(self.convention, 'dalpha_2')]
index_vel = pd.MultiIndex.from_tuples(tuples_vel, index_vel = pd.MultiIndex.from_tuples(tuples_vel,
names=['position', names=['position',
'orientation']) 'orientation'])
...@@ -87,7 +89,7 @@ class TestNavipyMovingAgent(unittest.TestCase): ...@@ -87,7 +89,7 @@ class TestNavipyMovingAgent(unittest.TestCase):
# GridAgent # GridAgent
# #
def test_move_gridagent(self): def test_move_gridagent(self):
agent = naviagent.GridAgent(self.brain, 'rxyz') agent = naviagent.GridAgent(self.brain, self.convention)
initposorient = None initposorient = None
with warnings.catch_warnings(record=True): with warnings.catch_warnings(record=True):
initposorient = self.brain.posorients.loc[13, :] initposorient = self.brain.posorients.loc[13, :]
...@@ -114,7 +116,7 @@ class TestNavipyMovingAgent(unittest.TestCase): ...@@ -114,7 +116,7 @@ class TestNavipyMovingAgent(unittest.TestCase):
obtained, initposorient.loc[obtained.index])) obtained, initposorient.loc[obtained.index]))
def test_fly_gridagent(self): def test_fly_gridagent(self):
agent = naviagent.GridAgent(self.brain, 'rxyz') agent = naviagent.GridAgent(self.brain, self.convention)
initposorient = None initposorient = None
with warnings.catch_warnings(record=True): with warnings.catch_warnings(record=True):
initposorient = self.brain.posorients.loc[13, :] initposorient = self.brain.posorients.loc[13, :]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment