Skip to contents

The jitter of an synaptic event (i.e. action potential, post-synaptic event) is calculated using difference between the stimulus time and the peak amplitude time (or start of the 20/80 rise).

Usage

add_event_jitter(df, to_rise = FALSE)

Arguments

df

Data Frame or Tibble, with the following columns:

  • time_ms

  • stim_times

to_rise

Logical, default is FALSE and jitter is calculated between the stimulus time to the peak amplitude, i.e. time_ms. If TRUE the rise time, rise_ms, will be subtracted from the time of peak amplitude, thus calculating jitter to the start the 20/80 rise time.

Value

Data Frame or Tibble with numeric column, jitter, in milliseconds.

Examples

simple_df <- data.frame(
  sweep = as.ordered(rep(1:2, c(4, 5))),
  time_ms = c(405, 408, NA, 445, seq(405, 445, 10)),
  rise_ms = rep(0.5, 9),
  stimulus = ordered(c(1, 1, 2, "r", 1, 2, "o", "o", "r"), levels = c(1, 2, "o", "r")),
  stim_times = c(400, 400, 410, 440, 400, 410, NA, NA, 440)
)

add_event_jitter(simple_df)
#>   sweep time_ms rise_ms stimulus stim_times jitter
#> 1     1     405     0.5        1        400      5
#> 2     1     408     0.5        1        400      8
#> 3     1      NA     0.5        2        410     NA
#> 4     1     445     0.5        r        440      5
#> 5     2     405     0.5        1        400      5
#> 6     2     415     0.5        2        410      5
#> 7     2     425     0.5        o         NA     NA
#> 8     2     435     0.5        o         NA     NA
#> 9     2     445     0.5        r        440      5