Skip to contents

Randomly generates splices from a splicing table and calculates average cross power for each segment and splice. Calculates the mean average cross power over the random splices for each segment and period. Compares with the average cross power for the original splice.

Usage

ave_cross_power_over_splices(
  jv,
  splicing_df,
  num_splices,
  columns,
  sampling_type = "offset",
  rejection_list = list(),
  include_original = TRUE,
  show_plot = TRUE
)

Arguments

jv

JoinedView object.

splicing_df

Splice object.

num_splices

number of randomly chosen splices.

columns

name of data columns on which to calculate average cross power.

sampling_type

either 'offset' or 'gap'.

rejection_list

list of splice objects that random splices must not overlap.

include_original

include the original splice in output? (Default is TRUE).

show_plot

show a plot? (Default is TRUE).

Value

data.frame of splice segments and their average cross power.

Examples

r <- get_sample_recording()
fv_list <- get_filtered_views(r, data_points = "Nose", n = 41, p = 3)
jv <- get_joined_view(fv_list)

d <- get_duration_annotation_data(r)
splicing_tabla_solo_df <- splice_time(d,
  expr = "Tier == 'INTERACTION' & Comments == 'Mutual look and smile'")

# Only do the first splice for sample data
mean_ave_cross_power_df <- ave_cross_power_over_splices(jv,
  splicing_tabla_solo_df[1,], num_splices = 10,
  columns = c('Nose_x_Central_Sitar', 'Nose_y_Central_Sitar'), show_plot = TRUE)
#> Accepted splices: 9
#> Accepted splices: 18
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%