Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
######################################################################
# Code from Francomano et al. (IBIS 2023) #
######################################################################
# Input List Generation Script for Spectrogram and Index Calculation #
######################################################################
# Created by: Dante Francomano (dfrancomano@alumni.purdue.edu)
# Date: 20200131
######################################################################
######################################################################
# Load package
library(openxlsx)
# Create empty list
inputLists<-sapply(1:7,function(x) list(as.data.frame(matrix(NA,nrow=3456,ncol=8))))
# List sites
siteList<-c("PM_01","PM_02","PPA_02","PPA_03","PPA_05","PPA_06","PPA_07")
# Assign sites, sensors, dates, times, hypothetical file paths, channels, and sensitivities
for(i in 1:7)
{
colnames(inputLists[[i]])<-c("Site","Sensor","Date","Time","Hypothetical_Path_Stem","Hypothetical_Path","Channel","Sensitivity")
inputLists[[i]]$Site<-siteList[i]
overallPossibleDateTimes<-read.csv("E:/Dante/Penguins/Data_Coverage_Results/Isla_de_los_Estados_Overall.csv",colClasses=rep("factor",3))
inputLists[[i]]$Date<-overallPossibleDateTimes[,1]
inputLists[[i]]$Time<-overallPossibleDateTimes[,2]
sensorList<-c("S4A00449","S4A00440","S4A03851","S4A00466","S4A03852","S4A00436","S4A00433")
inputLists[[i]]$Sensor<-sensorList[i]
inputLists[[i]]$Hypothetical_Path_Stem<-paste("J:/Dante/Pinguinos/Datos_Acusticos/Isla_de_los_Estados/Trimmed_Data/",siteList[i],sep="")
inputLists[[i]]$Hypothetical_Path<-apply(inputLists[[i]],1,function(x) paste(x[5],"/",paste(x[2:4],collapse="_"),".wav",sep=""))
calibrationMeasurments<-read.xlsx("E:/Dante/Penguins/Calibration_Measurements.xlsx")
relevantRows<-calibrationMeasurments[which(calibrationMeasurments$IDLE.Site==siteList[i]),]
desiredRow<-which.min(abs(relevantRows$"Post-IDLE.Difference"))
inputLists[[i]]$Channel<-ifelse(desiredRow==1,"left","right")
inputLists[[i]]$Sensitivity<-rowMeans(relevantRows[desiredRow,6:7])
# Write results
write.csv(inputLists[[i]],paste("E:/Dante/Penguins/Input_Lists/IDLE_",siteList[i],".csv",sep=""))
}