@@ -12,11 +12,16 @@ def __init__(self, **entries):
1212
1313
1414def analyse_network_simulation (spike_monitors , state_monitors , synapses , p , output_folder = None ):
15+ """
16+ Does an analysis of a simulation post-run. Saves plots to `output_folder`
17+ Returns the results of simulation analysis
18+ """
19+
1520 spike_mon_sst , spike_mon_pv , spike_mon_cs , spike_mon_cc = spike_monitors
1621 state_mon_sst , state_mon_pv , state_mon_cs , state_mon_cc = state_monitors
1722
1823 ################################################################################
19- # Analysis and plotting
24+ # Compute equilibrium time of simulation
2025 ################################################################################
2126
2227 if p .recompute_equilibrium :
@@ -41,6 +46,10 @@ def analyse_network_simulation(spike_monitors, state_monitors, synapses, p, outp
4146 from_t = equilibrium_t
4247 to_t = p .duration
4348
49+ ################################################################################
50+ # Analysis and plotting
51+ ################################################################################
52+
4453 raster_from_t = from_t if p .plot_only_from_equilibrium else 0
4554 raster_to_t = min (raster_from_t + 3 * second , p .duration )
4655 plot_raster (spike_mon_cs , spike_mon_cc , spike_mon_sst , spike_mon_pv , raster_from_t , raster_to_t ,
@@ -140,6 +149,11 @@ def analyse_network_simulation(spike_monitors, state_monitors, synapses, p, outp
140149
141150
142151def run_simulation_without_exh_dendrite (network , neurons , synapses , p , base_output_folder , use_synaptic_probabilities ):
152+ """
153+ Runs simulation for network topology with PYR cells having ONLY somas and NO dendrites.
154+ Also analyses simulation run and returns results.
155+ """
156+
143157 sst_neurons , pv_neurons , cs_neurons , cc_neurons = neurons
144158
145159 E_l = p .E_l # leak reversal potential
@@ -218,6 +232,13 @@ def run_simulation_without_exh_dendrite(network, neurons, synapses, p, base_outp
218232
219233
220234def run_simulation_for_weighted_sst_soma_dendrite (network , neurons , synapses , p , p_SST_CS_soma , p_SST_CC_soma , base_output_folder , use_synaptic_probabilities ):
235+ """
236+ Runs simulation for network topology with PYR cells having BOTH somas and dendrites.
237+ Connection probability of SST->CC/CS Soma is weighted through parameters `p_SST_CS_soma` and `p_SST_CC_soma`
238+ Connection probability of SST->CC/CS Dendrite is given by `1 - p_SST_CS_soma` and `1 - p_SST_CC_soma`
239+ Also analyses simulation run and returns results.
240+ """
241+
221242 sst_neurons , pv_neurons , cs_neurons , cc_neurons = neurons
222243
223244 E_l = p .E_l # leak reversal potential
@@ -315,13 +336,20 @@ def run_simulation_for_weighted_sst_soma_dendrite(network, neurons, synapses, p,
315336
316337
317338def run_simulation_for_input (params , use_synaptic_probabilities , use_dendrite_model , seed_val , base_output_folder = None ):
339+ """
340+ Given external input and network parameters (through `params`) simulations are run accordingly.
341+ If `use_dendrite_model` multiple simulations are run for each (pSST_CS_soma, pSST_CC_soma) pairs
342+ If NOT `use_dendrite_model` a single simulation is run.
343+ Returns vector of results of simulations
344+ """
345+
318346 p = Struct (** params )
319347
320348 start_scope ()
321349 seed (seed_val )
322350
323351 E_l = p .E_l # leak reversal potential
324- V_t = p .V_t # spiking threashold
352+ V_t = p .V_t # spiking threshold
325353
326354 assert len (p .pSST_CS_soma ) == len (p .pSST_CC_soma ) # since they are taken in pairs
327355
@@ -410,7 +438,7 @@ def run_simulation_for_input(params, use_synaptic_probabilities, use_dendrite_mo
410438 neurons = [sst_neurons , pv_neurons , cs_neurons , cc_neurons ]
411439
412440 # ##############################################################################
413- # Define Synapses
441+ # Define Synapses (common synapses for simulation)
414442 # ##############################################################################
415443
416444 synapses = {}
@@ -510,6 +538,10 @@ def run_simulation_for_input(params, use_synaptic_probabilities, use_dendrite_mo
510538
511539 defaultclock .dt = p .sim_dt
512540
541+ # ##############################################################################
542+ # Continue defining specific simulation run
543+ # ##############################################################################
544+
513545 results = []
514546 if use_dendrite_model :
515547 for p_SST_CS_soma , p_SST_CC_soma in zip (p .pSST_CS_soma , p .pSST_CC_soma ):
@@ -532,6 +564,12 @@ def run_simulation_for_input(params, use_synaptic_probabilities, use_dendrite_mo
532564
533565
534566def run_complete_simulation (params , use_dendrite_model = True , use_synaptic_probabilities = True , seed_val = 12345 ):
567+ """
568+ Runs a complete simulation for given parameters.
569+ Computes both individual simulation results and aggregated simulation results.
570+ Selectivity of network is calculated through varying external input to neurons.
571+ """
572+
535573 p = Struct (** params )
536574
537575 N = [p .N_cs , p .N_cc , p .N_sst , p .N_pv ]
0 commit comments