-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_demo.py
43 lines (28 loc) · 1.36 KB
/
init_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
init.py
Starting script to run NetPyNE-based A1 model.
Usage:
python init.py # Run simulation, optionally plot a raster
MPI usage:
mpiexec -n 4 nrniv -python -mpi init.py
Contributors: [email protected], [email protected]
"""
import matplotlib; matplotlib.use('Agg') # to avoid graphics error in servers
from netpyne import sim
cfg, netParams = sim.readCmdLineArgs(simConfigDefault='cfg_demo.py', netParamsDefault='netParams.py')
# sim.createSimulateAnalyze(netParams, cfg)
sim.initialize(
simConfig = cfg,
netParams = netParams) # create network object and set cfg and net params
sim.net.createPops() # instantiate network populations
sim.net.createCells() # instantiate network cells based on defined populations
sim.net.connectCells() # create connections between cells based on params
sim.net.addStims() # add network stimulation
sim.setupRecording() # setup variables to record for each cell (spikes, V traces, etc)
sim.runSim() # run parallel Neuron simulation
sim.gatherData() # gather spiking data and cell info from each node
# distributed saving (to avoid errors with large output data)
#sim.saveDataInNodes()
#sim.gatherDataFromFiles()
sim.saveData()
sim.analysis.plotData() # plot spike raster etc