Example #1
0
def build_hippocampus():

    net = NetworkBuilder('CA3')
    net.add_nodes(N=1,
                  pop_name='CA3e',
                  model_type='biophysical',
                  model_template='hoc:Spikingcell',
                  morphology='blank.swc')

    inputnet = NetworkBuilder('input')
    inputnet.add_nodes(N=1, model_type='virtual', pat='pat1', pop_name='virt')
    conn = inputnet.add_edges(
        target=net.nodes(pop_name='CA3e'),
        source={'pat': 'pat1'},
        connection_rule=1,
        dynamics_params='stsp.json',
        model_template='Exp2Syn1_STSP',
        delay=0,
        syn_weight=.5,
        target_sections=['soma'],  # target soma
        distance_range=[0.0, 300])
    conn.add_properties(['sec_id', 'sec_x'],
                        rule=(0, 0.9),
                        dtypes=[np.int32, np.float])

    net.build()
    net.save_nodes(output_dir='network')
    net.save_edges(output_dir='network')

    inputnet.build()
    inputnet.save(output_dir='network')
Example #2
0
def build_sim():
    from bmtk.builder.networks import NetworkBuilder

    # My all active-model (does not work):
    #Model ID 496497595
    #Cell ID 487667205

    # Other perisomatic model (available on Allen Brain Institute - CellTypes):
    #Model ID 491623973
    #Cell  ID 490387590

    print('BMTK import success')
    net = NetworkBuilder('mcortex')
    print('Network builder initiated')
    # Testing other models: # Surprise, surprise, this does not work...
    net.add_nodes(cell_name='Pvalb_490387590_m',
                  model_type='biophysical',
                  model_template='ctdb:Biophys1.hoc',
                  model_processing='aibs_perisomatic',
                  dynamics_params='491623973_fit.json',
                  morphology='Pvalb_490387590_m.swc')
    ''' # Standard
    net.add_nodes(cell_name='Scnn1a_473845048',
                  potental='exc',
                  model_type='biophysical',
                  model_template='ctdb:Biophys1.hoc',
                  model_processing='aibs_perisomatic',
                  dynamics_params='472363762_fit.json',
                  morphology='Scnn1a_473845048_m.swc')
    '''
    print('Node added')

    net.build()
    net.save_nodes(output_dir='network')
    for node in net.nodes():
        print(node)
    print('Node printed')

    from bmtk.utils.sim_setup import build_env_bionet
    print('Setting environment')

    build_env_bionet(
        base_dir='sim_ch01',  # Where to save the scripts and config files
        network_dir='network',  # Location of directory containing network files
        tstop=1200.0,
        dt=0.1,  # Run a simulation for 2000 ms at 0.1 ms intervals
        report_vars=[
            'v'
        ],  # Tells simulator we want to record membrane potential and calcium traces
        current_clamp={  # Creates a step current from 500.ms to 1500.0 ms
            'amp': 0.61,  # 0.12#0.610
            'delay': 100.0,  # 100, #500
            'duration': 1000.0
        },
        include_examples=True,  # Copies components files
        compile_mechanisms=True  # Will try to compile NEURON mechanisms
    )
    print('Build done')
Example #3
0
def build_tw():
    if not os.path.exists('output'):
        os.makedirs('output')

    TW = NetworkBuilder("TW")
    TW.add_nodes(N=3000, pop_name='TW', ei='e', location='TW', level_of_detail='filter')

    # Save cells.csv and cell_types.csv
    TW.save_nodes(nodes_file_name='output/tw_nodes.h5', node_types_file_name='output/tw_node_types.csv')

    VL4 = NetworkBuilder('V1/L4')
    VL4.import_nodes(nodes_file_name='output/v1_nodes.h5', node_types_file_name='output/v1_node_types.csv')
    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'Rorb'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.00015, 'weight_function': 'wmax', 'distance_range': [30.0, 150.0],
                      'target_sections': ['basal', 'apical'], 'delay': 2.0, 'params_file': 'AMPA_ExcToExc.json',
                      'set_params_function': 'exp2syn'}))

    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'Scnn1a'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.00019, 'weight_function': 'wmax', 'distance_range': [30.0, 150.0],
                      'target_sections': ['basal', 'apical'], 'delay': 2.0, 'params_file': 'AMPA_ExcToExc.json',
                      'set_params_function': 'exp2syn'}))

    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'Nr5a1'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.00019, 'weight_function': 'wmax', 'distance_range': [30.0, 150.0],
                      'target_sections': ['basal', 'apical'], 'delay': 2.0, 'params_file': 'AMPA_ExcToExc.json',
                      'set_params_function': 'exp2syn'}))

    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'PV1'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.0022, 'weight_function': 'wmax', 'distance_range': [0.0, 1.0e+20],
                      'target_sections': ['somatic', 'basal'], 'delay': 2.0, 'params_file': 'AMPA_ExcToInh.json',
                      'set_params_function': 'exp2syn'}))

    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'PV2'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.0013, 'weight_function': 'wmax', 'distance_range': [0.0, 1.0e+20],
                      'target_sections': ['somatic', 'basal'], 'delay': 2.0, 'params_file': 'AMPA_ExcToInh.json',
                      'set_params_function': 'exp2syn'}))

    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'LIF_exc'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.015, 'weight_function': 'wmax', 'delay': 2.0,
                      'params_file': 'instanteneousExc.json', 'set_params_function': 'exp2syn'}))

    VL4.add_edges(source=TW.nodes(), target={'pop_name': 'LIF_inh'},
                  connection_rule=lambda trg, src: 5,
                  **({'weight_max': 0.05, 'weight_function': 'wmax', 'delay': 2.0,
                      'params_file': 'instanteneousExc.json', 'set_params_function': 'exp2syn'}))

    VL4.build()
    VL4.save_edges(edges_file_name='output/tw_v1_edges.h5', edge_types_file_name='output/tw_v1_edge_types.csv')
