elephant.change_point_detection.empirical_parameters(window_sizes, t_final, alpha, n_surrogates=1000, time_step=None)[source]

This function generates the threshold and the null parameters. The filter processes (h) have been proved to converge (for t_final, h \to \infty) to a continuous functional of a Brownian motion (‘limit_process’). Using a MonteCarlo technique, maxima of these limit_processes are collected.

The threshold is defined as the alpha quantile of this set of maxima. Namely:

test_quantile := alpha quantile of {\max_{h \in \text{window\_sizes}} \max_{t \in [h, t_{final}-h]}

window_sizeslist of pq.Quantity

list that contains windows sizes


The final time of the spike train which is to be analysed


Alpha-quantile in range [0, 100] for the set of maxima of the limit processes

n_surrogatesint, optional

The number of simulated limit processes. Default: 1000

time_steppq.Quantity or None, optional

The resolution - the time step at which the windows are slided. If None, will be set to window_size / 20. Default: None


The threshold for the maxima of the filter derivative processes; if any of these maxima is larger than this value, it is assumed the presence of a change point (cp) at the time corresponding to that maximum.

test_param(3, num. of windows) np.ndarray

first row: list of h, second and third rows: empirical means and variances of the limit process corresponding to h. This will be used to normalize the filter processes in order to give to the every maximum the same impact on the global statistic.


>>> import quantities as pq
>>> from elephant.change_point_detection import empirical_parameters
>>> test_quantile, test_param = empirical_parameters(
...     window_sizes=[0.5] * pq.s, t_final=2.1 * pq.s, alpha=5,
...     n_surrogates=100, time_step=0.1 * pq.s)
>>> test_quantile
>>> test_param
array([[0.5       ],