[Zooimage-commits] r74 - pkg/zooimage/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 15 14:32:06 CEST 2009


Author: romain
Date: 2009-04-15 14:32:06 +0200 (Wed, 15 Apr 2009)
New Revision: 74

Modified:
   pkg/zooimage/R/ZIClass.r
   pkg/zooimage/R/zid.r
Log:
removed uses of experimental catcher mechanism (for now)

Modified: pkg/zooimage/R/ZIClass.r
===================================================================
--- pkg/zooimage/R/ZIClass.r	2009-04-15 12:01:16 UTC (rev 73)
+++ pkg/zooimage/R/ZIClass.r	2009-04-15 12:32:06 UTC (rev 74)
@@ -19,6 +19,7 @@
 # Version 1.2.0: check for package loading, and add a 'package' attribute to ZIClass
 ### TODO: allow for defining parameters and use a plugin mechanism
 
+# {{{ ziclass 
 # {{{ ZIClass 
 #' Modifications in calculation of probabilities to accept variables selection v1.2-2
 "ZIClass" <- function(df, algorithm = c("lda", "randomForest"),
@@ -154,7 +155,9 @@
 	return(res)
 }
 # }}}
+# }}}
 
+# {{{ confusion 
 # {{{ confu
 "confu" <- function(classes1, classes2, classes.predicted = FALSE) {
 	
@@ -308,6 +311,7 @@
 	#par(mar=omar)
 }
 # }}}
+# }}}
 
 # {{{ nnet2 
 
@@ -366,29 +370,32 @@
 # }}}
 # }}}
 
-# Formula calculation by variables selection for the classifier creation v1.2-2
+# {{{ FormVarsSelect
+#' Formula calculation by variables selection for the classifier creation v1.2-2
 FormVarsSelect <- function(x){
-  # x must be a ZItrain object
-  if (class(x) != "ZI1Train")
-    stop("your object must be a ZItrain object")
-  # Parameters measured on particles and new variables calculated
-  mes <- as.vector(colnames(calc.vars(x)))
-  # Selection of features for the creation of the classifier
-  keep <-select.list(list = mes,
-    preselect = c("ECD", "FIT_Area_ABD", "FIT_Diameter_ABD", "FIT_Volume_ABD", "FIT_Diameter_ESD",
-    "FIT_Volume_ESD", "FIT_Length", "FIT_Width", "FIT_Aspect_Ratio", "FIT_Transparency",
-    "FIT_Intensity", "FIT_Sigma_Intensity", "FIT_Sum_Intensity", "FIT_Compactness",
-    "FIT_Elongation", "FIT_Perimeter", "FIT_Convex_Perimeter", "FIT_Roughness",
-    "FIT_Feret_Max_Angle", "FIT_Ch1_Peak", "FIT_Ch1_TOF", "FIT_Ch2_Peak", "FIT_Ch2_TOF",
-    "Area", "Mean", "StdDev", "Mode", "Min", "Max", "Perim.", "Width","Height",
-    "Major", "Minor", "Circ.", "Feret", "IntDen", "Median", "Skew", "Kurt", "Elongation",
-    "CentBoxD", "GrayCentBoxD", "CentroidsD", "Range", "MeanPos", "SDNorm", "CV", "logArea",
-    "logPerim.", "logMajor", "logMinor", "logFeret"),
-    multiple = TRUE, title = "Select variables to keep")
-  # Creation of one formula for classifier calculation
-  res <- as.formula(paste("Class ~ ", paste(keep, collapse= "+")))
-  return(res)
+  
+	# x must be a ZItrain object
+	mustbe( x, "ZI1Train" )
+	
+	# Parameters measured on particles and new variables calculated
+	mes <- as.vector(colnames(calc.vars(x)))
+	
+	# Selection of features for the creation of the classifier
+	keep <- select.list(list = mes,
+	  preselect = c("ECD", "FIT_Area_ABD", "FIT_Diameter_ABD", "FIT_Volume_ABD", "FIT_Diameter_ESD",
+	  "FIT_Volume_ESD", "FIT_Length", "FIT_Width", "FIT_Aspect_Ratio", "FIT_Transparency",
+	  "FIT_Intensity", "FIT_Sigma_Intensity", "FIT_Sum_Intensity", "FIT_Compactness",
+	  "FIT_Elongation", "FIT_Perimeter", "FIT_Convex_Perimeter", "FIT_Roughness",
+	  "FIT_Feret_Max_Angle", "FIT_Ch1_Peak", "FIT_Ch1_TOF", "FIT_Ch2_Peak", "FIT_Ch2_TOF",
+	  "Area", "Mean", "StdDev", "Mode", "Min", "Max", "Perim.", "Width","Height",
+	  "Major", "Minor", "Circ.", "Feret", "IntDen", "Median", "Skew", "Kurt", "Elongation",
+	  "CentBoxD", "GrayCentBoxD", "CentroidsD", "Range", "MeanPos", "SDNorm", "CV", "logArea",
+	  "logPerim.", "logMajor", "logMinor", "logFeret"),
+	  multiple = TRUE, title = "Select variables to keep")
+	# Creation of one formula for classifier calculation
+	res <- as.formula(paste("Class ~ ", paste(keep, collapse= "+")))
+	return(res)
 }
+# }}}
 
-
 # :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1:

Modified: pkg/zooimage/R/zid.r
===================================================================
--- pkg/zooimage/R/zid.r	2009-04-15 12:01:16 UTC (rev 73)
+++ pkg/zooimage/R/zid.r	2009-04-15 12:32:06 UTC (rev 74)
@@ -25,12 +25,6 @@
 #' @param show.log do we show a log at the end
 verify.zid <- function(zidir, type = "ZI1", check.vignettes = TRUE, show.log = TRUE) {
 	
-	# {{{ using the catcher mechanism
-	if( is.null( getCatcher() ) ){
-		return( catch(match.call()) ) 
-	}
-	# }}}
-
 	# {{{ check the format of the file
 	# This should be a directory containing XXX+YY_dat1.zim files + .jpg files
 	if (type != "ZI1") {
@@ -116,16 +110,16 @@
 	return(invisible(ok))
 	
 }
-attr( verify.zid, "catcher" ) <- function( call ){
-	
-	withCallingHandlers( eval( call ), 
-		"zooImageError_verify.zim" = function( e ){
-			# we get an error from verify.zim, we want to log the error
-			# but keep going
-			logError( e )			
-		} )
-	
-}
+# attr( verify.zid, "catcher" ) <- function( call ){
+# 	
+# 	withCallingHandlers( eval( call ), 
+# 		"zooImageError_verify.zim" = function( e ){
+# 			# we get an error from verify.zim, we want to log the error
+# 			# but keep going
+# 			logError( e )			
+# 		} )
+# 	
+# }
 # }}}
 
 # {{{ verify.zid.all



More information about the Zooimage-commits mailing list