move selectiontotale to appropriate folder (untranslated)
[valse.git] / src / test / generate_test_data / generateRunSaveTest_selectiontotale.R
1 generateRunSaveTest_selectiontotale= function(n=200, p=15, m=10, k=3, mini=5, maxi=10, gamma=1.0,
2 glambda=list(0.0,0.01,0.02,0.03,0.05,0.1,0.2,0.3,0.5,0.7,0.85,0.99))
3 {
4 tau = 1e-6;
5 seuil = 1e-15;
6 require(valse)
7 params = valse:::basicInitParameters(n, p, m, k)
8 xy = valse:::generateXYdefault(n, p, m, k)
9 L = length(glambda)
10
11 testFolder = "data/"
12 dir.create(testFolder, showWarnings=FALSE, mode="0755")
13 #save inputs
14 write.table(as.double(params$phiInit), paste(testFolder,"phiInit",sep=""),
15 row.names=F, col.names=F)
16 write.table(as.double(params$rhoInit), paste(testFolder,"rhoInit",sep=""),
17 row.names=F, col.names=F)
18 write.table(as.double(params$piInit), paste(testFolder,"piInit",sep=""),
19 row.names=F, col.names=F)
20 write.table(as.double(params$gamInit), paste(testFolder,"gamInit",sep=""),
21 row.names=F, col.names=F)
22 write.table(as.integer(mini), paste(testFolder,"mini",sep=""),
23 row.names=F, col.names=F)
24 write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""),
25 row.names=F, col.names=F)
26 write.table(as.double(gamma), paste(testFolder,"gamma",sep=""),
27 row.names=F, col.names=F)
28 write.table(as.double(glambda), paste(testFolder,"lambda",sep=""),
29 row.names=F, col.names=F)
30 write.table(as.double(xy$X), paste(testFolder,"X",sep=""),
31 row.names=F, col.names=F)
32 write.table(as.double(xy$Y), paste(testFolder,"Y",sep=""),
33 row.names=F, col.names=F)
34 write.table(as.double(seuil), paste(testFolder,"seuil",sep=""),
35 row.names=F, col.names=F)
36 write.table(as.double(tau), paste(testFolder,"tau",sep=""),
37 row.names=F, col.names=F)
38 write.table(as.integer(c(n,p,m,k,L)), paste(testFolder,"dimensions",sep=""),
39 row.names=F, col.names=F)
40
41 res = selectiontotale(params$phiInit,params$rhoInit,params$piInit,params$gamInit,
42 mini,maxi,gamma,glambda,xy$X,xy$Y,seuil, tau)
43
44 #save output
45 write.table(as.double(res$A1), paste(testFolder,"A1",sep=""), row.names=F, col.names=F)
46 write.table(as.double(res$A2), paste(testFolder,"A2",sep=""), row.names=F, col.names=F)
47 write.table(as.double(res$rho), paste(testFolder,"rho",sep=""), row.names=F, col.names=F)
48 write.table(as.double(res$pi), paste(testFolder,"pi",sep=""), row.names=F, col.names=F)
49 }