Addition of parallel calculation scripts for the indices of P1 & P2 on the cluster
This commit is contained in:
parent
2a96d6aa48
commit
1e4b2d9d75
43
CLUSTER/indices-P1.r
Normal file
43
CLUSTER/indices-P1.r
Normal file
@ -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)
|
||||
|
||||
})
|
31
CLUSTER/indices-P2.r
Normal file
31
CLUSTER/indices-P2.r
Normal file
@ -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=""))
|
||||
|
||||
})
|
Loading…
Reference in New Issue
Block a user