[GRASS-SVN] r56338 - in grass-addons/grass7/raster/r.agent: . libagent tests
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 20 14:41:26 PDT 2013
Author: mic
Date: 2013-05-20 14:41:26 -0700 (Mon, 20 May 2013)
New Revision: 56338
Modified:
grass-addons/grass7/raster/r.agent/libagent/grassland.py
grass-addons/grass7/raster/r.agent/r.agent.aco
grass-addons/grass7/raster/r.agent/tests/test_grassland.py
Log:
fix minimum pheromone
Modified: grass-addons/grass7/raster/r.agent/libagent/grassland.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/grassland.py 2013-05-20 19:43:57 UTC (rev 56337)
+++ grass-addons/grass7/raster/r.agent/libagent/grassland.py 2013-05-20 21:41:26 UTC (rev 56338)
@@ -134,6 +134,7 @@
#TODO find out why 'filename' is lost - numpy vs. garray..
#TODO think about moving 'minimum' to a predifined matrix in anthill
if minimum > 0:
- mask = garray.numpy.ones_like(self.layers[layername]) + minimum
- garray.numpy.maximum(self.layers[layername], mask)
+ mask = garray.numpy.ones_like(self.layers[layername]) - 1 + minimum
+ self.layers[layername] = \
+ garray.numpy.maximum(self.layers[layername], mask)
Modified: grass-addons/grass7/raster/r.agent/r.agent.aco
===================================================================
--- grass-addons/grass7/raster/r.agent/r.agent.aco 2013-05-20 19:43:57 UTC (rev 56337)
+++ grass-addons/grass7/raster/r.agent/r.agent.aco 2013-05-20 21:41:26 UTC (rev 56338)
@@ -305,9 +305,9 @@
# world.playground.setboundsfromlayer("costs")
if options['maxpheromone']:
- world.maxpheromone = int(options['maxpheromone'])
+ world.maxpheromone = int(options['maxpheromone']) - 1
if options['minpheromone']:
- world.minpheromone = int(options['minpheromone'])
+ world.minpheromone = int(options['minpheromone']) - 1
if options['volatilizationtime']:
world.volatilizationtime = int(options['volatilizationtime'])
if options['stepintensity']:
Modified: grass-addons/grass7/raster/r.agent/tests/test_grassland.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_grassland.py 2013-05-20 19:43:57 UTC (rev 56337)
+++ grass-addons/grass7/raster/r.agent/tests/test_grassland.py 2013-05-20 21:41:26 UTC (rev 56338)
@@ -129,15 +129,16 @@
def test_decaycellvalues(self):
l = "bar"
- #TODO find out why 'filename' is lost - numpy vs. garray..
-# self.pg.createlayer(l)
-# self.pg.layers[l][0][0] = 100
-# self.pg.decaycellvalues(l, 3)
-# self.assertEqual(int(round(self.pg.layers[l][0][0])), 79)
-# self.pg.decaycellvalues(l, 3)
-# self.assertEqual(int(round(self.pg.layers[l][0][0])), 63)
-# self.pg.decaycellvalues(l, 3)
-# self.assertEqual(int(round(self.pg.layers[l][0][0])), 50)
+ self.pg.createlayer(l)
+ self.pg.layers[l][0][0] = 100
+ self.pg.decaycellvalues(l, 3)
+ self.assertEqual(int(round(self.pg.layers[l][0][0])), 79)
+ self.pg.decaycellvalues(l, 3)
+ self.assertEqual(int(round(self.pg.layers[l][0][0])), 63)
+ self.pg.decaycellvalues(l, 3)
+ self.assertEqual(int(round(self.pg.layers[l][0][0])), 50)
+ self.pg.decaycellvalues(l, 3, 50)
+ self.assertEqual(int(round(self.pg.layers[l][0][0])), 50)
def tearDown(self):
if self.rastlayername:
More information about the grass-commit
mailing list