Example #4
0
from bmtk.builder.networks import NetworkBuilder

net = NetworkBuilder('mcortex')
net.add_nodes(cell_name='Cell_PN',
              potental='exc',
              model_type='biophysical',
              model_template='hoc:Cell_PN',
              morphology=None
              )

net.build()
net.save_nodes(output_dir='network')

for node in net.nodes():
    print(node)
    
from bmtk.utils.sim_setup import build_env_bionet

build_env_bionet(base_dir='PN_IClamp',      # Where to save the scripts and config files 
                 components_dir='components',
                 network_dir='network',    # Location of directory containing network files
                 tstop=2000.0, dt=0.1,     # Run a simulation for 2000 ms at 0.1 ms intervals
                 report_vars=['v'], # Tells simulator we want to record membrane potential and calcium traces
                 current_clamp={           # Creates a step current from 500.ms to 1500.0 ms  
                     'amp': 0.3,
                     'delay': 500.0,
                     'duration': 1000.0
                 },
                 compile_mechanisms=True   # Will try to compile NEURON mechanisms
                )
                
Example #5
0
    Can also adjust weights before running the network.
    See https://github.com/AllenInstitute/bmtk/blob/develop/docs/tutorial/02_single_cell_syn.ipynb
    Section 5
    If done this way the function will need to be imported in the run script, consider refactoring?
    """

    #syn_weight = np.random.lognormal(mean=mu,sigma=sigma)
    syn_weight = mu

    return syn_weight,0,0.5


# Add connections -----------------------------------------

# Blad afferent --> INd (Grill et al. 2016)
conn = net.add_edges(source=net.nodes(pop_name='Bladaff'), target=net.nodes(pop_name='IND'),
                   connection_rule=percent_connector,
                   connection_params={'percent':100.0}, 
				   target_sections=['somatic'],
                   delay=2.0,
                   distance_range=[0.0, 300.0],
                   dynamics_params='AMPA_ExcToExc.json',
                   model_template='Exp2Syn')
				
conn.add_properties(names=['syn_weight', 'sec_id', 'sec_x'],
                    rule=conn_props,
                    rule_params={'mu':10.0e-3,'sigma':1},
                    dtypes=[np.float, np.int32, np.float])

# Blad afferent --> Hypogastric (Hou et al. 2014)
# conn = net.add_edges(source=net.nodes(pop_name='Bladaff'), target=net.nodes(pop_name='Hypo'),
Example #6
0
lgn = NetworkBuilder('LGN')
lgn.add_nodes(N=500,
              pop_name='tON',
              potential='exc',
              model_type='virtual')


def select_source_cells(sources, target, nsources_min=10, nsources_max=30, nsyns_min=3, nsyns_max=12):
    total_sources = len(sources)
    nsources = np.random.randint(nsources_min, nsources_max)
    selected_sources = np.random.choice(total_sources, nsources, replace=False)
    syns = np.zeros(total_sources)
    syns[selected_sources] = np.random.randint(nsyns_min, nsyns_max, size=nsources)
    return syns

lgn.add_edges(source=lgn.nodes(), target=net.nodes(pop_name='Scnn1a'),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={'nsources_min': 10, 'nsources_max': 25},
              syn_weight=20.0,
              delay=2.0,
              dynamics_params='ExcToExc.json',
              model_template='static_synapse')

lgn.add_edges(source=lgn.nodes(), target=net.nodes(pop_name='PV1'),
              connection_rule=select_source_cells,
              connection_params={'nsources_min': 15, 'nsources_max': 30},
              iterator='all_to_one',
              syn_weight=20.0,
              delay=2.0,
              dynamics_params='ExcToInh.json',
Example #7
0
def build_tw():
    if not os.path.exists('output/network/TW'):
        os.makedirs('output/network/TW')

    TW = NetworkBuilder("TW")
    TW.add_nodes(N=3000,
                 node_type_id='TW_001',
                 pop_name='TW',
                 ei='e',
                 location='TW',
                 level_of_detail='filter')

    # Save cells.csv and cell_types.csv
    TW.save_cells(
        filename='output/network/TW/tw_nodes.csv',
        columns=['node_id', 'node_type_id', 'pop_name', 'ei', 'location'])

    TW.save_types(filename='output/network/TW/tw_node_types.csv',
                  columns=['node_type_id', 'level_of_detail'])

    VL4 = NetworkBuilder.load("V1/L4",
                              nodes='output/network/VisL4/nodes.csv',
                              node_types='output/network/VisL4/node_types.csv')
    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'Rorb'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 12.75,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToExc.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'Scnn1a'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 33.25,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToExc.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'Nr5a1'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 19.0,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToExc.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'PV1'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 83.6,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'PV2'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 32.5,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'LIF_exc'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 22.5,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=TW.nodes(),
                target={'pop_name': 'LIF_inh'},
                connector=lambda trg, src: 5,
                edge_params={
                    'weight_max': 55.0,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.build()
    VL4.save_edge_types('output/network/TW/tw_edge_types.csv',
                        opt_columns=[
                            'weight_max', 'weight_function', 'delay',
                            'params_file', 'synapse_model'
                        ])

    VL4.save_edges(filename='output/network/TW/tw_edges.h5')
lgn = NetworkBuilder("lgn")
lgn.add_nodes(N=15, pop_name='tON', ei='e', location='LGN',
              positions=generate_positions(15),
              model_type='virtual')

lgn.add_nodes(N=15, pop_name='tOFF', ei='e', location='LGN',
              positions=generate_positions(15),
              model_type='virtual')

lgn.add_nodes(N=15, pop_name='tONOFF', ei='e', location='LGN',
              positions=generate_positions(15),
              model_type='virtual')


lgn.add_edges(source=lgn.nodes(), target=net.nodes(pop_name=''),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={'n_syns': 10},
              syn_weight=4e-05,
              weight_function='wmax',
              distance_range=[0.0, 150.0],
              target_sections=['basal', 'apical'],
              delay=2.0,
              dynamics_params='AMPA_ExcToExc.json',
              model_template='exp2syn')
lgn.build()
lgn.save(output_dir='network')


tw = NetworkBuilder("tw")
Example #9
0
from bmtk.builder.networks import NetworkBuilder


def crule(src, trg):
    # print src.node_id, trg.node_id
    return 2


net1 = NetworkBuilder('NET1')
net1.add_nodes(N=100,
               position=[(0.0, 1.0, -1.0)] * 100,
               cell_type='Scnna1',
               ei='e')
net1.add_edges(source={'ei': 'e'}, target={'ei': 'e'}, connection_rule=5)
net1.build()

net2 = NetworkBuilder('NET2')
net2.add_nodes(N=10, position=[(0.0, 1.0, -1.0)] * 10, cell_type='PV1', ei='i')
net2.add_edges(connection_rule=10)
net2.add_edges(source=net1.nodes(), connection_rule=1)
net2.add_edges(target=net1.nodes(), connection_rule=crule)
net2.build()

#net1.save_edges(output_dir='tmp_output')
net2.save_edges(output_dir='tmp_output')
lgn.add_nodes(N=15,
              pop_name='tOFF',
              ei='e',
              location='LGN',
              positions=generate_positions(15),
              model_type='virtual')

lgn.add_nodes(N=15,
              pop_name='tONOFF',
              ei='e',
              location='LGN',
              positions=generate_positions(15),
              model_type='virtual')

lgn.add_edges(source=lgn.nodes(),
              target=net.nodes(pop_name='POPNAME'),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={'n_syns': 10},
              syn_weight=4e-05,
              weight_function='wmax',
              distance_range=[0.0, 150.0],
              target_sections=['basal', 'apical'],
              delay=2.0,
              dynamics_params='AMPA_ExcToExc.json',
              model_template='exp2syn')
lgn.build()
lgn.save(output_dir='network')

tw = NetworkBuilder("tw")
Example #11
0
              connection_rule=5,
              syn_weight=12.0e-03,
              target_sections=['somatic'],
              distance_range=[0.0, 300.0],
              delay=1.0,
              dynamics_params='AMPA_ExcToExc.json',
              model_template='exp2syn')

# build and save the network.
net.build()
net.save(output_dir='network')

# An external network with 1 (excitatory virtual) cell that will connect to the internal excitatory cell to drive
# it with the spikes inputs
inputs = NetworkBuilder("external")
inputs.add_nodes(N=1, model_type='virtual')
inputs.add_edges(
    source=inputs.nodes(),
    target=net.nodes(level='low'),
    connection_rule=1,
    syn_weight=12.0E-03,
    # weight_function='wmax',
    distance_range=[0.0, 300.0],
    target_sections=['somatic'],
    delay=1.0,
    dynamics_params='AMPA_ExcToExc.json',
    model_template='exp2syn')

inputs.build()
inputs.save(output_dir='network')
Example #12
0
def build_lgn():
    def generate_positions(N, x0=0.0, x1=300.0, y0=0.0, y1=100.0):
        X = np.random.uniform(x0, x1, N)
        Y = np.random.uniform(y0, y1, N)
        return np.column_stack((X, Y))

    def select_source_cells(src_cells, trg_cell, n_syns):
        if trg_cell['tuning_angle'] is not None:
            synapses = [n_syns if src['pop_name'] == 'tON' or src['pop_name'] == 'tOFF' else 0 for src in src_cells]
        else:
            synapses = [n_syns if src['pop_name'] == 'tONOFF' else 0 for src in src_cells]

        return synapses

    if not os.path.exists('output'):
        os.makedirs('output')

    LGN = NetworkBuilder("LGN")
    LGN.add_nodes(N=3000,
                  positions=generate_positions(3000),
                  location='LGN',
                  level_of_detail='filter',
                  pop_name='tON',
                  ei='e')

    LGN.add_nodes(N=3000,
                  positions=generate_positions(3000),
                  location='LGN',
                  level_of_detail='filter',
                  pop_name='tOFF',
                  ei='e')

    LGN.add_nodes(N=3000,
                  positions=generate_positions(3000),
                  location='LGN',
                  level_of_detail='filter',
                  pop_name='tONOFF',
                  ei='e')

    VL4 = NetworkBuilder('V1/L4')
    VL4.import_nodes(nodes_file_name='output/v1_nodes.h5', node_types_file_name='output/v1_node_types.csv')
    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'Rorb'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=5e-05,
                  weight_function='wmax',
                  distance_range=[0.0, 150.0],
                  target_sections=['basal', 'apical'],
                  delay=2.0,
                  params_file='AMPA_ExcToExc.json',
                  set_params_function='exp2syn')

    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'Nr5a1'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=5e-05,
                  weight_function='wmax',
                  distance_range=[0.0, 150.0],
                  target_sections=['basal', 'apical'],
                  delay=2.0,
                  params_file='AMPA_ExcToExc.json',
                  set_params_function='exp2syn')

    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'Scnn1a'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=4e-05,
                  weight_function='wmax',
                  distance_range=[0.0, 150.0],
                  target_sections=['basal', 'apical'],
                  delay=2.0,
                  params_file='AMPA_ExcToExc.json',
                  set_params_function='exp2syn')

    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'PV1'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=0.0001,
                  weight_function='wmax',
                  distance_range=[0.0, 1.0e+20],
                  target_sections=['somatic', 'basal'],
                  delay=2.0,
                  params_file='AMPA_ExcToInh.json',
                  set_params_function='exp2syn')

    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'PV2'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=9e-05,
                  weight_function='wmax',
                  distance_range=[0.0, 1.0e+20],
                  target_sections=['somatic', 'basal'],
                  delay=2.0,
                  params_file='AMPA_ExcToInh.json',
                  set_params_function='exp2syn')

    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'LIF_exc'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=0.0045,
                  weight_function='wmax',
                  delay=2.0,
                  params_file='instanteneousExc.json',
                  set_params_function='exp2syn')

    VL4.add_edges(source=LGN.nodes(), target={'pop_name': 'LIF_inh'},
                  iterator='all_to_one',
                  connection_rule=select_source_cells,
                  connection_params={'n_syns': 10},
                  weight_max=0.002,
                  weight_function='wmax',
                  delay=2.0,
                  params_file='instanteneousExc.json',
                  set_params_function='exp2syn')

    VL4.build()
    LGN.save_nodes(nodes_file_name='output/lgn_nodes.h5', node_types_file_name='output/lgn_node_types.csv')
    VL4.save_edges(edges_file_name='output/lgn_v1_edges.h5', edge_types_file_name='output/lgn_v1_edge_types.csv')

    assert(os.path.exists('output/lgn_node_types.csv'))
    node_types_csv = pd.read_csv('output/lgn_node_types.csv', sep=' ')
    assert(len(node_types_csv) == 3)
    assert(set(node_types_csv.columns) == {'node_type_id', 'location', 'ei', 'level_of_detail', 'pop_name'})


    assert(os.path.exists('output/lgn_nodes.h5'))
    nodes_h5 = h5py.File('output/lgn_nodes.h5')
    assert(len(nodes_h5['/nodes/node_gid']) == 9000)
    assert(len(nodes_h5['/nodes/node_type_id']) == 9000)
    assert(len(nodes_h5['/nodes/node_group']) == 9000)
    assert(len(nodes_h5['/nodes/node_group_index']) == 9000)
    assert(set(nodes_h5['/nodes/0'].keys()) == {'positions'})
    assert(len(nodes_h5['/nodes/0/positions']) == 9000)

    assert(os.path.exists('output/lgn_v1_edge_types.csv'))
    edge_types_csv = pd.read_csv('output/lgn_v1_edge_types.csv', sep=' ')
    assert(len(edge_types_csv) == 7)
    assert(set(edge_types_csv.columns) == {'weight_max', 'edge_type_id', 'target_query', 'params_file',
                                           'set_params_function', 'delay', 'target_sections', 'weight_function',
                                           'source_query', 'distance_range'})

    assert(os.path.exists('output/lgn_v1_edges.h5'))
    edges_h5 = h5py.File('output/lgn_v1_edges.h5')
    assert(len(edges_h5['/edges/index_pointer']) == 14+1)
    assert(len(edges_h5['/edges/target_gid']) == 6000*14)
    assert(len(edges_h5['/edges/source_gid']) == 6000*14)
    assert(len(edges_h5['/edges/0/nsyns']) == 6000*14)
Example #13
0
#print np.sqrt(1-0.005)/0.005
"""
def connect_random(source, target, nsyn_min=0, nsyn_max=10, distribution=None):
    return np.random.randint(nsyn_min, nsyn_max)
