Burst Encoding Algorithm

burst_encoding(signal: ndarray, n_max: int, t_min: int, t_max: int, length: int) ndarray[source]

Perform burst encoding on the input signal.

This function encodes the input signal by generating bursts of spikes based on the number of spikes and the inter-spike interval (ISI). The encoding process takes into account the maximum number of spikes (n_max), the minimum (t_min) and maximum (t_max) ISI, and the desired length of the encoded signal.

Refer to the Burst Encoding for a detailed explanation of the Burst Encoding Algorithm.

Code Example:

import numpy as np
from spikify.encoding.temporal.latency import burst_encoding
np.random.seed(42)
signal = np.random.rand(16)
n_max = 4
t_min = 2
t_max = 6
length = 16
encoded_signal = burst_encoding(signal, n_max, t_min, t_max, length)
Parameters:
  • signal (numpy.ndarray) – The input signal to be encoded. This should be a numpy ndarray.

  • n_max (int) – The maximum number of spikes in each burst.

  • t_min (int) – The minimum inter-spike interval (ISI).

  • t_max (int) – The maximum inter-spike interval (ISI).

  • length (int) – The total length of the encoded signal.

Returns:

A 1D numpy array representing the burst-encoded spike train.

Return type:

numpy.ndarray

Raises:
  • ValueError – If the input signal is empty or the length is not a multiple of the signal length.

  • ValueError – If the required spike train length exceeds the provided length.