function [ bmp, s2, s2S ] = isbump( x, y, time, ind, window, Qt, s2S )
% isbump finds out whether there is a bump in a time interval.
% The criterion for having a bump is that the standard deviation
% surpasses an empirically found (but arbitrary) threshold of 1.5.
% Variance of activity is measured as the average variance in time
% windows of size window to eliminate effects of bump drift.
%
% x : Vector with action potential time points
% y : Vector with action potential angles, or whatever
% time : 2-vector with beginning and end of measure
% ind : vectors with cell indices of interest
% window : Time window in which variance is measured
% Qt : Time window for spontaneous activity is 500 ms <= t < Qt
s2 = 0;
% Find only action potentials of interest
yind = [];
for i = 1:length( ind )
yind = [ yind find( y == ind(i) ) ];
end
x = x(ind);
y = y(ind);
% Calculate standard deviation of spontaneous activity if none exists
if nargin < 7
s2S = 0;
timS = 500:window:Qt;
cnt = 0;
for i = 1:length( timS ) -1
indt = find( x>=timS(i) & x 0
s2S = s2S / cnt;
else
s2S = 0
end
end
time = time(1):window:time(2);
cnt = 0;
for i = 1:length( time ) -1
indt = find( x>=time(i) & x