"""

thalamus = NetworkBuilder('mthalamus')
thalamus.add_nodes(N=100,
                   pop_name='tON',
                   potential='exc',
                   level_of_detail='filter')

cortex = NetworkBuilder('mcortex')
cortex.import_nodes(nodes_file_name='network/mcortex_nodes.h5',
                    node_types_file_name='network/mcortex_node_types.csv')
thalamus.add_edges(source=thalamus.nodes(),
                   target=cortex.nodes(pop_name='Scnn1a'),
                   connection_rule=connect_random,
                   connection_params={
                       'nsyn_min': 0,
                       'nsyn_max': 12
                   },
                   weight_max=5e-05,
                   weight_function='wmax',
                   distance_range=[0.0, 150.0],
                   target_sections=['basal', 'apical'],
                   delay=2.0,
                   params_file='AMPA_ExcToExc.json',
                   set_params_function='exp2syn')

thalamus.build()
Example #14
0
                 potental='exc',
                 model_type='biophysical',
                 model_template='ctdb:Biophys1.hoc',
                 model_processing='aibs_perisomatic',
                 dynamics_params='472363762_fit.json',
                 morphology='Scnn1a_473845048_m.swc')

cortex.build()
cortex.save_nodes(output_dir='network')


thalamus = NetworkBuilder('mthalamus')
thalamus.add_nodes(N=10,
                   pop_name='tON',
                   potential='exc',
                   level_of_detail='filter')

thalamus.add_edges(source={'pop_name': 'tON'}, target=cortex.nodes(),
                   connection_rule=5,
                   syn_weight=0.001,
                   delay=2.0,
                   weight_function='wmax',
                   target_sections=['basal', 'apical'],
                   distance_range=[0.0, 150.0],
                   dynamics_params='AMPA_ExcToExc.json',
                   model_template='exp2syn')

thalamus.build()
thalamus.save_nodes(output_dir='network')
thalamus.save_edges(output_dir='network')
Example #15
0
#print np.sqrt(1-0.005)/0.005
"""
def connect_random(source, target, nsyn_min=0, nsyn_max=10, distribution=None):
    return np.random.randint(nsyn_min, nsyn_max)
