11from neuromllite import *
22from neuromllite .NetworkGenerator import *
33from neuromllite .utils import create_new_model
4+ from pyneuroml .pynml import read_neuroml2_file
45import sys
56
67sys .path .append (".." )
@@ -12,11 +13,14 @@ def generate(cell, duration, config='IClamp'):
1213 reference = "%s_%s" % (config , cell )
1314
1415 cell_id = '%s' % cell
15- cell_nmll = Cell (id = cell_id , neuroml2_source_file = '%s.cell.nml' % (cell ))
16+ nml2_filename = '%s.cell.nml' % (cell )
17+ cell_nmll = Cell (id = cell_id , neuroml2_source_file = nml2_filename )
1618
1719 ################################################################################
1820 ### Add some inputs
1921
22+ syn_exc = None
23+
2024 if 'IClamp' in config :
2125 parameters = {}
2226 parameters ['stim_amp' ] = '350pA'
@@ -27,8 +31,9 @@ def generate(cell, duration, config='IClamp'):
2731 parameters = {'amplitude' :'stim_amp' , 'delay' :'stim_delay' , 'duration' :'stim_dur' })
2832
2933
30- else :
31-
34+ elif 'Poisson' in config :
35+ syn_exc = Synapse (id = 'ampa' ,
36+ neuroml2_source_file = 'ampa.synapse.nml' )
3237 parameters = {}
3338 parameters ['average_rate' ] = '100 Hz'
3439 parameters ['number_per_cell' ] = '10'
@@ -47,8 +52,21 @@ def generate(cell, duration, config='IClamp'):
4752 cell_for_default_population = cell_nmll ,
4853 color_for_default_population = colors [cell ],
4954 input_for_default_population = input_source )
55+
56+ if 'Poisson' in config :
57+ net .synapses .append (syn_exc )
58+ net .inputs [0 ].number_per_cell = 'number_per_cell'
59+
5060
51- sim .recordVariables = {'2/v' :{'all' :'*' }}
61+ cell = read_neuroml2_file (nml2_filename ).cells [0 ]
62+
63+ if len (cell .morphology .segments )> 1 :
64+ sim .recordVariables = {}
65+ for seg in cell .morphology .segments :
66+ seg_id = seg .id
67+ if seg_id != 0 and seg_id % 500 < 10 :
68+ sim .recordVariables ['%i/v' % seg_id ]= {'all' :'*' }
69+
5270 '''
5371 sim.recordVariables={'biophys/membraneProperties/Na_all/Na/m/q':{'all':'*'},
5472 'biophys/membraneProperties/Na_all/Na/h/q':{'all':'*'},
@@ -65,6 +83,7 @@ def generate(cell, duration, config='IClamp'):
6583 sim.recordVariables['biophys/membraneProperties/IT_all/IT/s/q']={'all':'*'}
6684 sim.recordVariables['biophys/membraneProperties/IT_all/IT/u/q']={'all':'*'}'''
6785
86+ net .to_json_file ()
6887 sim .to_json_file ()
6988
7089 return sim , net
@@ -77,16 +96,14 @@ def generate(cell, duration, config='IClamp'):
7796 for cell in colors :
7897 generate ('PassiveCell' , 700 , config = "IClamp" )
7998 generate ('pyr_4_sym' , 700 , config = "IClamp" )
99+ generate ('pyr_4_sym' , 700 , config = "Poisson" )
80100 generate ('cADpyr229_L23_PC_5ecbf9b163_0_0' , 700 , config = "IClamp" )
101+ generate ('cADpyr229_L23_PC_5ecbf9b163_0_0' , 700 , config = "Poisson" )
81102
82103
83104 else :
84- #generate('IFcurve_PV')
85- #generate('olm')
86- sim , net = generate ('pyr_4_sym' , 700 , config = "IClamp" )
87- #generate('olm', 1000, config="PoissonFiringSynapse")
88- #generate('bistratified')
89- #generate('IClamp_Pyr')
105+ #sim, net = generate('pyr_4_sym', 700, config="IClamp")
106+ sim , net = generate ('pyr_4_sym' , 700 , config = "Poisson" )
90107
91108 check_to_generate_or_run (sys .argv , sim )
92109
0 commit comments