R/plot_Ana.R

Defines functions plotAna getAnadef

plotAna <- function(sweep_data,
                    anaDef = getAnadef(sweep_data),
                    sweeps = 1:ncol(sweep_data$y),
                    xlim = getAnadef(sweep_data)$cursors$zoom$range,
                    ...) {
  # if only one sweep is slected, we have to select the correct eventcursors
  if(length(sweeps)==1){
    swp<-paste0("s",sweeps,":")
  }else{
    swp=NA
  }
  anaDef$cursors <- series_events(anaDef$cursors, sweep_data, swp)
  if (is.null(anaDef$plot.fun)) {
    anaDef$plot.fun <- default.plot.fun
  }
  sweep_data2 <- calculate.cursors(sweep_data, anaDef)
  anaDef$plot.fun(
    sweeps_data = sweep_data2,
    cursors = anaDef$cursors,
    sweeps = sweeps,
    xlim = xlim,
    ...
  )
  
  
  
}








getAnadef <- function(sweep_data) {
    if (exists("CURSORS")) {
        CURSORS[[sweep_data$Stimulus]]
    } else {
      NULL
    }
}
tdanker/ephys2 documentation built on Aug. 11, 2019, 12:12 p.m.