spike_raster

Contents

spike_raster#

class braintools.visualize.spike_raster(spike_times, neuron_ids=None, time_range=None, neuron_range=None, color='black', marker='|', markersize=1.0, alpha=1.0, ax=None, figsize=(10, 6), xlabel='Time', ylabel='Neuron ID', title=None, show_stats=False, **kwargs)#

Create a spike raster plot for neural spike data.

Parameters:
  • spike_times (ndarray | List) – Array of spike times or list of spike time arrays for each neuron.

  • neuron_ids (ndarray | List | None) – Array of neuron IDs corresponding to spike_times. If None, assumes spike_times is a list with one array per neuron.

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

  • neuron_range (Tuple[int, int] | None) – (start, end) neuron ID range to display.

  • color (str | ndarray) – Color for spikes. Can be a single color or array of colors.

  • marker (str) – Marker style for spikes.

  • markersize (float) – Size of spike markers.

  • alpha (float) – Alpha transparency value.

  • ax (Axes | None) – Axes to plot on. If None, creates new figure.

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

  • xlabel (str) – Axis labels and title.

  • ylabel (str) – Axis labels and title.

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

  • show_stats (bool) – Whether to show firing rate statistics.

  • **kwargs – Additional arguments passed to scatter plot.

Returns:

ax – The axes object containing the plot.

Return type:

Axes