#' Various filter functions
#'
#' @description filters for raw radiotracking data
#'
#' @author RadioTracking EU
#'
filter_data_length <- function(data,pulse_length){
return(subset(data, (duration>(pulse_length[1])) & (duration<(pulse_length[2]))))
}
calc_time_distance <- function(data){
#find for each receiver
list_of_receivers<-unique(data$receiver)
#and each frequency
list_of_frequencies<-unique(data$freq_tag)
#signals which appear betweeen time_distance[1] and time_distance[2] seconds
return_tmp<-NULL
for(i in list_of_receivers){
tmp1 <- subset(data,receiver==i)
for(k in list_of_frequencies){
tmp2<-subset(tmp1,freq_tag==k)
tmp2<-tmp2[order(tmp2$timestamp),]
#calculate the time distance between the impulses
if(nrow(tmp2)>1){
td<-diff(tmp2$timestamp)
if(attr(td,"units")=="secs"){
td<-c(td,td[length(td)])
tmp2<-cbind(tmp2,td=td)
return_tmp<-rbind(tmp2,return_tmp)
}
}
}
}
return(return_tmp)
}
temperature <- function(a, b, data){
#y=20,307*exp(0,0408*x)<=>ln(y)=ln(20,307)+0,0408*x<=>ln(y/20,307)/0,0408=x
data$temperature<-log(60/as.numeric(data$td)/a)/b
data
}
# output$timediffs_plot <- renderPlot({
# tmp<-calc_time_distance(filtered_data())
# #y=20,307*exp(0,0408*x)<=>ln(y)=ln(20,307)+0,0408*x<=>ln(y/20,307)/0,0408=x
# a<-input$temp_cal_a
# b<-input$temp_cal_b
# tmp$temperature<-log(60/as.numeric(tmp$td)/a)/b
# ggplot()+geom_point(aes(x=tmp$timestamp,y=tmp$temperature))+ylim(10,45)
# })
#pulse_bandwith=vector from to
filter_signal_bandwidth <- function(data,pulse_bandwidth){
return(subset(data, (data$signal_bw>(pulse_bandwidth[1])) & (data$signal_bw<(pulse_bandwidth[2]))))
}
filter_signal_strength <- function(data,pulse_strength){
data$max_signal[data$max_signal==-1000]<- (-60) # old rtlsdrdetect outputs for some reason -1000
return(subset(data, (data$max_signal>=pulse_strength[1]) &(data$max_signal<=pulse_strength[2]) ))
}
#freq=frequenze in khz, freq_error=1,
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.