population_activity

population_activity#

class braintools.visualize.population_activity(data, time=None, dt=None, method='mean', window_size=None, neuron_ids=None, ax=None, figsize=(10, 6), color='blue', alpha=0.7, fill=True, xlabel='Time', ylabel=None, title=None, **kwargs)#

Plot population activity over time.

Parameters:
  • data (ndarray) – Neural activity data of shape (time, neurons) or (time,).

  • time (ndarray | None) – Time array. If None, uses indices.

  • dt (float | None) – Time step. Used if time is None.

  • method (str) – Aggregation method: ‘mean’, ‘sum’, ‘std’, ‘var’, ‘median’.

  • window_size (int | None) – Size of sliding window for smoothing.

  • neuron_ids (ndarray | None) – Specific neuron IDs to include.

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

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

  • color (str) – Line color.

  • alpha (float) – Alpha transparency.

  • fill (bool) – Whether to fill area under curve.

  • 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 plot.

Returns:

ax – The axes object containing the plot.

Return type:

Axes