Skip to content

Commit 45c5190

Browse files
author
Ari Strandburg-Peshkin
committed
added functionality to ignore noisy synch calls
1 parent da1f9c6 commit 45c5190

2 files changed

+14
-2
lines changed

R/meerkat_synch_audio_file_labels_to_UTC.R

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#' @param make_plot whether to also output a plot showing the synchs in time in recording vs talking clock time, with the final fit and outliers indicated
2121
#' @param handle_special_cases whether (`T` or `F`) to handle a few special cases in the synch info table, such as when the synch clock stopped or when two synch clocks were around due to a group split with rovers - these cases had to be hardcoded in. this parameter should always be set to `T` for meerkat data
2222
#' @param quadratic_fit whether (`T` or `F`) to perform a quadratic fit to the synchs
23+
#' @param remove_noisy_synchs whether (`T` or `F`) to remove synchs that are labeled as noisy (will remove everything that has an x, not case sensitive)
2324
#'
2425
#' @returns Returns a list containing:
2526
#'
@@ -72,7 +73,8 @@ meerkat_synch_audio_file_labels_to_UTC <- function(path_to_label_file,
7273
min_frac_spanned_by_synchs = 0.2,
7374
make_plot = T,
7475
handle_special_cases = T,
75-
quadratic_fit = F){
76+
quadratic_fit = F,
77+
remove_noisy_synchs = T){
7678

7779
#----READ IN LABELS----
7880

@@ -196,6 +198,13 @@ meerkat_synch_audio_file_labels_to_UTC <- function(path_to_label_file,
196198
#find synchs
197199
synchs <- labels[grep('sync', labels$Name, ignore.case = T),]
198200

201+
#remove noisy synchs
202+
if(remove_noisy_synchs){
203+
if(length(grep('x', synchs$Name, ignore.case = T)) > 0){
204+
synchs <- synchs[-grep('x', synchs$Name, ignore.case = T),]
205+
}
206+
}
207+
199208
#get times of synchs, according to the talking clock (in sec)
200209
#talking clock labels are in auditon format, so can use audition parsing function
201210
if(nrow(synchs)>0){

man/meerkat_synch_audio_file_labels_to_UTC.Rd

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)