From 1e4b2d9d75ed28572c5f42f98c0559c324f547be Mon Sep 17 00:00:00 2001 From: A-d-r-i Date: Tue, 28 Jul 2020 16:54:55 +0200 Subject: [PATCH] Addition of parallel calculation scripts for the indices of P1 & P2 on the cluster --- CLUSTER/indices-P1.r | 43 +++++++++++++++++++++++++++++++++++++++++++ CLUSTER/indices-P2.r | 31 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 CLUSTER/indices-P1.r create mode 100644 CLUSTER/indices-P2.r diff --git a/CLUSTER/indices-P1.r b/CLUSTER/indices-P1.r new file mode 100644 index 0000000..9afadf0 --- /dev/null +++ b/CLUSTER/indices-P1.r @@ -0,0 +1,43 @@ +library(parallel) +soundRep<-"../sound/" +ResultRep<-"../result/" +ListSound<-dir(soundRep) + +#### PARALLELE #### +no_cores<-detectCores() +c2<-makeCluster(no_cores) + +parLapply(c2,ListSound, function(x){ + + library(tuneR) + library(seewave) + + source("AcouIndexAlpha.r") + + soundRep<-"../sound/" + ResultRep<-"../result/" + ListSound<-dir(soundRep) + + TableTotal<-NULL + + a=0 + b=1 + for (i in 1: 6) + { + wave<-readWave(paste(soundRep,x, sep="/"),from=a,to=b,units="minutes") + Result<-AcouIndexAlpha(wave, stereo=FALSE, min_freq = 1000, max_freq = 22000,anthro_min = 300, + anthro_max = 2000,bio_min=2000,bio_max=18000, wl=512, j=5, + AcouOccupancy=FALSE,Bioac=TRUE,Hf=FALSE,Ht=FALSE,H=FALSE,ACI=TRUE, + AEI_villa=FALSE,M=FALSE,NDSI=TRUE,ADI=FALSE,NP=TRUE) + + Result$Mono_left$ID<-paste(x,i, sep="_") + TableTotal<-rbind(TableTotal,Result$Mono_left) + a=a+10 + b=b+10 + } + + + + write.table(TableTotal,file=paste(ResultRep,"/",x,".csv", sep=""), sep=";", row.names = F) + +}) diff --git a/CLUSTER/indices-P2.r b/CLUSTER/indices-P2.r new file mode 100644 index 0000000..10dc005 --- /dev/null +++ b/CLUSTER/indices-P2.r @@ -0,0 +1,31 @@ +library(parallel) +soundRep<-"../sound/" +ResultRep<-"../result/" +ListSound<-dir(soundRep) + +#### PARALLELE #### +no_cores<-detectCores() +c2<-makeCluster(no_cores) + +parLapply(c2,ListSound, function(x){ + + library(tuneR) + library(seewave) + + source("AcouIndexAlpha.r") + + soundRep<-"../sound/" + ResultRep<-"../result/" + ListSound<-dir(soundRep) + + wave<-readWave(paste(soundRep,x, sep="/"),from=0,to=1,units="minutes") + Result<-AcouIndexAlpha(wave, stereo=FALSE, min_freq = 1000, max_freq = 22000,anthro_min = 300, + anthro_max = 2000,bio_min=2000,bio_max=18000, wl=512, j=5, + AcouOccupancy=FALSE,Bioac=TRUE,Hf=FALSE,Ht=FALSE,H=FALSE,ACI=TRUE, + AEI_villa=FALSE,M=FALSE,NDSI=TRUE,ADI=FALSE,NP=TRUE)$Mono_left + + #write.table(TableTotal,file=paste(ResultRep,"/",x,".csv", sep=""), sep=";", row.names = F) + Result$ID<-x + save(Result, file=paste(ResultRep,"/",x,".Rdata", sep="")) + +})