src.canns.analyzer.plotting.tuning

Tuning curve visualization utilities.

Functions

tuning_curve(stimulus, firing_rates, neuron_indices[, ...])

Plot the tuning curve for one or more neurons.

Module Contents

src.canns.analyzer.plotting.tuning.tuning_curve(stimulus, firing_rates, neuron_indices, config=None, *, pref_stim=None, num_bins=50, title='Tuning Curve', xlabel='Stimulus Value', ylabel='Average Firing Rate', figsize=(10, 6), save_path=None, show=True, **kwargs)[source]

Plot the tuning curve for one or more neurons.

The wording mirrors the original visualize module to avoid API drift and to keep existing references valid.

Parameters:
  • stimulus (numpy.ndarray) – 1D array with the stimulus value at each time step.

  • firing_rates (numpy.ndarray) – 2D array of firing rates shaped (timesteps, neurons).

  • neuron_indices (numpy.ndarray | int) – Integer or iterable of neuron indices to analyse.

  • config (src.canns.analyzer.plotting.config.PlotConfig | None) – Optional PlotConfig containing styling overrides.

  • pref_stim (numpy.ndarray | None) – Optional 1D array of preferred stimuli used in legend text.

  • num_bins (int) – Number of bins when mapping stimulus to mean activity.

  • title (str) – Plot title when config is not provided.

  • xlabel (str) – X-axis label when config is not provided.

  • ylabel (str) – Y-axis label when config is not provided.

  • figsize (tuple[int, int]) – Figure size forwarded to Matplotlib when creating the axes.

  • save_path (str | None) – Optional location where the figure should be stored.

  • show (bool) – Whether to display the plot interactively.

  • **kwargs (Any) – Additional keyword arguments passed through to ax.plot.