diff --git a/doc/source/tutorials.rst b/doc/source/tutorials.rst index da5d1ca2a5bd102d26f5331a551ccc533a8e3b27..78c50b6a625fcc696d22e28008d63ae21b0f8b9f 100644 --- a/doc/source/tutorials.rst +++ b/doc/source/tutorials.rst @@ -66,7 +66,14 @@ In close loop Catchment area of ASV --------------------- - +To calculate the catchment area of homing method for a given goal location, \ +the agent should be displaced multiple time at different location, and obsverve \ +if the agent returned home or not. If it did, then the point in space from which the \ +agent started its return trip is part of the catchment area. + +When the agent is restricted to move a grid, and its motion at a given place, only \ +depends on the current surrounding, then to calculate a catchment area one only to \ +build a graph of motion and check how many points converge to it. Comparing modalities -------------------- diff --git a/navipy/__init__.py b/navipy/__init__.py index 11aa5406edf662d601b2efc310ad6df93b8f9c68..ff7882627b3b7b046cab62a2465801c1e3087f7a 100644 --- a/navipy/__init__.py +++ b/navipy/__init__.py @@ -1,6 +1,6 @@ """ Every agent comes with a brain processing the about of \ -senses or sensors for biological or technical agent, respectively. +senses or sensors for biological or technical agent, respectively. The senses of agents in navipy are limited to: @@ -23,8 +23,8 @@ Then the brain can be updated at a new position orientation: Building your own brain ----------------------- -The Brain class is an abstract Brain, such that it can not control an agent. To control, \ -an agent, the Brain should have a function called velocity. +The Brain class is an abstract Brain, such that it can not control an agent. \ +To control, an agent, the Brain should have a function called velocity. For example, an stationary agent should always return a null velocity. @@ -39,6 +39,7 @@ An agent using an average skyline homing vector, could be build as follow """ from navipy.database import DataBaseLoad + class Bunch: def __init__(self, **kwds): self.__dict__.update(kwds) @@ -69,5 +70,5 @@ class Brain(): if isinstance(self.renderer, DataBaseLoad): return self.renderer.posorients else: - raise NotImplementedError("Subclasses should implement this, "+ + raise NotImplementedError("Subclasses should implement this, " + "when renderer is not DataBaseLoad") diff --git a/navipy/moving/agent.py b/navipy/moving/agent.py index 8a7b2e501edb75a08d3d466cc16a5973712c8b42..0ac0c9c5212b7cca69c2d6c373715aa739ec6211 100644 --- a/navipy/moving/agent.py +++ b/navipy/moving/agent.py @@ -16,9 +16,7 @@ import networkx as nx import multiprocessing from multiprocessing import Queue, JoinableQueue, Process import inspect -from navipy.database import DataBaseLoad import navipy.moving.maths as navimomath -from navipy import Brain version = float(nx.__version__) @@ -160,7 +158,7 @@ GridAgent is a close loop agent here its position is snap to a grid. self.brain = brain self._posorients_queue = posorients_queue self._results_queue = results_queue - + @property def mode_of_motion(self): """ @@ -294,7 +292,7 @@ the agent motion, or results_queue=results_queue) for _ in range(num_agents)] for w in agents: - w.mode_of_motion=self.mode_of_motion + w.mode_of_motion = self.mode_of_motion w.start() # Add a poison pill for each agent diff --git a/navipy/moving/test_agent.py b/navipy/moving/test_agent.py index ace9b780245bfab309908e4a5f3f0fedd92b1cab..67a33ea1c909502f71ae935d7a4adf8a55fb7976 100644 --- a/navipy/moving/test_agent.py +++ b/navipy/moving/test_agent.py @@ -16,15 +16,16 @@ version = float(nx.__version__) class BrainTest(Brain): def __init__(self, renderer=None): - Brain.__init__(self,renderer=renderer) + Brain.__init__(self, renderer=renderer) self.__posorient_col = ['x', 'y', 'z', - 'alpha_0', 'alpha_1', 'alpha_2'] + 'alpha_0', 'alpha_1', 'alpha_2'] self.__velocity_col = ['d' + col for col in self.__posorient_col] self.__posorient_vel_col = self.__posorient_col self.__posorient_vel_col.extend(self.__velocity_col) def velocity(self): - return pd.Series(data=0,index=self.__posorient_vel_col) + return pd.Series(data=0, index=self.__posorient_vel_col) + class TestNavipyMovingAgent(unittest.TestCase): def setUp(self): @@ -40,6 +41,7 @@ class TestNavipyMovingAgent(unittest.TestCase): # # AbstractAgent # + def test_move_abstractagent(self): agent = naviagent.AbstractAgent() with self.assertRaises(NameError):