def generate(): dt = 0.025 simtime = 1000 ################################################################################ ### Build new network net = Network(id='ExampleIF') net.notes = 'Example with IF' net.parameters = { 'tauMem': 20.0, 'tauSyn': 0.1, 'tauRef': 2, 'V0': -70, 'theta': -50.0, 'scale': 1, 'in_weight': 0.01, 'in_rate': 50 } ifcell = Cell(id='ifcell', pynn_cell='IF_curr_alpha') ifcell.parameters = { 'tau_m': 'tauMem', 'tau_refrac': 'tauRef', 'v_rest': 'V0', 'v_reset': 'V0', 'v_thresh': 'theta', 'cm': 0.001, "i_offset": 0 } net.cells.append(ifcell) poisson_input = Cell(id='poisson_input', pynn_cell='SpikeSourcePoisson') poisson_input.parameters = {'rate': 'in_rate', 'start': 0, 'duration': 1e9} net.cells.append(poisson_input) r1 = RectangularRegion(id='region1', x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) pIF = Population(id='IFpop', size='1*scale', component=ifcell.id, properties={ 'color': '.9 0 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pIF) pLNP = Population(id='LNPpop', size='1*scale', component=ifcell.id, properties={ 'color': '.9 0.9 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pLNP) pEpoisson = Population(id='expoisson', size='10', component=poisson_input.id, properties={ 'color': '0.9 0.7 0.7', 'radius': 3 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pEpoisson) net.synapses.append( Synapse(id='ampa', pynn_receptor_type='excitatory', pynn_synapse_type='curr_alpha', parameters={'tau_syn': 0.1})) net.projections.append( Projection(id='proj0', presynaptic=pEpoisson.id, postsynaptic=pIF.id, synapse='ampa', delay=0, weight='in_weight', random_connectivity=RandomConnectivity(probability=0.7))) net.projections.append( Projection(id='proj1', presynaptic=pEpoisson.id, postsynaptic=pLNP.id, synapse='ampa', delay=0, weight='in_weight', random_connectivity=RandomConnectivity(probability=0.7))) #print(net) #print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='SimExampleIF', network=new_file, duration=simtime, dt=dt, seed=123, recordTraces={pIF.id: '*'}, recordSpikes={'all': '*'}) sim.to_json_file() return sim, net
def generate(): dt = 0.025 simtime = 1000 ################################################################################ ### Build new network net = Network(id="Example7_Brunel2000") net.notes = "Example 7: based on network of Brunel 2000" net.parameters = { "g": 4, "eta": 1, "order": 5, "epsilon": 0.1, "J": 0.1, "delay": 1.5, "tauMem": 20.0, "tauSyn": 0.1, "tauRef": 2.0, "U0": 0.0, "theta": 20.0, } cell = Cell(id="ifcell", pynn_cell="IF_curr_alpha") cell.parameters = { "tau_m": "tauMem", "tau_refrac": "tauRef", "v_rest": "U0", "v_reset": "U0", "v_thresh": "theta", "cm": 0.001, "i_offset": 0, } # cell = Cell(id='hhcell', neuroml2_source_file='test_files/hhcell.cell.nml') net.cells.append(cell) poisson_input = Cell(id="poisson_input", pynn_cell="SpikeSourcePoisson") poisson_input.parameters = { "rate": "1000 * (eta*theta/(J*4*order*epsilon*tauMem)) * (4*order*epsilon)", "start": 0, "duration": 1e9, } net.cells.append(poisson_input) r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) pE = Population( id="Epop", size="4*order", component=cell.id, properties={ "color": ".9 0 0", "radius": 5 }, random_layout=RandomLayout(region=r1.id), ) pEpoisson = Population( id="expoisson", size="4*order", component=poisson_input.id, properties={ "color": "0.9 0.7 0.7", "radius": 3 }, random_layout=RandomLayout(region=r1.id), ) pI = Population( id="Ipop", size="1*order", component=cell.id, properties={ "color": "0 0 .9", "radius": 5 }, random_layout=RandomLayout(region=r1.id), ) pIpoisson = Population( id="inpoisson", size="1*order", component=poisson_input.id, properties={ "color": "0.7 0.7 0.9", "radius": 3 }, random_layout=RandomLayout(region=r1.id), ) net.populations.append(pE) net.populations.append(pEpoisson) net.populations.append(pI) net.populations.append(pIpoisson) net.synapses.append( Synapse( id="ampa", pynn_receptor_type="excitatory", pynn_synapse_type="curr_alpha", parameters={"tau_syn": 0.1}, )) net.synapses.append( Synapse( id="gaba", pynn_receptor_type="inhibitory", pynn_synapse_type="curr_alpha", parameters={"tau_syn": 0.1}, )) delay_ext = dt downscale = 1 J_eff = "J*%s" % (downscale) # synaptic weights, scaled for alpha functions, such that # for constant membrane potential, charge J would be deposited fudge = 0.00041363506632638 # ensures dV = J at V=0 JE = "((%s)/tauSyn)*%s" % (J_eff, fudge) JI = "-1*g*%s" % (JE) net.projections.append( Projection( id="projEinput", presynaptic=pEpoisson.id, postsynaptic=pE.id, synapse="ampa", delay=delay_ext, weight=JE, one_to_one_connector=OneToOneConnector(), )) net.projections.append( Projection( id="projIinput", presynaptic=pIpoisson.id, postsynaptic=pI.id, synapse="ampa", delay=delay_ext, weight=JE, one_to_one_connector=OneToOneConnector(), )) net.projections.append( Projection( id="projEE", presynaptic=pE.id, postsynaptic=pE.id, synapse="ampa", delay="delay", weight=JE, random_connectivity=RandomConnectivity(probability="epsilon"), )) net.projections.append( Projection( id="projEI", presynaptic=pE.id, postsynaptic=pI.id, synapse="ampa", delay="delay", weight=JE, random_connectivity=RandomConnectivity(probability="epsilon"), )) net.projections.append( Projection( id="projIE", presynaptic=pI.id, postsynaptic=pE.id, synapse="gaba", delay="delay", weight=JI, random_connectivity=RandomConnectivity(probability="epsilon"), )) net.projections.append( Projection( id="projII", presynaptic=pI.id, postsynaptic=pI.id, synapse="gaba", delay="delay", weight=JI, random_connectivity=RandomConnectivity(probability="epsilon"), )) # print(net) # print(net.to_json()) new_file = net.to_json_file("%s.json" % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation( id="SimExample7", network=new_file, duration=simtime, dt=dt, seed=123, record_traces={ pE.id: [0, 1], pI.id: [0, 1] }, record_spikes={ pE.id: "*", pI.id: "*", pEpoisson.id: [0, 1, 2, 3, 4], pIpoisson.id: [0, 1, 2, 3, 4], }, ) sim.to_json_file() return sim, net
def generate(ref, np2=0, np5=0, nb2=0, nb5=0, recordTraces='*'): ################################################################################ ### Build new network net = Network(id=ref) net.notes = 'Example: %s...' % ref net.seed = 7890 net.temperature = 32 net.parameters = { 'np2': np2, 'np5': np5, 'nb2': nb2, 'nb5': nb5, 'offset_curr_l2p': -0.05, 'weight_bkg_l2p': 0.01, 'weight_bkg_l5p': 0.01 } l2p_cell = Cell(id='CELL_HH_reduced_L2Pyr', neuroml2_source_file='../CELL_HH_reduced_L2Pyr.cell.nml') net.cells.append(l2p_cell) l5p_cell = Cell(id='CELL_HH_reduced_L5Pyr', neuroml2_source_file='../CELL_HH_reduced_L5Pyr.cell.nml') net.cells.append(l5p_cell) l2b_cell = Cell(id='CELL_HH_simple_L2Basket', neuroml2_source_file='../CELL_HH_simple_L2Basket.cell.nml') net.cells.append(l2b_cell) l5b_cell = Cell(id='CELL_HH_simple_L5Basket', neuroml2_source_file='../CELL_HH_simple_L5Basket.cell.nml') net.cells.append(l5b_cell) input_source_poisson100 = InputSource(id='poissonFiringSyn100Hz', neuroml2_source_file='../inputs.nml') net.input_sources.append(input_source_poisson100) input_offset_curr_l2p = InputSource(id='input_offset_curr_l2p', pynn_input='DCSource', parameters={ 'amplitude': 'offset_curr_l2p', 'start': 0, 'stop': 1e9 }) net.input_sources.append(input_offset_curr_l2p) l2 = RectangularRegion(id='L2', x=0, y=1000, z=0, width=1000, height=10, depth=1000) net.regions.append(l2) l5 = RectangularRegion(id='L5', x=0, y=0, z=0, width=1000, height=10, depth=1000) net.regions.append(l5) #https://github.com/OpenSourceBrain/OpenCortex import opencortex.utils.color as occ pop_l2p = Population(id='pop_l2p', size='np2', component=l2p_cell.id, properties={'color': occ.L23_PRINCIPAL_CELL}, random_layout=RandomLayout(region=l2.id)) net.populations.append(pop_l2p) pop_l5p = Population(id='pop_l5p', size='np5', component=l5p_cell.id, properties={'color': occ.L5_PRINCIPAL_CELL}, random_layout=RandomLayout(region=l5.id)) net.populations.append(pop_l5p) pop_l2b = Population(id='pop_l2b', size='nb2', component=l2b_cell.id, properties={'color': occ.L23_INTERNEURON}, random_layout=RandomLayout(region=l2.id)) net.populations.append(pop_l2b) pop_l5b = Population(id='pop_l5b', size='nb5', component=l5b_cell.id, properties={'color': occ.L5_INTERNEURON}, random_layout=RandomLayout(region=l5.id)) net.populations.append(pop_l5b) # L2 -> L2 _add_projection(pop_l2p, pop_l2b, 'AMPA', delay=0, weight=0.001, probability=0.8, net=net) _add_projection(pop_l2b, pop_l2p, 'L2Pyr_GABAA', delay=0, weight=0.001, probability=0.8, net=net) _add_projection(pop_l2b, pop_l2p, 'L2Pyr_GABAB', delay=0, weight=0.001, probability=0.8, net=net) # L2 -> L5 _add_projection(pop_l2p, pop_l5p, 'L5Pyr_AMPA', delay=0, weight=0.001, probability=0.8, net=net) _add_projection(pop_l2p, pop_l5b, 'AMPA', delay=0, weight=0.001, probability=0.8, net=net) _add_projection(pop_l2b, pop_l5p, 'L5Pyr_GABAA', delay=0, weight=0.001, probability=0.8, net=net) # L5 -> L5 _add_projection(pop_l5p, pop_l5b, 'AMPA', delay=0, weight=0.001, probability=0.8, net=net) _add_projection(pop_l5b, pop_l5p, 'L5Pyr_GABAA', delay=0, weight=0.001, probability=0.8, net=net) _add_projection(pop_l5b, pop_l5p, 'L5Pyr_GABAB', delay=0, weight=0.001, probability=0.8, net=net) net.inputs.append( Input(id='stim_%s' % pop_l2p.id, input_source=input_source_poisson100.id, population=pop_l2p.id, percentage=100, weight='weight_bkg_l2p')) net.inputs.append( Input(id='stim_%s' % pop_l5p.id, input_source=input_source_poisson100.id, population=pop_l5p.id, percentage=100, weight='weight_bkg_l5p')) print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='Sim%s' % net.id, network=new_file, duration='500', seed='1111', dt='0.025', recordTraces={'all': recordTraces}, recordSpikes={'all': '*'}) sim.to_json_file() print(sim.to_json()) return sim, net
if weight != 0: net.projections.append( Projection( id='proj_%s_%s' % (pre.id, post.id), presynaptic=pre.id, postsynaptic=post.id, synapse=syns[pre.id], type='continuousProjection', delay=0, weight=weight, random_connectivity=RandomConnectivity(probability=1))) # Build the network net = Network(id='WC') net.notes = 'A simple WC network' net.parameters = {'wee': 10, 'wei': 12, 'wie': -8, 'wii': -3} r1 = RectangularRegion(id='WilsonCowan', x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) exc_cell = Cell(id='Exc', lems_source_file='WC_Parameters.xml') inh_cell = Cell(id='Inh', lems_source_file='WC_Parameters.xml')
def generate(): ################################################################################ ### Build new network net = Network(id='ExampleK') net.notes = 'Example...' net.parameters = {'pop_size': '8', 'stim_amp': '0.3'} cell = Cell(id='kuramoto1', lems_source_file='CellExamples.xml') net.cells.append(cell) input_source = InputSource(id='iclamp0', neuroml2_input='PulseGeneratorDL', parameters={ 'amplitude': 'stim_amp', 'delay': '100ms', 'duration': '800ms' }) net.input_sources.append(input_source) ''' input_source = InputSource(id='poissonFiringSyn', neuroml2_input='poissonFiringSynapse', parameters={'average_rate':"eta", 'synapse':"ampa", 'spike_target':"./ampa"}) ''' r1 = RectangularRegion(id='region1', x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) pE = Population(id='Epop', size='pop_size', component=cell.id, properties={'color': '1 0 0'}, random_layout=RandomLayout(region=r1.id)) net.populations.append(pE) ''' net.synapses.append(Synapse(id='ampa', pynn_receptor_type='excitatory', pynn_synapse_type='curr_alpha', parameters={'tau_syn':0.1})) net.projections.append(Projection(id='projEinput', presynaptic=pEpoisson.id, postsynaptic=pE.id, synapse='ampa', delay=2, weight=0.02, one_to_one_connector=OneToOneConnector())) net.projections.append(Projection(id='projEE', presynaptic=pE.id, postsynaptic=pE.id, synapse='ampa', delay=2, weight=0.002, random_connectivity=RandomConnectivity(probability=.5))) net.projections.append(Projection(id='projEI', presynaptic=pE.id, postsynaptic=pI.id, synapse='ampa', delay=2, weight=0.02, random_connectivity=RandomConnectivity(probability=.5))) net.projections.append(Projection(id='projIE', presynaptic=pI.id, postsynaptic=pE.id, synapse='gaba', delay=2, weight=0.02, random_connectivity=RandomConnectivity(probability=.5))) ''' net.inputs.append( Input(id='stim', input_source=input_source.id, population=pE.id, percentage=50)) #print(net) #print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='SimExampleK', network=new_file, duration='1000', dt='0.025', seed=123, recordVariables={'sin_theta': { pE.id: '*' }}) sim.to_json_file() return sim, net
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='IzhikevichTest') net.notes = 'Example Izhikevich' net.parameters = {'N': 1} cell = Cell(id='izhCell', neuroml2_cell='izhikevich2007Cell') cell.parameters = {} params = {'v0':'-60mV', 'C':'100 pF', 'k':'0.7 nS_per_mV', \ 'vr':'-60 mV', 'vt':'-40 mV', 'vpeak':'35 mV', \ 'a':'0.03 per_ms', 'b':'-2 nS', 'c':'-50 mV', 'd':'100 pA'} for p in params: cell.parameters[p] = p net.parameters[p] = params[p] net.cells.append(cell) pop = Population(id='izhPop', size='1', component=cell.id, properties={'color': '.7 0 0'}) net.populations.append(pop) net.parameters['delay'] = '100ms'
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='Example8_Extension') net.notes = 'Example 8: extending exising networks' net.parameters = {'N': 10, 'fractionE': 0.8, 'weightInput': 1} cell = Cell(id='hhcell', neuroml2_source_file='test_files/hhcell.cell.nml') net.cells.append(cell) input_source = InputSource(id='poissonFiringSyn', neuroml2_source_file='test_files/inputs.nml') net.input_sources.append(input_source) ''' input_source = InputSource(id='iclamp0', pynn_input='DCSource', parameters={'amplitude':0.2, 'start':100., 'stop':900.})''' net.input_sources.append(input_source) pE = Population(id='Epop', size='int(N*fractionE)', component=cell.id, properties={'color': '.7 0 0'}) pRS = Population(id='RSpop', size='N - int(N*fractionE)', component=cell.id,
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id="Example8_Extension") net.notes = "Example 8: general testing..." net.seed = 7890 net.temperature = 32.0 net.parameters = {"N": 10, "fractionE": 0.8, "weightInput": 1} cell = Cell(id="hhcell", neuroml2_source_file="test_files/hhcell.cell.nml") net.cells.append(cell) input_source = InputSource( id="poissonFiringSyn", neuroml2_source_file="test_files/inputs.nml" ) net.input_sources.append(input_source) """ input_source = InputSource(id='iclamp0', pynn_input='DCSource', parameters={'amplitude':0.2, 'start':100., 'stop':900.})""" net.input_sources.append(input_source)
def generate(): ################################################################################ ### Build new network net = Network(id='Example7_Brunel2000') net.notes = 'Example 7: based on network of Brunel 2000' net.parameters = { 'g': 4, 'eta': 1, 'order': 5, 'epsilon': 0.1, 'J': 0.1, 'delay': 1.5, 'tauMem': 20.0, 'tauSyn': 0.1, 'tauRef': 2.0, 'U0': 0.0, 'theta': 20.0 } cell = Cell(id='ifcell', pynn_cell='IF_curr_alpha') cell.parameters = { 'tau_m': 'tauMem', 'tau_refrac': 'tauRef', 'v_rest': 'U0', 'v_reset': 'U0', 'v_thresh': 'theta', 'cm': 0.001, "i_offset": 0 } #cell = Cell(id='hhcell', neuroml2_source_file='test_files/hhcell.cell.nml') net.cells.append(cell) expoisson = Cell(id='expoisson', pynn_cell='SpikeSourcePoisson') expoisson.parameters = { 'rate': '1000 * (eta*theta/(J*4*order*epsilon*tauMem)) * (4*order*epsilon)', 'start': 0, 'duration': 1e9 } net.cells.append(expoisson) ''' input_source = InputSource(id='iclamp0', pynn_input='DCSource', parameters={'amplitude':0.002, 'start':100., 'stop':900.}) input_source = InputSource(id='poissonFiringSyn', neuroml2_input='poissonFiringSynapse', parameters={'average_rate':"eta", 'synapse':"ampa", 'spike_target':"./ampa"}) net.input_sources.append(input_source)''' pE = Population(id='Epop', size='4*order', component=cell.id, properties={'color': '1 0 0'}) pEpoisson = Population(id='Einput', size='4*order', component=expoisson.id, properties={'color': '.5 0 0'}) pI = Population(id='Ipop', size='1*order', component=cell.id, properties={'color': '0 0 1'}) net.populations.append(pE) net.populations.append(pEpoisson) net.populations.append(pI) net.synapses.append( Synapse(id='ampa', pynn_receptor_type='excitatory', pynn_synapse_type='curr_alpha', parameters={'tau_syn': 0.1})) net.synapses.append( Synapse(id='gaba', pynn_receptor_type='inhibitory', pynn_synapse_type='curr_alpha', parameters={'tau_syn': 0.1})) net.projections.append( Projection(id='projEinput', presynaptic=pEpoisson.id, postsynaptic=pE.id, synapse='ampa', delay=2, weight=0.02, one_to_one_connector=OneToOneConnector())) ''' net.projections.append(Projection(id='projEE', presynaptic=pE.id, postsynaptic=pE.id, synapse='ampa', delay=2, weight=0.002, random_connectivity=RandomConnectivity(probability=.5)))''' net.projections.append( Projection(id='projEI', presynaptic=pE.id, postsynaptic=pI.id, synapse='ampa', delay=2, weight=0.02, random_connectivity=RandomConnectivity(probability=.5))) ''' net.projections.append(Projection(id='projIE', presynaptic=pI.id, postsynaptic=pE.id, synapse='gaba', delay=2, weight=0.02, random_connectivity=RandomConnectivity(probability=.5))) net.inputs.append(Input(id='stim', input_source=input_source.id, population=pE.id, percentage=50))''' #print(net) #print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='SimExample7', network=new_file, duration='1000', dt='0.025', seed=123, recordTraces={ pE.id: '*', pI.id: '*' }, recordSpikes={'all': '*'}) sim.to_json_file() return sim, net
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='Example10_Lorenz') net.notes = 'Example 10: Lorenz' net.parameters = {'N': 1} cell = Cell(id='lorenzCell', lems_source_file='test_files/Lorenz1963.xml', parameters={}) net.cells.append(cell) params = {'sigma': 10, 'b': 2.67, 'r': 28, 'x0': 1.0, 'y0': 1.0, 'z0': 1.0} for p in params: cell.parameters[p] = p net.parameters[p] = params[p] pop = Population(id='lorenzPop', size='1', component=cell.id, properties={'color': '.7 0 0'}) net.populations.append(pop) print(net) print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id)
def generate(): dt = 0.1 simtime = 1 ################################################################################ ### Build new network net = Network(id='ABC') net.notes = 'Example of simplified network' net.parameters = {'A_initial': 0, 'A_slope': 5} cellInput = Cell(id='a_input', lems_source_file='PNL.xml', parameters={'variable': 'A_initial'}) net.cells.append(cellInput) cellA = Cell(id='a', lems_source_file='PNL.xml', parameters={'slope': 'A_slope'}) net.cells.append(cellA) cellB = Cell(id='b', lems_source_file='PNL.xml') net.cells.append(cellB) cellC = Cell(id='c', lems_source_file='PNL.xml') net.cells.append(cellC) rsDL = Synapse(id='rsDL', lems_source_file='PNL.xml') net.synapses.append(rsDL) r1 = RectangularRegion(id='region1', x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) pAin = Population(id='A_input', size='1', component=cellInput.id, properties={ 'color': '0.2 0.2 0.2', 'radius': 3 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pAin) pA = Population(id='A', size='1', component=cellA.id, properties={ 'color': '0 0.9 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pA) pB = Population(id='B', size='1', component=cellB.id, properties={ 'color': '.9 0 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pB) pC = Population(id='C', size='1', component=cellC.id, properties={ 'color': '0.7 0 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pC) silentDLin = Synapse(id='silentSyn_proj_input', lems_source_file='PNL.xml') net.synapses.append(silentDLin) net.projections.append( Projection(id='proj_input', presynaptic=pA.id, postsynaptic=pB.id, synapse=rsDL.id, pre_synapse=silentDLin.id, type='continuousProjection', weight=1, random_connectivity=RandomConnectivity(probability=1))) silentDL0 = Synapse(id='silentSyn_proj0', lems_source_file='PNL.xml') net.synapses.append(silentDL0) net.projections.append( Projection(id='proj0', presynaptic=pAin.id, postsynaptic=pA.id, synapse=rsDL.id, pre_synapse=silentDL0.id, type='continuousProjection', weight=1, random_connectivity=RandomConnectivity(probability=1))) silentDL1 = Synapse(id='silentSyn_proj1', lems_source_file='PNL.xml') net.synapses.append(silentDL1) net.projections.append( Projection(id='proj1', presynaptic=pA.id, postsynaptic=pC.id, synapse=rsDL.id, pre_synapse=silentDL1.id, type='continuousProjection', weight=1, random_connectivity=RandomConnectivity(probability=1))) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='Sim%s' % net.id, network=new_file, duration=simtime, dt=dt, seed=123, recordVariables={ 'OUTPUT': { 'all': '*' }, 'INPUT': { 'all': '*' } }) sim.to_json_file() return sim, net
from neuromllite import Network, Cell, Synapse, NetworkReader, InputSource, Input from neuromllite.NetworkGenerator import generate_neuroml2_from_network import sys ################################################################################ ### Build new network percent = 5 net = Network(id='BBP_%spercent'%percent, notes = 'A network with the Blue Brain Project connectivity data (%s% of total cells)') default_cell = Cell(id='hhcell', neuroml2_source_file='test_files/hhcell.cell.nml') net.network_reader = NetworkReader(type='BBPConnectomeReader', parameters={'id':net.id, 'filename':'test_files/cons_locs_pathways_mc0_Column.h5', 'percentage_cells_per_pop':percent, 'DEFAULT_CELL_ID':default_cell.id, 'cell_info':{default_cell.id:default_cell}}) net.cells.append(default_cell) net.synapses.append(Synapse(id='ampa', neuroml2_source_file='test_files/ampa.synapse.nml')) net.synapses.append(Synapse(id='gaba', neuroml2_source_file='test_files/gaba.synapse.nml')) input_source = InputSource(id='poissonFiringSyn', neuroml2_source_file='test_files/inputs.nml') net.input_sources.append(input_source) for pop in ['L4_PC']: net.inputs.append(Input(id='stim_%s'%pop, input_source=input_source.id,
from neuromllite import ( Network, Cell, InputSource, Population, Synapse, RectangularRegion, RandomLayout, ) from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id="Example4_PyNN") net.notes = "Example 4: a network with PyNN cells & inputs" net.parameters = {"input_amp": 0.99} cell = Cell(id="testcell", pynn_cell="IF_cond_alpha") cell.parameters = {"tau_refrac": 5, "i_offset": 0.1} net.cells.append(cell) cell2 = Cell(id="testcell2", pynn_cell="IF_cond_alpha") cell2.parameters = {"tau_refrac": 5, "i_offset": -0.1} net.cells.append(cell2) input_source = InputSource( id="i_clamp", pynn_input="DCSource", parameters={
def generate(): dt = 0.05 simtime = 100 ################################################################################ ### Build new network net = Network(id='FN') net.notes = 'Example of simplified network' net.parameters = { 'initial_w': 0.0, 'initial_v': -1, 'a_v': -0.3333333333333333, 'b_v': 0.0, 'c_v': 1.0, 'd_v': 1, 'e_v': -1.0, 'f_v': 1.0, 'time_constant_v': 1.0, 'a_w': 1.0, 'b_w': -0.8, 'c_w': 0.7, 'time_constant_w': 12.5, 'threshold': -1.0, 'mode': 1.0, 'uncorrelated_activity': 0.0, 'Iext': 0 } cellInput = Cell(id='fn', lems_source_file='FN_Definitions.xml', parameters={}) for p in net.parameters: cellInput.parameters[p]=p net.cells.append(cellInput) r1 = RectangularRegion(id='region1', x=0,y=0,z=0,width=1000,height=100,depth=1000) net.regions.append(r1) pop = Population(id='FNpop', size='1', component=cellInput.id, properties={'color':'0.2 0.2 0.2', 'radius':3}, random_layout = RandomLayout(region=r1.id)) net.populations.append(pop) new_file = net.to_json_file('%s.json'%net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='Sim%s'%net.id, network=new_file, duration=simtime, dt=dt, seed= 123, recordVariables={'V':{'all':'*'},'W':{'all':'*'}}, plots2D={'VW':{'x_axis':'%s/0/fn/V'%pop.id, 'y_axis':'%s/0/fn/W'%pop.id}}) sim.to_json_file() return sim, net
def generate(): dt = 0.025 simtime = 500 ################################################################################ ### Build new network net = Network(id='SpikingEI') net.notes = 'SpikingEI' net.parameters = { 'order': 5, 'wee': 8, 'wei': 12, 'wie': -12, 'wii': -3, 'w_scale': 0.001, 'in_rate': 400, 'epsilon': 0.5, 'tauMem': 20.0, 'tauSyn': 0.1, 'tauRef': 2.0 } cell = Cell(id='ifcell', pynn_cell='IF_curr_alpha') cell.parameters = { 'tau_m': 'tauMem', 'tau_refrac': 'tauRef', 'v_rest': -70, 'v_reset': -70, 'v_thresh': -50, 'cm': 0.001, "i_offset": 0 } #cell = Cell(id='hhcell', neuroml2_source_file='test_files/hhcell.cell.nml') net.cells.append(cell) poisson_input = Cell(id='poisson_input', pynn_cell='SpikeSourcePoisson') poisson_input.parameters = {'rate': 'in_rate', 'start': 0, 'duration': 1e9} net.cells.append(poisson_input) r1 = RectangularRegion(id='region1', x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) pE = Population(id='Excitatory', size='4*order', component=cell.id, properties={ 'color': '.9 0 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) pEpoisson = Population(id='expoisson', size='4*order', component=poisson_input.id, properties={ 'color': '0.9 0.7 0.7', 'radius': 3 }, random_layout=RandomLayout(region=r1.id)) pI = Population(id='Inhibitory', size='1*order', component=cell.id, properties={ 'color': '0 0 .9', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) pIpoisson = Population(id='inpoisson', size='1*order', component=poisson_input.id, properties={ 'color': '0.7 0.7 0.9', 'radius': 3 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(pE) net.populations.append(pEpoisson) net.populations.append(pI) net.populations.append(pIpoisson) net.synapses.append( Synapse(id='ampa', pynn_receptor_type='excitatory', pynn_synapse_type='curr_alpha', parameters={'tau_syn': 0.1})) net.synapses.append( Synapse(id='gaba', pynn_receptor_type='inhibitory', pynn_synapse_type='curr_alpha', parameters={'tau_syn': 0.1})) delay_ext = dt net.projections.append( Projection(id='projEinput', presynaptic=pEpoisson.id, postsynaptic=pE.id, synapse='ampa', delay=delay_ext, weight=0.01, one_to_one_connector=OneToOneConnector())) net.projections.append( Projection(id='projIinput', presynaptic=pIpoisson.id, postsynaptic=pI.id, synapse='ampa', delay=delay_ext, weight=0.01, one_to_one_connector=OneToOneConnector())) net.projections.append( Projection( id='projEE', presynaptic=pE.id, postsynaptic=pE.id, synapse='ampa', delay=delay_ext, weight='wee * w_scale', random_connectivity=RandomConnectivity(probability='epsilon'))) net.projections.append( Projection( id='projEI', presynaptic=pE.id, postsynaptic=pI.id, synapse='ampa', delay=delay_ext, weight='wei * w_scale', random_connectivity=RandomConnectivity(probability='epsilon'))) net.projections.append( Projection( id='projIE', presynaptic=pI.id, postsynaptic=pE.id, synapse='gaba', delay=delay_ext, weight='wie * w_scale', random_connectivity=RandomConnectivity(probability='epsilon'))) net.projections.append( Projection( id='projII', presynaptic=pI.id, postsynaptic=pI.id, synapse='gaba', delay=delay_ext, weight='wii * w_scale', random_connectivity=RandomConnectivity(probability='epsilon'))) #print(net) #print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='SimSpiking', network=new_file, duration=simtime, dt=dt, seed=123, recordTraces={ pE.id: '*', pI.id: '*' }, recordSpikes={'all': '*'}) sim.to_json_file() return sim, net
def generate(): dt = 0.025 simtime = 1000 ################################################################################ ### Build new network net = Network(id='McCPNet') net.notes = 'Example of simplified McCulloch-Pitts based Network' net.parameters = {'amp': 1.5, 'scale': 3} cell = Cell(id='mccp0', lems_source_file='McCPTest.xml') net.cells.append(cell) silentDL = Synapse(id='silentSyn_proj0', lems_source_file='McCPTest.xml') net.synapses.append(silentDL) rsDL = Synapse(id='rsDL', lems_source_file='McCPTest.xml') net.synapses.append(rsDL) r1 = RectangularRegion(id='region1', x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) p0 = Population(id='McCPpop0', size='1*scale', component=cell.id, properties={ 'color': '.9 0.9 0', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(p0) p1 = Population(id='McCPpop1', size='1*scale', component=cell.id, properties={ 'color': '.9 0 0.9', 'radius': 5 }, random_layout=RandomLayout(region=r1.id)) net.populations.append(p1) net.projections.append( Projection(id='proj0', presynaptic=p0.id, postsynaptic=p1.id, synapse=rsDL.id, pre_synapse=silentDL.id, type='continuousProjection', weight='random()', random_connectivity=RandomConnectivity(probability=0.6))) ''' net.synapses.append(Synapse(id='ampa', pynn_receptor_type='excitatory', pynn_synapse_type='curr_alpha', parameters={'tau_syn':0.1})) net.projections.append(Projection(id='proj1', presynaptic=pEpoisson.id, postsynaptic=pLNP.id, synapse='ampa', delay=0, weight='in_weight', random_connectivity=RandomConnectivity(probability=0.7)))''' input_source0 = InputSource(id='sg0', neuroml2_source_file='inputs.nml') net.input_sources.append(input_source0) input_source1 = InputSource(id='sg1', neuroml2_source_file='inputs.nml') net.input_sources.append(input_source1) for pop in [p0.id]: net.inputs.append( Input(id='stim0_%s' % pop, input_source=input_source0.id, population=pop, percentage=60)) net.inputs.append( Input(id='stim1_%s' % pop, input_source=input_source1.id, population=pop, percentage=60)) #print(net) #print(net.to_json()) new_file = net.to_json_file('%s.json' % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='Sim%s' % net.id, network=new_file, duration=simtime, dt=dt, seed=123, recordVariables={ 'R': { 'all': '*' }, 'ISyn': { 'all': '*' } }) sim.to_json_file() return sim, net
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='Example9_HindmarshRose') net.notes = 'Example 9: HindmarshRose' net.parameters = {'N': 1} cell = Cell(id='hrCell', lems_source_file='test_files/HindmarshRose3d.xml') cell.parameters = {} params = { 'a': 1, 'b': 3, 'c': -3.0, 'd': 5.0, 's': 4.0, 'I': 5.0, 'x1': -1.3, 'r': 0.002, 'x0': -1.3, 'y0': -1.0, 'z0': 1.0 } for p in params: cell.parameters[p] = p net.parameters[p] = params[p]
from neuromllite import Network, Cell, InputSource, Population, Synapse, RectangularRegion, RandomLayout from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='Example4_PyNN') net.notes = 'Example 4: a network with PyNN cells & inputs' net.parameters = {'input_amp': 0.99} cell = Cell(id='testcell', pynn_cell='IF_cond_alpha') cell.parameters = {"tau_refrac": 5, "i_offset": .1} net.cells.append(cell) cell2 = Cell(id='testcell2', pynn_cell='IF_cond_alpha') cell2.parameters = {"tau_refrac": 5, "i_offset": -.1} net.cells.append(cell2) input_source = InputSource(id='i_clamp', pynn_input='DCSource', parameters={ 'amplitude': 'input_amp', 'start': 200., 'stop': 800. }) net.input_sources.append(input_source) r1 = RectangularRegion(id='region1', x=0, y=0,
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id="Spikers") net.notes = "Example with spiking entities.." net.parameters = {"N": 10, "weightInput": 10, "input_rate": 40} cell = Cell(id="iafcell", pynn_cell="IF_cond_alpha") cell.parameters = {"tau_refrac": 10} net.cells.append(cell) input_cell = Cell(id="InputCell", pynn_cell="SpikeSourcePoisson") input_cell.parameters = { "start": 0, "duration": 10000000000, "rate": "input_rate" } net.cells.append(input_cell) input_cell_100 = Cell(id="InputCell100", pynn_cell="SpikeSourcePoisson") input_cell_100.parameters = {"start": 0, "duration": 10000000000, "rate": 100} net.cells.append(input_cell_100) input_source_p0 = InputSource(id="poissonFiringSyn", neuroml2_source_file="../test_files/inputs.nml") net.input_sources.append(input_source_p0)
def generate(): dt = 0.025 simtime = 1000 ################################################################################ ### Build new network net = Network(id='Example7_Brunel2000') net.notes = 'Example 7: based on network of Brunel 2000' net.parameters = { 'g': 4, 'eta': 1, 'order': 5, 'epsilon': 0.1, 'J': 0.1, 'delay': 1.5, 'tauMem': 20.0, 'tauSyn': 0.1, 'tauRef': 2.0, 'U0': 0.0, 'theta': 20.0} cell = Cell(id='ifcell', pynn_cell='IF_curr_alpha') cell.parameters = { 'tau_m': 'tauMem', 'tau_refrac': 'tauRef', 'v_rest': 'U0', 'v_reset': 'U0', 'v_thresh': 'theta', 'cm': 0.001, "i_offset": 0} #cell = Cell(id='hhcell', neuroml2_source_file='test_files/hhcell.cell.nml') net.cells.append(cell) poisson_input = Cell(id='poisson_input', pynn_cell='SpikeSourcePoisson') poisson_input.parameters = { 'rate': '1000 * (eta*theta/(J*4*order*epsilon*tauMem)) * (4*order*epsilon)', 'start': 0, 'duration': 1e9} net.cells.append(poisson_input) r1 = RectangularRegion(id='region1', x=0,y=0,z=0,width=1000,height=100,depth=1000) net.regions.append(r1) pE = Population(id='Epop', size='4*order', component=cell.id, properties={'color':'.9 0 0', 'radius':5}, random_layout = RandomLayout(region=r1.id)) pEpoisson = Population(id='expoisson', size='4*order', component=poisson_input.id, properties={'color':'0.9 0.7 0.7', 'radius':3}, random_layout = RandomLayout(region=r1.id)) pI = Population(id='Ipop', size='1*order', component=cell.id, properties={'color':'0 0 .9', 'radius':5}, random_layout = RandomLayout(region=r1.id)) pIpoisson = Population(id='inpoisson', size='1*order', component=poisson_input.id, properties={'color':'0.7 0.7 0.9', 'radius':3}, random_layout = RandomLayout(region=r1.id)) net.populations.append(pE) net.populations.append(pEpoisson) net.populations.append(pI) net.populations.append(pIpoisson) net.synapses.append(Synapse(id='ampa', pynn_receptor_type='excitatory', pynn_synapse_type='curr_alpha', parameters={'tau_syn':0.1})) net.synapses.append(Synapse(id='gaba', pynn_receptor_type='inhibitory', pynn_synapse_type='curr_alpha', parameters={'tau_syn':0.1})) delay_ext = dt downscale = 1 J_eff = 'J*%s'%(downscale) # synaptic weights, scaled for alpha functions, such that # for constant membrane potential, charge J would be deposited fudge = 0.00041363506632638 # ensures dV = J at V=0 JE = '((%s)/tauSyn)*%s'%(J_eff,fudge) JI = '-1*g*%s'%(JE) net.projections.append(Projection(id='projEinput', presynaptic=pEpoisson.id, postsynaptic=pE.id, synapse='ampa', delay=delay_ext, weight=JE, one_to_one_connector=OneToOneConnector())) net.projections.append(Projection(id='projIinput', presynaptic=pIpoisson.id, postsynaptic=pI.id, synapse='ampa', delay=delay_ext, weight=JE, one_to_one_connector=OneToOneConnector())) net.projections.append(Projection(id='projEE', presynaptic=pE.id, postsynaptic=pE.id, synapse='ampa', delay='delay', weight=JE, random_connectivity=RandomConnectivity(probability='epsilon'))) net.projections.append(Projection(id='projEI', presynaptic=pE.id, postsynaptic=pI.id, synapse='ampa', delay='delay', weight=JE, random_connectivity=RandomConnectivity(probability='epsilon'))) net.projections.append(Projection(id='projIE', presynaptic=pI.id, postsynaptic=pE.id, synapse='gaba', delay='delay', weight=JI, random_connectivity=RandomConnectivity(probability='epsilon'))) net.projections.append(Projection(id='projII', presynaptic=pI.id, postsynaptic=pI.id, synapse='gaba', delay='delay', weight=JI, random_connectivity=RandomConnectivity(probability='epsilon'))) #print(net) #print(net.to_json()) new_file = net.to_json_file('%s.json'%net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation(id='SimExample7', network=new_file, duration=simtime, dt=dt, seed= 123, recordTraces={pE.id:[0,1],pI.id:[0,1]}, recordSpikes={pE.id:'*', pI.id:'*',pEpoisson.id:[0,1,2,3,4],pIpoisson.id:[0,1,2,3,4]}) sim.to_json_file() return sim, net
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='PopExample') net.notes = 'Testing...' net.seed = 1234 net.parameters = { 'N': 10, 'fractionE': 0.8, 'weightInput': 1, 'Wei':0.01, 'Wie':0.01} cell = Cell(id='iafcell', pynn_cell='IF_cond_alpha') cell.parameters = { "tau_refrac":0} net.cells.append(cell) input_source = InputSource(id='poissonFiringSyn100Hz', neuroml2_source_file='inputs.nml') net.input_sources.append(input_source) net.input_sources.append(input_source) pE = Population(id='Epop', size='int(N*fractionE)', component=cell.id, properties={'color':'.7 0 0'}) pI = Population(id='Ipop', size='N - int(N*fractionE)', component=cell.id, properties={'color':'0 0 .7'})
from neuromllite import Network, Cell, Synapse, NetworkReader, InputSource, Input from neuromllite.NetworkGenerator import generate_neuroml2_from_network import sys ################################################################################ ### Build new network percent = 5 net = Network( id="BBP_%spercent" % percent, notes= "A network with the Blue Brain Project connectivity data (%s% of total cells)", ) default_cell = Cell(id="hhcell", neuroml2_source_file="test_files/hhcell.cell.nml") net.network_reader = NetworkReader( type="BBPConnectomeReader", parameters={ "id": net.id, "filename": "test_files/cons_locs_pathways_mc0_Column.h5", "percentage_cells_per_pop": percent, "DEFAULT_CELL_ID": default_cell.id, "cell_info": { default_cell.id: default_cell }, }, ) net.cells.append(default_cell)
from neuromllite import ( Network, Cell, InputSource, Population, Synapse, RectangularRegion, RandomLayout, ) from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id="SonataExample") net.notes = "Example for testing Sonata" net.parameters = {"input_amp": 0.190, "input_del": 100, "input_dur": 800} cell = Cell(id="testcell", pynn_cell="IF_cond_alpha") cell.parameters = { "i_offset": 0, "cm": 0.117, "tau_m": 22.1, "tau_refrac": 3, "v_reset": -50, "v_rest": -78, "v_thresh": -47, } net.cells.append(cell)
def generate(): dt = 0.05 simtime = 100 ################################################################################ ### Build new network net = Network(id="FN") net.notes = "FitzHugh Nagumo cell model - originally specified in NeuroML/LEMS" net.parameters = { "initial_w": 0.0, "initial_v": -1, "a_v": -0.3333333333333333, "b_v": 0.0, "c_v": 1.0, "d_v": 1, "e_v": -1.0, "f_v": 1.0, "time_constant_v": 1.0, "a_w": 1.0, "b_w": -0.8, "c_w": 0.7, "time_constant_w": 12.5, "threshold": -1.0, "mode": 1.0, "uncorrelated_activity": 0.0, "Iext": 0, } cellInput = Cell(id="fn", lems_source_file="FN_Definitions.xml", parameters={}) for p in net.parameters: cellInput.parameters[p] = p net.cells.append(cellInput) r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000) net.regions.append(r1) pop = Population( id="FNpop", size="1", component=cellInput.id, properties={ "color": "0.2 0.2 0.2", "radius": 3 }, random_layout=RandomLayout(region=r1.id), ) net.populations.append(pop) new_file = net.to_json_file("%s.json" % net.id) ################################################################################ ### Build Simulation object & save as JSON sim = Simulation( id="Sim%s" % net.id, network=new_file, duration=simtime, dt=dt, seed=123, recordVariables={ "V": { "all": "*" }, "W": { "all": "*" } }, plots2D={ "VW": { "x_axis": "%s/0/fn/V" % pop.id, "y_axis": "%s/0/fn/W" % pop.id } }, ) sim.to_json_file() return sim, net
from neuromllite import Network, Population, Projection, RandomConnectivity import random ################################################################################ ### Build a new network net = Network(id='net0') net.notes = "...." f = open('Neuron_2015_Table.csv') all_tgts = [] for l in f: #print l w = l.split(',') tgt = w[0] src = w[1] if tgt!='TARGET': if not tgt in all_tgts: all_tgts.append(tgt) print all_tgts print(len(all_tgts)) f = open('Neuron_2015_Table.csv') pop_ids = [] for l in f: #print l w = l.split(',')
from neuromllite import ( Network, Cell, InputSource, Population, Synapse, RectangularRegion, RandomLayout, ) from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id="Example11_Synapses") net.notes = "Example 11: synaptic properties" net.parameters = {"input_amp": 0.23, "weight": 1.01} #'tau_syn': 2} cell = Cell(id="iafCell0", neuroml2_source_file="test_files/iaf.cell.nml") # cell.parameters = { "tau_refrac":5, "i_offset":0 } net.cells.append(cell) input_source = InputSource( id="i_clamp", pynn_input="DCSource", parameters={ "amplitude": "input_amp", "start": 200.0, "stop": 800.0
from neuromllite import Network, Cell, InputSource, Population, Synapse, RectangularRegion, RandomLayout from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='SonataExample') net.notes = 'Example for testing Sonata' net.parameters = {'input_amp': 0.190, 'input_del': 100, 'input_dur': 800} cell = Cell(id='testcell', pynn_cell='IF_cond_alpha') cell.parameters = { "i_offset": 0, "cm": 0.117, "tau_m": 22.1, "tau_refrac": 3, "v_reset": -50, "v_rest": -78, "v_thresh": -47 } net.cells.append(cell) ''' cell2 = Cell(id='testcell2', pynn_cell='IF_cond_alpha') cell2.parameters = { "tau_refrac":5, "i_offset":-.1 } net.cells.append(cell2)''' input_source = InputSource(id='i_clamp', pynn_input='DCSource', parameters={
from neuromllite import InputSource from neuromllite import Network from neuromllite import Population from neuromllite import RandomLayout from neuromllite import RectangularRegion from neuromllite import Simulation from neuromllite import Synapse from neuromllite import Projection from neuromllite import RandomConnectivity import sys ################################################################################ ### Build new network net = Network(id="ArborExample") net.notes = "Example for testing Arbor" net.parameters = { "v_init": -50, "scale": 3, "input_amp": 0.01, "input_del": 50, "input_dur": 5, } cell = Cell(id="test_arbor_cell", arbor_cell="cable_cell") cell.parameters = {"v_init": "v_init", "radius": 3, "mechanism": "hh"} net.cells.append(cell)
# hierValsnew = hierVals['hierVals'][:] # hier=hierValsnew/max(hierValsnew)#hierarchy normalized. # hier=np.squeeze(hier[:nAreas]) # #fln values file # flnMatp = scipy.io.loadmat(path+'efelenMatpython.mat') # conn=flnMatp['flnMatpython'][:][:] #fln values..Cij is strength from j to i # conn=conn[:nAreas,:nAreas] # distMatp = scipy.io.loadmat(path+'subgraphWiring29.mat') # distMat=distMatp['wiring'][:][:] #distances between areas values.. # delayMat = distMat/speed # delay=delayMat[:nAreas,:nAreas] ###################### Build the network ###################################### net = Network(id='Joglekar1Network_PyNN') net.notes = 'Joglekar network: a network with PyNN cells & inputs' net.parameters = {'scale': 0.01} ######################## Cell ################################################# cellE = Cell(id='excitatory', pynn_cell='IF_curr_alpha') cellI = Cell(id='inhibitory', pynn_cell='IF_curr_alpha') cellE.parameters = { "tau_m": tauE_m, "cm": cE_m, "v_rest": Vrest, "v_reset": Vreset, "v_thresh": Vt, "tau_refrac": tauRef,
from neuromllite import Network, Cell, InputSource, Population, Synapse from neuromllite import Projection, RandomConnectivity, Input, Simulation import sys ################################################################################ ### Build new network net = Network(id='Spikers') net.notes = 'Example with spiking entities..' net.parameters = { 'N': 10, 'weightInput': 10, 'input_rate': 40} cell = Cell(id='iafcell', pynn_cell='IF_cond_alpha') cell.parameters = { "tau_refrac":10 } net.cells.append(cell) input_cell = Cell(id='InputCell', pynn_cell='SpikeSourcePoisson') input_cell.parameters = { 'start': 0, 'duration': 10000000000, 'rate': 'input_rate' } net.cells.append(input_cell) input_cell_100 = Cell(id='InputCell100', pynn_cell='SpikeSourcePoisson') input_cell_100.parameters = { 'start': 0, 'duration': 10000000000, 'rate': 100 } net.cells.append(input_cell_100)