Details: If baseline window is of different duration to response window the baseline count is normalised to estimate the number of spikes that would have occurred during the response window. ie if you have a 1s response window and a 5s baseline window and you get 10 spikes in the response period and 5 spikes in the baseline period, the response will be returned as 10-5/5 = 9 spikes.

OdourResponseFromSpikes(spiketimes, responseWindow,
  baselineWindow = NULL, freq = FALSE)

Arguments

spiketimes

list of spiketimes collected by CollectSpikesFromSweeps

responseWindow

vector of start and end time of odour response (in ms)

baselineWindow

vector of start and end time of baseline period (in ms)

freq

Calculate Spike rate in Hz rather than number of spikes per response window

Value

dataframe with a column for each odour and row for each sweep

See also

Other OdourResponse: PlotOdourResponseFromSpikes

Examples

spikes=CollectSpikesFromSweeps( system.file('igor','spikes','nm20110914c4',package='gphys'), subdir='BLOCKI',sweeps=0:4) od=OdourResponseFromSpikes(spikes,response=c(2200,2700),baseline=c(0,2000)) summary(od)
#> ctr fly 4ol cVA #> Min. :-1.50 Min. :-1.25 Min. :-1.50 Min. :-1.75 #> 1st Qu.:-0.75 1st Qu.:-0.75 1st Qu.:-1.00 1st Qu.:-1.00 #> Median :-0.25 Median :-0.75 Median :-0.50 Median :-0.50 #> Mean :-0.35 Mean :-0.65 Mean :-0.75 Mean :-0.65 #> 3rd Qu.: 0.00 3rd Qu.:-0.25 3rd Qu.:-0.50 3rd Qu.: 0.00 #> Max. : 0.75 Max. :-0.25 Max. :-0.25 Max. : 0.00 #> IAA PAA #> Min. :-1.25 Min. :18.0 #> 1st Qu.:-0.25 1st Qu.:20.0 #> Median :-0.25 Median :20.5 #> Mean : 0.10 Mean :21.1 #> 3rd Qu.: 0.25 3rd Qu.:23.0 #> Max. : 2.00 Max. :24.0
apply(od,2,function(x) c(mean=mean(x),sd=sd(x)))
#> ctr fly 4ol cVA IAA PAA #> mean -0.3500000 -0.65000 -0.75 -0.6500000 0.100000 21.100000 #> sd 0.8403868 0.41833 0.50 0.7416198 1.193734 2.408319
# show baseline response frequency only (by treating that as response) od2=OdourResponseFromSpikes(spikes,response=c(0,2000),freq=TRUE) summary(od2)
#> ctr fly 4ol cVA IAA #> Min. :0.0 Min. :0.5 Min. :0.5 Min. :0.0 Min. :0.5 #> 1st Qu.:0.5 1st Qu.:0.5 1st Qu.:1.0 1st Qu.:0.0 1st Qu.:0.5 #> Median :0.5 Median :1.5 Median :1.0 Median :1.0 Median :1.5 #> Mean :1.1 Mean :1.3 Mean :1.5 Mean :1.3 Mean :1.4 #> 3rd Qu.:1.5 3rd Qu.:1.5 3rd Qu.:2.0 3rd Qu.:2.0 3rd Qu.:2.0 #> Max. :3.0 Max. :2.5 Max. :3.0 Max. :3.5 Max. :2.5 #> PAA #> Min. :0.0 #> 1st Qu.:1.0 #> Median :2.0 #> Mean :1.8 #> 3rd Qu.:2.0 #> Max. :4.0