"""

thalamus = NetworkBuilder('mthalamus')
thalamus.add_nodes(N=100,
                   pop_name='tON',
                   potential='exc',
                   level_of_detail='filter')

cortex = NetworkBuilder('mcortex')
cortex.import_nodes(nodes_file_name='network/mcortex_nodes.h5',
                    node_types_file_name='network/mcortex_node_types.csv')
thalamus.add_edges(source=thalamus.nodes(),
                   target=cortex.nodes(),
                   connection_rule=connect_random,
                   connection_params={
                       'nsyn_min': 0,
                       'nsyn_max': 12
                   },
                   syn_weight=1.0e-04,
                   distance_range=[0.0, 150.0],
                   target_sections=['basal', 'apical'],
                   delay=2.0,
                   dynamics_params='AMPA_ExcToExc.json',
                   model_template='exp2syn')

thalamus.build()
thalamus.save_nodes(output_dir='network')
Example #16
0
def build_ext5_nodes():
    if not os.path.exists('network'):
        os.makedirs('network')

    EXT = NetworkBuilder("EXT")
    # need 5 cells to stimulate at 5 different frequencies
    EXT.add_nodes(N=5,
                  pop_name='EXT',
                  model_type='virtual',
                  firing_rate=firing_rate)

    # Save cells.csv and cell_types.csv
    EXT.save_nodes(nodes_file_name='network/ext_nodes.h5',
                   node_types_file_name='network/ext_node_types.csv')

    net = NetworkBuilder('slice')
    net.import_nodes(nodes_file_name='network/slice_nodes.h5',
                     node_types_file_name='network/slice_node_types.csv')

    net.add_edges(source=EXT.nodes(firing_rate=10),
                  target=net.nodes(firing_rate=10, synapse_model='a'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'AMPA_ExcToExc.json',
                      'model_template': 'expsyn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=20),
                  target=net.nodes(firing_rate=20, synapse_model='a'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'AMPA_ExcToExc.json',
                      'model_template': 'expsyn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=50),
                  target=net.nodes(firing_rate=50, synapse_model='a'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'AMPA_ExcToExc.json',
                      'model_template': 'expsyn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=100),
                  target=net.nodes(firing_rate=100, synapse_model='a'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'AMPA_ExcToExc.json',
                      'model_template': 'expsyn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=200),
                  target=net.nodes(firing_rate=200, synapse_model='a'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'AMPA_ExcToExc.json',
                      'model_template': 'expsyn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=10),
                  target=net.nodes(firing_rate=10, synapse_model='b'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'pvalb_pvalb.json',
                      'model_template': 'stp2syn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=20),
                  target=net.nodes(firing_rate=20, synapse_model='b'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'pvalb_pvalb.json',
                      'model_template': 'stp2syn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=50),
                  target=net.nodes(firing_rate=50, synapse_model='b'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'pvalb_pvalb.json',
                      'model_template': 'stp2syn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=100),
                  target=net.nodes(firing_rate=100, synapse_model='b'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'pvalb_pvalb.json',
                      'model_template': 'stp2syn'
                  }))

    net.add_edges(source=EXT.nodes(firing_rate=200),
                  target=net.nodes(firing_rate=200, synapse_model='b'),
                  connection_rule=5,
                  **({
                      'syn_weight': 0.002,
                      'weight_function': 'wmax',
                      'distance_range': [0.0, 50.0],
                      'target_sections': ['somatic', 'basal', 'apical'],
                      'delay': 2.0,
                      'dynamics_params': 'pvalb_pvalb.json',
                      'model_template': 'stp2syn'
                  }))

    net.build()
    net.save_edges(edges_file_name='network/ext_to_slice_edges.h5',
                   edge_types_file_name='network/ext_to_slice_edge_types.csv')
Example #17
0
lgn.add_nodes(N=30,
              pop_name='tOFF',
              ei='e',
              location='LGN',
              positions=generate_positions(30),
              model_type='virtual')

lgn.add_nodes(N=30,
              pop_name='tONOFF',
              ei='e',
              location='LGN',
              positions=generate_positions(30),
              model_type='virtual')

lgn.add_edges(source=lgn.nodes(),
              target=net.nodes(pop_name='Rorb'),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={'n_syns': 10},
              syn_weight=5e-05,
              weight_function='wmax',
              distance_range=[0.0, 150.0],
              target_sections=['basal', 'apical'],
              delay=2.0,
              dynamics_params='AMPA_ExcToExc.json',
              model_template='exp2syn')

lgn.add_edges(source=lgn.nodes(),
              target=net.nodes(pop_name='Nr5a1'),
              iterator='all_to_one',
Example #18
0
                      pop_name=model_params['pop_name'],
                      pop_id=model_params['pop_id'])

lgn_net.build()
lgn_net.save_nodes('lgn_nodes.h5', 'lgn_node_types.csv')
exit()

v1_net = NetworkBuilder('V1')
v1_net.import_nodes('v1_nodes.h5', 'v1_node_types.csv')

lgn_mean = (np.mean(xcoords), np.mean(ycoords))
lgn_dim = (140.0, 70.0)
print "> LGN mean center:"

# Determine the mean center of the CC cells
xcoords = [n['position'][0] for n in v1_net.nodes()]
ycoords = [n['position'][1] for n in v1_net.nodes()]
zcoords = [n['position'][2] for n in v1_net.nodes()]
l4_mean = (np.mean(xcoords), np.mean(ycoords), np.mean(zcoords))
l4_dim = (max(xcoords) - min(xcoords), max(ycoords) - min(ycoords),
          max(zcoords) - min(zcoords))
print "> L4 mean center:", str(l4_mean)

cparams = {
    'lgn_mean': lgn_mean,
    'lgn_dim': lgn_dim,
    'l4_mean': l4_mean,
    'l4_dim': l4_dim,
    'N_syn': 30
}
v1_net.add_edges(sources=lgn_net.nodes(),
Example #19
0
def build_lgn():
    def generate_positions(N, x0=0.0, x1=300.0, y0=0.0, y1=100.0):
        X = np.random.uniform(x0, x1, N)
        Y = np.random.uniform(y0, y1, N)
        return np.column_stack((X, Y))

    def select_source_cells(src_cell, trg_cell, n_syns_exc, n_syns_inh):
        #if trg_cell['tuning_angle'] is not None:
        #    synapses = [n_syns if src['pop_name'] == 'tON' or src['pop_name'] == 'tOFF' else 0 for src in src_cells]
        #else:
        #    synapses = [n_syns if src['pop_name'] == 'tONOFF' else 0 for src in src_cells]

        # will always give synapse number depending on type
        if n_syns_exc > 0:
            n_synapses = n_syns_exc
        if n_syns_inh > 0:
            n_synapses = n_syns_inh

        return n_synapses

        # varible number of synapses
        #return np.random.randint(n_syns_min, n_syns_max)
        #return synapses

    if not os.path.exists('output'):
        os.makedirs('output')

    LGN = NetworkBuilder("LGN")
    LGN.add_nodes(N=1000,
                  positions=generate_positions(1000),
                  location='LGN',
                  level_of_detail='filter',
                  pop_name='ExcIN',
                  ei='e')

    LGN.add_nodes(N=1,
                  positions=generate_positions(1),
                  location='LGN',
                  level_of_detail='filter',
                  pop_name='InhIN',
                  ei='i')
  


    VL4 = NetworkBuilder('V1/L4')
    VL4.import_nodes(nodes_file_name='output/v1_nodes.h5', node_types_file_name='output/v1_node_types.csv')
    cm = VL4.add_edges(source=LGN.nodes(ei='e'), #target={'pop_name': 'DG_GC'},
                  connection_rule=select_source_cells,
                  connection_params={'n_syns_exc': 1, 'n_syns_inh': 0},
                  weight_max=10e-03,
                  weight_function='wmax',
                  distance_range=[1, 1e+20],
                  target_sections=['apical'],
                  delay=2.0,
                  params_file='AMPA_ExcToExc.json',
                  set_params_function='exp2syn')



    VL4.build()
    LGN.save_nodes(nodes_file_name='output/lgn_nodes.h5', node_types_file_name='output/lgn_node_types.csv')
    VL4.save_edges(edges_file_name='output/lgn_v1_edges.h5', edge_types_file_name='output/lgn_v1_edge_types.csv')
Example #20
0
def build_lgn():
    def generate_positions(N, x0=0.0, x1=300.0, y0=0.0, y1=100.0):
        X = np.random.uniform(x0, x1, N)
        Y = np.random.uniform(y0, y1, N)
        return np.column_stack((X, Y))

    def select_source_cells(src_cells, trg_cell, n_syns):
        if trg_cell['tuning_angle'] is not None:
            synapses = [
                n_syns
                if src['pop_name'] == 'tON' or src['pop_name'] == 'tOFF' else 0
                for src in src_cells
            ]
        else:
            synapses = [
                n_syns if src['pop_name'] == 'tONOFF' else 0
                for src in src_cells
            ]

        return synapses

    if not os.path.exists('output/network/LGN'):
        os.makedirs('output/network/LGN')

    LGN = NetworkBuilder("LGN")
    LGN.add_nodes(N=3000,
                  position='points',
                  position_params={'location': generate_positions(3000)},
                  node_type_id='tON_001',
                  location='LGN',
                  model_type='spike_generator',
                  pop_name='tON',
                  ei='e',
                  params_file='filter_point.json')

    LGN.add_nodes(N=3000,
                  position='points',
                  position_params={'location': generate_positions(3000)},
                  node_type_id='tOFF_001',
                  location='LGN',
                  model_type='spike_generator',
                  pop_name='tOFF',
                  ei='e',
                  params_file='filter_point.json')

    LGN.add_nodes(N=3000,
                  position='points',
                  position_params={'location': generate_positions(3000)},
                  node_type_id='tONOFF_001',
                  location='LGN',
                  model_type='spike_generator',
                  pop_name='tONOFF',
                  ei='e',
                  params_file='filter_point.json')

    LGN.save_cells(filename='output/network/LGN/lgn_nodes.csv',
                   columns=['node_id', 'node_type_id', 'position'],
                   position_labels=['x', 'y'])
    LGN.save_types(filename='output/network/LGN/lgn_node_types.csv',
                   columns=[
                       'node_type_id', 'ei', 'location', 'model_type',
                       'params_file'
                   ])

    VL4 = NetworkBuilder.load("V1/L4",
                              nodes='output/network/VisL4/nodes.csv',
                              node_types='output/network/VisL4/node_types.csv')

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'Rorb'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 4.125,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToExc.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'Nr5a1'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 4.5,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToExc.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'Scnn1a'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 5.6,
                    'weight_function': 'wmax',
                    'distance_range': [0.0, 150.0],
                    'delay': 2.0,
                    'params_file': 'ExcToExc.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'PV1'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 1.54,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'PV2'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 1.26,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'LIF_exc'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 4.41,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.connect(source=LGN.nodes(),
                target={'pop_name': 'LIF_inh'},
                iterator='all_to_one',
                connector=select_source_cells,
                connector_params={'n_syns': 10},
                edge_params={
                    'weight_max': 2.52,
                    'weight_function': 'wmax',
                    'delay': 2.0,
                    'params_file': 'ExcToInh.json',
                    'synapse_model': 'static_synapse'
                })

    VL4.build()
    VL4.save_edge_types('output/network/LGN/lgn_edge_types.csv',
                        opt_columns=[
                            'weight_max', 'weight_function', 'delay',
                            'params_file', 'synapse_model'
                        ])
    VL4.save_edges(filename='output/network/LGN/lgn_edges.h5')
Example #21
0
        n_syns * (np.random.random() > .1) for i in range(len(src_cells))
    ]

    return synapses


def recurrent_connections_low2(src_cells, trg_cell, n_syns):

    synapses = [
        n_syns * (np.random.random() > .1) for i in range(len(src_cells))
    ]

    return synapses


net_pre.add_edges(source=net_pre.nodes(),
                  target=net_post.nodes(pop_name='Exc'),
                  iterator='all_to_one',
                  connection_rule=recurrent_connections_low,
                  connection_params={'n_syns': 1},
                  syn_weight=5,
                  weight_function='wmax',
                  delay=0.0,
                  dynamics_params='instanteneousExc.json')
'''                 
  '''
'''
net.add_edges(source={'ei': 'i'}, target={'ei': 'i', 'model_type': 'point_process'},
              iterator='all_to_one',
              connection_rule=recurrent_connections,
              connection_params={'n_syns': 10},
              model_template='exp2syn',
              dynamics_params='GABA_InhToExc_BC_GC.json')

net.build()
net.save(output_dir='network')

# BASELINE EXTERNAL DRIVE TO THE GC population
GC_external_input = NetworkBuilder("GC_external_input")
GC_external_input.add_nodes(N=9000,
                            pop_name='perforant_path',
                            ei='e',
                            positions=generate_positions(9000),
                            model_type='virtual')
# drive to the GC population
GC_external_input.add_edges(
    source=GC_external_input.nodes(),
    target=net.nodes(ei='e'),
    connection_rule=select_random_srcs,
    connection_params={
        'nconns': 5,
        'nsyns_min': 5,
        'nsyns_max': 15
    },
    iterator='all_to_one',
    syn_weight=0.0003,
    weight_function='wmax',
    distance_range=[150.0, 1e20],
    target_sections=['basal', 'apical'],
    delay=3.0,
    model_template='exp2syn',
    dynamics_params='AMPA_ExcToExc_perforant_path.json')
Example #23
0
                        target,
                        nsources_min=10,
                        nsources_max=30,
                        nsyns_min=3,
                        nsyns_max=12):
    total_sources = len(sources)
    nsources = np.random.randint(nsources_min, nsources_max)
    selected_sources = np.random.choice(total_sources, nsources, replace=False)
    syns = np.zeros(total_sources)
    syns[selected_sources] = np.random.randint(nsyns_min,
                                               nsyns_max,
                                               size=nsources)
    return syns


lgn.add_edges(source=lgn.nodes(),
              target=net.nodes(pop_name='Scnn1a'),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={
                  'nsources_min': 10,
                  'nsources_max': 25
              },
              syn_weight=4e-03,
              weight_function='wmax',
              distance_range=[0.0, 150.0],
              target_sections=['basal', 'apical'],
              delay=2.0,
              dynamics_params='AMPA_ExcToExc.json',
              model_template='exp2syn')
Example #24
0
                 potental='exc',
                 level_of_detail='biophysical',
                 params_file='472363762_fit.json',
                 morphology_file='Scnn1a.swc',
                 set_params_function='Biophys1')

cortex.build()
cortex.save_nodes(output_dir='network')

thalamus = NetworkBuilder('mthalamus')
thalamus.add_nodes(N=10,
                   pop_name='tON',
                   potential='exc',
                   level_of_detail='filter')

thalamus.add_edges(source={'pop_name': 'tON'},
                   target=cortex.nodes(),
                   connection_rule=5,
                   weight_max=5e-05,
                   weight_function='wmax',
                   distance_range=[0.0, 150.0],
                   target_sections=['basal', 'apical'],
                   delay=2.0,
                   params_file='AMPA_ExcToExc.json',
                   set_params_function='exp2syn')

thalamus.build()
thalamus.save_nodes(output_dir='network')
thalamus.save_edges(output_dir='network')
#thalamus.save_edges(edges_file_name='thalamus_cortex_edges.h5', edge_types_file_name='thalamus_cortex_edge_types.h5')
lgn.add_nodes(N=30,
              model_name='tOFF',
              ei='e',
              location='LGN',
              positions=generate_positions(30),
              model_type='virtual')

lgn.add_nodes(N=30,
              model_name='tONOFF',
              ei='e',
              location='LGN',
              positions=generate_positions(30),
              model_type='virtual')

lgn.add_edges(
    source=lgn.nodes(),
    target=net.nodes(model_name='Rorb'),
    iterator='all_to_one',
    connection_rule=select_source_cells,
    connection_params={'n_syns': 10},
    syn_weight=5e-05,
    # weight_function='wmax',
    distance_range=[0.0, 150.0],
    target_sections=['basal', 'apical'],
    delay=2.0,
    dynamics_params='AMPA_ExcToExc.json',
    model_template='exp2syn')

lgn.add_edges(
    source=lgn.nodes(),
    target=net.nodes(model_name='Nr5a1'),
Example #26
0
    If done this way the function will need to be imported in the run script, consider refactoring?
    """

    #syn_weight = np.random.lognormal(mean=mu,sigma=sigma)
    syn_weight = mu

    return syn_weight,0,0.5


