Skip to content

Commit e1edb6c

Browse files
samadplsntolley
andcommitted
Enh: visualization of dipole responses in plot_batch_simulate
Co-authored-by: Nicholas Tolley <[email protected]> Signed-off-by: samadpls <[email protected]>
1 parent caddec0 commit e1edb6c

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

examples/howto/plot_batch_simulate.py

+12-20
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
# - `evprox` indicates a proximal drive, targeting dendrites near the cell
3131
# bodies.
3232
# - `mu=40` and `sigma=5` define the timing (mean and spread) of the input.
33-
# - `numspikes=1` means it's a single, brief stimulation.
3433
# - `weights_ampa` and `synaptic_delays` control the strength and
3534
# timing of the input.
3635
#
@@ -127,22 +126,15 @@ def summary_func(results):
127126
# batch simulation. Each line represents a different set of synaptic strength
128127
# parameters (`weight_basket`), allowing us to visualize the range of responses
129128
# across the parameter space.
130-
# The colormap represents different synaptic strengths, with purple indicating
131-
# lower strengths and yellow indicating higher strengths.
129+
# The colormap represents synaptic strengths, from weaker (purple)
130+
# to stronger (yellow).
132131
#
133-
# Key observations:
134-
#
135-
# - The dipole signal reflects the net current flow in the cortical column.
136-
# - Initially, we see a positive deflection as excitatory input arrives at
137-
# the proximal dendrites, causing current to flow upwards
138-
# (away from the soma).
139-
# - The subsequent negative deflection, despite continued excitatory input,
140-
# occurs when action potentials are triggered, causing rapid current flow in
141-
# the opposite direction as the cell bodies depolarize.
142-
# - Inhibitory neurons, when they fire, can also contribute to negative
143-
# deflections by causing hyperpolarization in their target neurons.
144-
# - Later oscillations likely represent ongoing network activity and
145-
# subthreshold membrane potential fluctuations.
132+
# As drive strength increases, dipole responses show progressively larger
133+
# amplitudes and more distinct features, reflecting heightened network
134+
# activity. Weak drives (purple lines) produce smaller amplitude signals with
135+
# simpler waveforms, while stronger drives (yellow lines) generate
136+
# larger responses with more pronounced oscillatory features, indicating
137+
# more robust network activity.
146138
#
147139
# The y-axis represents dipole amplitude in nAm (nanoAmpere-meters), which is
148140
# the product of current flow and distance in the neural tissue.
@@ -159,11 +151,11 @@ def summary_func(results):
159151

160152
plt.figure(figsize=(10, 6))
161153
cmap = plt.get_cmap('viridis')
162-
param_values = np.array(param_values)
163-
norm = plt.Normalize(param_values.min(), param_values.max())
154+
log_param_values = np.log10(param_values)
155+
norm = plt.Normalize(log_param_values.min(), log_param_values.max())
164156

165-
for waveform, param in zip(dpl_waveforms, param_values):
166-
color = cmap(norm(param))
157+
for waveform, log_param in zip(dpl_waveforms, log_param_values):
158+
color = cmap(norm(log_param))
167159
plt.plot(waveform, color=color, alpha=0.7, linewidth=2)
168160
plt.title('Overlay of Dipole Waveforms')
169161
plt.xlabel('Time (ms)')

0 commit comments

Comments
 (0)