# Spike train generation¶

Functions to generate/extract spike trains from analog signals, or to generate random spike trains.

## Extract spike times from time series¶

`spike_extraction` (signal[, threshold, sign, ...]) |
Return the peak times for all events that cross threshold and the waveforms. |

`threshold_detection` (signal[, threshold, sign]) |
Returns the times when the analog signal crosses a threshold. |

`peak_detection` (signal[, threshold, sign, ...]) |
Return the peak times for all events that cross threshold. |

## Random spike train processes¶

`StationaryPoissonProcess` (rate[, t_stop, ...]) |
Generates spike trains whose spikes are realizations of a stationary Poisson process with the given rate, starting at time t_start and stopping at time t_stop. |

`StationaryGammaProcess` (rate, shape_factor[, ...]) |
Generates spike trains whose spikes are realizations of a stationary Gamma process with the given rate and shape_factor starting at time t_start and stopping at time t_stop. |

`StationaryLogNormalProcess` (rate, sigma[, ...]) |
Generates spike trains whose spikes are realizations of a stationary LogNormal process with the given rate and sigma starting at time t_start and stopping at time t_stop. |

`StationaryInverseGaussianProcess` (rate, cv[, ...]) |
Generates spike trains whose spikes are realizations of a stationary Gamma process with the given rate and cv starting at time t_start and stopping at time t_stop. |

`NonStationaryPoissonProcess` (rate_signal[, ...]) |
Generates spike trains whose spikes are realizations of a non-stationary Poisson process with the given rate-signal. |

`NonStationaryGammaProcess` (rate_signal, ...) |
Generates spike trains whose spikes are realizations of a non-stationary Gamma process with the given rate-signal. |

## Coincident spike times generation¶

`single_interaction_process` (rate, ...[, ...]) |
Generates a multidimensional Poisson SIP (single interaction process) plus independent Poisson processes [gen3]. |

`compound_poisson_process` (rate, ...[, shift, ...]) |
Generate a Compound Poisson Process (CPP; see [gen2]) with a given amplitude_distribution and stationary marginal rates rate. |

Some functions are based on the NeuroTools stgen module, which was mostly written by Eilif Muller, or from the NeuroTools signals.analogs module.

### References¶

[gen1] | Moritz Deger, Moritz Helias, Clemens Boucsein, and Stefan Rotter. Statistical properties of superimposed stationary spike trains. Journal of Computational Neuroscience, 32(3):443–463, 2012. |

[gen2] | Benjamin Staude, Stefan Rotter, and Sonja Grün. Cubic: cumulant based inference of higher-order correlations in massively parallel spike trains. Journal of computational neuroscience, 29(1-2):327–350, 2010. |

[gen3] | Alexandre Kuhn, Ad Aertsen, and Stefan Rotter. Higher-order statistics of input ensembles and the response of simple model neurons. Neural computation, 15(1):67–101, 2003. |