def one_to_one(source,target):
    tmp_syn = 1
    return tmp_syn

# Add connections -----------------------------------------

conn = net.add_edges(source=net.nodes(pop_name='PUDaff'), target=net.nodes(pop_name='INmminus'),
                   connection_rule=one_to_one,
                   delay=0.5,
                   syn_weight = 0.07,
                   target_sections=['somatic'],
                   distance_range=[0.0, 300.0],
                   dynamics_params='AMPA_ExcToExc.json',
                   model_template='Exp2Syn')
				
conn = net.add_edges(source=net.nodes(pop_name='PUDaff'), target=net.nodes(pop_name='INmplus'),
                   connection_rule=one_to_one,
                   delay=0.5,
                   syn_weight = 0.044,
                   target_sections=['somatic'],
                   distance_range=[0.0, 300.0],
                   dynamics_params='AMPA_ExcToExc.json',
Example #27
0
              model_type='virtual')

pos_x, pos_y = generate_positions(30)
lgn.add_nodes(N=30, model_name='tOFF', ei='e', location='LGN',
              x=pos_x, y=pos_y,
              model_type='virtual')

pos_x, pos_y = generate_positions(30)
lgn.add_nodes(N=30, model_name='tONOFF', ei='e', location='LGN',
              x=pos_x, y=pos_y,
              model_type='virtual')




lgn.add_edges(source=lgn.nodes(), target=net.nodes(model_name='LIF_exc'),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={'n_syns': 10},
              syn_weight=0.0045,
              weight_function='wmax',
              delay=2.0,
              dynamics_params='instanteneousExc.json')

lgn.add_edges(source=lgn.nodes(), target=net.nodes(model_name='LIF_inh'),
              iterator='all_to_one',
              connection_rule=select_source_cells,
              connection_params={'n_syns': 10},
              syn_weight=0.0015,
              weight_function='wmax',
              delay=2.0,