spike_histogram

Contents

spike_histogram#

class braintools.visualize.spike_histogram(spike_times, bins=50, time_range=None, bin_size=None, density=False, ax=None, figsize=(10, 6), color='blue', alpha=0.7, xlabel='Time', ylabel=None, title=None, **kwargs)#

Create histogram of spike times (PSTH - Peristimulus Time Histogram).

Parameters:
  • spike_times (ndarray | List) – Spike times or list of spike time arrays.

  • bins (int | ndarray) – Number of bins or bin edges.

  • time_range (Tuple[float, float] | None) – (start, end) time range for histogram.

  • bin_size (float | None) – Size of each bin. Alternative to bins parameter.

  • density (bool) – Whether to normalize to get density.

  • ax (Axes | None) – Axes to plot on.

  • figsize (Tuple[float, float]) – Figure size if creating new figure.

  • color (str) – Bar color.

  • alpha (float) – Alpha transparency.

  • xlabel (str) – Axis labels and title.

  • ylabel (str | None) – Axis labels and title.

  • title (str | None) – Axis labels and title.

  • **kwargs – Additional arguments passed to hist.

Returns:

ax – The axes object containing the plot.

Return type:

Axes