\HeaderA{bursts}{Burst detection of MEA spike trains.}{bursts}
\aliasA{spikes.to.bursts}{bursts}{spikes.to.bursts}
\methaliasA{spikes.to.bursts.surprise}{bursts}{spikes.to.bursts.surprise}
\keyword{Burst analysis, MEA analysis}{bursts}
\begin{Description}\relax
For a set of spike trains in an MEA recording, find the
bursts independently within each spike train.
\end{Description}
\begin{Usage}
\begin{verbatim}
spikes.to.bursts(s, method="si")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{s}] MEA data structure
\item[\code{method}] A string, either "si" (surprise method), "mi"
(maxinterval), "logisi" (Log ISI histogram).
\end{ldescription}
\end{Arguments}
\begin{Value}
Return the "all bursts" data structure.  This is a list of matrices,
giving the burst information for each electrode.

Each matrix stores basic information about each burst.  There is one
row for every burst, with the following columns:

\Tabular{ll}{
beg & index of the first spike in the burst \\
len &  number of spikes in this burst \\
SI &  surprise index (calculated only for the surprise method)\\
durn &  duration (in s) of the burst\\
mean.isis &  mean of all interspike intervals.\\
}

If no bursts could be found within a spike train, the value NA is used
rather than an empty matrix.
\end{Value}
\begin{Examples}
\begin{ExampleCode}
data.file <- system.file("examples", "TC89_DIV15_A.nexTimestamps",
package = "sjemea")
s <- sanger.read.spikes(data.file)
s$allb <- spikes.to.bursts.surprise(s)
if (interactive()) spikeview(s)
\end{ExampleCode}
\end{Examples}

