-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnetParams.py
122 lines (100 loc) · 4.8 KB
/
netParams.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
"""
netParams.py
... model using NetPyNE
Contributors: conrad.bittencourt@gmail.com, fernandodasilvaborges@gmail.com
"""
from netpyne import specs
import os
import numpy as np
netParams = specs.NetParams() # object of class NetParams to store the network parameters
try:
from __main__ import cfg # import SimConfig object with params from parent module
except:
from cfg import cfg
#------------------------------------------------------------------------------
#
# NETWORK PARAMETERS
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# General network parameters
#------------------------------------------------------------------------------
netParams.scale = 1.0 # Scale factor for number of cells
netParams.sizeX = 100.0 # x-dimension (horizontal length) size in um
netParams.sizeY = 100.0 # y-dimension (vertical height or cortical depth) size in um
netParams.sizeZ = 100.0 # z-dimension (horizontal depth) size in um
netParams.shape = 'cylinder' # cylindrical (column-like) volume
netParams.propVelocity = 300.0 # propagation velocity (um/ms)
netParams.probLengthConst = 10.0 # length constant for conn probability (um)
#------------------------------------------------------------------------------
# Cell parameters
#------------------------------------------------------------------------------
for cellName in cfg.allcells:
cellRule = netParams.importCellParams(label=cellName + '_rule', somaAtOrigin=False,
conds={'cellType': cellName, 'cellModel': 'HH_simple'},
fileName='cells/PospischilEtAl2008/cellwrapper_Pospischil2008.py',
cellName='loadCell',
cellArgs={'template': cellName},
cellInstance = True,
importSynMechs=True
)
# observation:
# - when import template cells the label of 'soma' is 'soma_0'.
print(netParams.cellParams[cellName + '_rule']['secs']['soma_0'])
#------------------------------------------------------------------------------
# Population parameters
#------------------------------------------------------------------------------
# for ith-pop create pop with ith-cell of allcells
for i, pop in enumerate(cfg.allpops):
netParams.popParams[pop] = {
'cellType': cfg.allcells[i],
'cellModel': 'HH_simple',
'numCells': cfg.cellNumber
}
#------------------------------------------------------------------------------
# VecStim with spike times
#------------------------------------------------------------------------------
spkTimes = [ti for ti in range(1, cfg.desyncr_spikes_dur + 1, cfg.desyncr_spikes_period)] # spikes during 50 ms to create desyncronization
netParams.popParams['initialspikes'] = {'cellModel': 'VecStim', 'numCells': cfg.numCellsDesync, 'spkTimes': spkTimes, 'noise': 0.12}
#------------------------------------------------------------------------------
# Current inputs (IClamp)
#------------------------------------------------------------------------------
if cfg.addIClamp:
for key in [k for k in dir(cfg) if k.startswith('IClamp')]:
params = getattr(cfg, key, None)
[pop,sec,loc,start,dur,amp] = [params[s] for s in ['pop','sec','loc','start','dur','amp']]
#cfg.analysis['plotTraces']['include'].append((pop,0)) # record that pop
# add stim source
netParams.stimSourceParams[key] = {'type': 'IClamp', 'delay': start, 'dur': dur, 'amp': amp}
# connect stim source to target
netParams.stimTargetParams[key+'_'+pop] = {
'source': key,
'conds': {'pop': pop},
'sec': f'{sec}_0', # target 'soma_0'
'loc': loc}
#------------------------------------------------------------------------------
# Synaptic mechanism parameters
#------------------------------------------------------------------------------
# netParams.synMechParams['NMDA'] = {'mod': 'Exp2Syn', 'tau1': 15.0, 'tau2': 150.0, 'e': 0.0}
netParams.synMechParams['AMPA'] = {'mod': 'Exp2Syn', 'tau1': 0.1, 'tau2': 5.0, 'e': 0.0}
#ESynMech = ['AMPA', 'NMDA']
#------------------------------------------------------------------------------
# Connectivity rules
#------------------------------------------------------------------------------
netParams.connParams['EE'] = {
'preConds': {'pop': cfg.allpops},
'postConds': {'pop': cfg.allpops},
'synMech': 'AMPA', # ESynMech,
'probability': 0.1,
'weight': cfg.gex, # 'delay': 'defaultDelay+dist_3D/propVelocity', 'synsPerConn': int(synperconnNumber[pre][post]+0.5)
# 'delay': 0.09
}
# connect initial spikes
netParams.connParams['initialrandom'] = {
'preConds': {'pop': 'initialspikes'},
'postConds': {'pop': cfg.allpops},
'synMech': 'AMPA', # target synaptic mechanism
'probability': 0.50,
'weight': 0.0001,
'delay': 0.05
}