add some comments after meeting 17-11-2016
[epclust.git] / code / stage2 / src / 05_cluster2stepWER.r
index dcc7fa3..9b55da1 100644 (file)
@@ -9,6 +9,8 @@ library(Rwave)       # CWT
 library(cluster)     # pam
 #library(flexclust)   # kcca
 source("aux.r")               # auxiliary clustering functions 
+
+#TODO: [plus tard] alternative à sowa (package disparu) : cwt..
 source("sowas-superseded.r")  # auxiliary CWT functions
 
 ## 1. Read auxiliar data files ####
@@ -25,8 +27,9 @@ synchros09 <- t(as.matrix(read.table("~/tmp/2009_synchros200RC.txt")))
 #synchros09 <- t(as.matrix(read.table("~/tmp/2009_synchros200-random.txt")))
 
 nas <- which(is.na(synchros09)[, 1]) # some 1/1/2009 are missing
-synchros09[nas, 1] <- rowMeans(synchros09[nas, 2:4])
+synchros09[nas, 1] <- rowMeans(synchros09[nas, 2:4]) #valeurs après 1er janvier
 
+#moyenne pondérée pour compléter deux demi-heures manquantes
 imput09 <- synchros09[, 4180:4181] %*% matrix(c(2/3, 1/3, 1/3, 2/3), 2)
 synchros09 <- cbind(synchros09[, 1:4180], imput09, synchros09[, 4181:17518])
 
@@ -47,14 +50,23 @@ rm(synchros09, nas)
 # scalevector4  <- 2^(4:(noctave4 * nvoice) / nvoice) * 2
 # lscvect4      <- length(scalevector4)
 # lscvect <- lscvect4  # i should clean my code: werFam demands a lscvect
+
+
+#17000 colonnes coeff 1, puis 17000 coeff 2... [non : dans chaque tranche du cube]
+
+#TODO: une fonction qui fait lignes 59 à 91
+
+#cube:
 # Xcwt4   <- toCWT(conso, noctave = noctave4, dt = 1,
 #                 scalevector = scalevector4,
 #                 lt = delta, smooth = FALSE, 
 #                 nvoice = nvoice)      # observations node with CWT
 # 
-# #Xcwt2 <- matrix(0.0, nrow= n, ncol= 2 + delta * lscvect)
+# #matrix:
+# ############Xcwt2 <- matrix(0.0, nrow= n, ncol= 2 + delta * lscvect)
 # #Xcwt2 <- matrix(NA_complex_, nrow= n, ncol= 2 + length((c(Xcwt4[,,1]))))
 # 
+# #NOTE: delta et lscvect pourraient etre gardés à part (communs)
 # for(i in 1:n) 
 #  Xcwt2[i,] <- c(delta, lscvect, Xcwt4[,,i] / max(Mod(Xcwt4[,,i])) ) 
 #