[GRASS-SVN] r57851 - grass-addons/grass6/raster/r.fidimo

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 27 00:49:26 PDT 2013


Author: jradinger
Date: 2013-09-27 00:49:25 -0700 (Fri, 27 Sep 2013)
New Revision: 57851

Modified:
   grass-addons/grass6/raster/r.fidimo/r.fidimo.py
Log:
Implementation of fixed seed (for calculation of internal fishmove probability)

Modified: grass-addons/grass6/raster/r.fidimo/r.fidimo.py
===================================================================
--- grass-addons/grass6/raster/r.fidimo/r.fidimo.py	2013-09-27 07:48:11 UTC (rev 57850)
+++ grass-addons/grass6/raster/r.fidimo/r.fidimo.py	2013-09-27 07:49:25 UTC (rev 57851)
@@ -120,6 +120,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
@@ -155,18 +163,16 @@
 import grass.script.setup as gsetup
 import grass.script.array as garray
 
-#import random
 
 # import required numpy/scipy modules
 import numpy
 from scipy import stats
 from scipy import optimize
-#import matplotlib.pyplot as plt
-#import matplotlib as mpl
 
 
 
 
+
 tmp_map_rast = None
 tmp_map_vect = None
 
@@ -230,6 +236,13 @@
 		interval = "confidence"
 	
 
+	#Set fixed seed if specified
+	if options['seed']:
+		seed = ",seed="+str(options['seed'])
+	else:
+		seed = ""
+
+
 	#Options and Output
 	output = options['output']
 
@@ -264,10 +277,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