From 336614614eab6ad3684f3a5f79d76532d3204e01 Mon Sep 17 00:00:00 2001 From: samadpls Date: Tue, 20 Aug 2024 16:28:16 +0500 Subject: [PATCH] Enh: visualization of dipole responses in plot_batch_simulate Co-authored-by: Nicholas Tolley <55253912+ntolley@users.noreply.github.com> Signed-off-by: samadpls --- examples/howto/plot_batch_simulate.py | 32 ++++++++++----------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/examples/howto/plot_batch_simulate.py b/examples/howto/plot_batch_simulate.py index 7a5692be8..10dfbd618 100644 --- a/examples/howto/plot_batch_simulate.py +++ b/examples/howto/plot_batch_simulate.py @@ -30,7 +30,6 @@ # - `evprox` indicates a proximal drive, targeting dendrites near the cell # bodies. # - `mu=40` and `sigma=5` define the timing (mean and spread) of the input. -# - `numspikes=1` means it's a single, brief stimulation. # - `weights_ampa` and `synaptic_delays` control the strength and # timing of the input. # @@ -127,22 +126,15 @@ def summary_func(results): # batch simulation. Each line represents a different set of synaptic strength # parameters (`weight_basket`), allowing us to visualize the range of responses # across the parameter space. -# The colormap represents different synaptic strengths, with purple indicating -# lower strengths and yellow indicating higher strengths. +# The colormap represents synaptic strengths, from weaker (purple) +# to stronger (yellow). # -# Key observations: -# -# - The dipole signal reflects the net current flow in the cortical column. -# - Initially, we see a positive deflection as excitatory input arrives at -# the proximal dendrites, causing current to flow upwards -# (away from the soma). -# - The subsequent negative deflection, despite continued excitatory input, -# occurs when action potentials are triggered, causing rapid current flow in -# the opposite direction as the cell bodies depolarize. -# - Inhibitory neurons, when they fire, can also contribute to negative -# deflections by causing hyperpolarization in their target neurons. -# - Later oscillations likely represent ongoing network activity and -# subthreshold membrane potential fluctuations. +# As drive strength increases, dipole responses show progressively larger +# amplitudes and more distinct features, reflecting heightened network +# activity. Weak drives (purple lines) produce smaller amplitude signals with +# simpler waveforms, while stronger drives (yellow lines) generate +# larger responses with more pronounced oscillatory features, indicating +# more robust network activity. # # The y-axis represents dipole amplitude in nAm (nanoAmpere-meters), which is # the product of current flow and distance in the neural tissue. @@ -159,11 +151,11 @@ def summary_func(results): plt.figure(figsize=(10, 6)) cmap = plt.get_cmap('viridis') -param_values = np.array(param_values) -norm = plt.Normalize(param_values.min(), param_values.max()) +log_param_values = np.log10(param_values) +norm = plt.Normalize(log_param_values.min(), log_param_values.max()) -for waveform, param in zip(dpl_waveforms, param_values): - color = cmap(norm(param)) +for waveform, log_param in zip(dpl_waveforms, log_param_values): + color = cmap(norm(log_param)) plt.plot(waveform, color=color, alpha=0.7, linewidth=2) plt.title('Overlay of Dipole Waveforms') plt.xlabel('Time (ms)')