[GRASS-SVN] r57850 - grass-addons/grass7/raster/r.fidimo
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 27 00:48:12 PDT 2013
Author: jradinger
Date: 2013-09-27 00:48:11 -0700 (Fri, 27 Sep 2013)
New Revision: 57850
Modified:
grass-addons/grass7/raster/r.fidimo/r.fidimo.py
Log:
Implementation of fixed seed (for calculation of internal fishmove probability)
Modified: grass-addons/grass7/raster/r.fidimo/r.fidimo.py
===================================================================
--- grass-addons/grass7/raster/r.fidimo/r.fidimo.py 2013-09-27 00:18:12 UTC (rev 57849)
+++ grass-addons/grass7/raster/r.fidimo/r.fidimo.py 2013-09-27 07:48:11 UTC (rev 57850)
@@ -149,6 +149,14 @@
#% guisection: Optional
#%End
#%Option
+#% key: seed
+#% type: integer
+#% required: no
+#% multiple: no
+#% description: fixed seed for generating dispersal parameters via fishmove
+#% guisection: Optional
+#%End
+#%Option
#% key: output
#% type: string
#% required: no
@@ -185,7 +193,6 @@
import grass.script.setup as gsetup
import grass.script.array as garray
-#import random
# import required numpy/scipy modules
import numpy
@@ -273,8 +280,13 @@
interval = "prediction"
else:
interval = "confidence"
-
+ #Set fixed seed if specified
+ if options['seed']:
+ seed = ",seed="+str(options['seed'])
+ else:
+ seed = ""
+
#Output
output_fidimo = options['output']
if (grass.find_file(name = output_fidimo+"_"+"fit", element = 'cell')['file'] and not grass.overwrite()):
@@ -311,10 +323,11 @@
##### Calculating 'fishmove' depending on species or L & AR
if species == "Custom species":
- fishmove = fm.fishmove(L=L,AR=AR,SO=SO,T=T,interval=interval)
+ fishmove = eval("fm.fishmove(L=L,AR=AR,SO=SO,T=T,interval=interval,rep=200%s)"%(seed))
else:
- fishmove = fm.fishmove(species=species,SO=SO,T=T,interval=interval)
+ fishmove = eval("fm.fishmove(L=L,AR=AR,SO=SO,T=T,interval=interval,rep=200%s)"%(seed))
+
# using only part of fishmove results (only regression coeffients)
fishmove = fishmove[1]
nrun = ['fit','lwr','upr']
More information about the grass-commit
mailing list