AllenInstitute/bmtk

Loading nodes from SONATA files and use them to build connections with NetworkBuilder

MargauxCalice opened this issue · 1 comments

How to load already existing nodes stored in a SONATA node file in order to use them to build new connections with NetworkBuilder without having to recreate these nodes ?

Hi Margaux,

To load nodes from the SONATA file, one should use the function import_nodes(). For instance:

from bmtk.builder.networks import NetworkBuilder
from bmtk.builder.auxi.node_params import positions_columinar, xiter_random

net = NetworkBuilder('V1')
net.import_nodes(nodes_file_name='network/V1_nodes.h5', node_types_file_name='network/V1_node_types.csv')

net.add_edges(
    source={'node_id': [12,13]}, target={'pop_name': 'Scnn1a'},
    connection_rule=6,
    syn_weight=5e-05,
    weight_function='gaussianLL',
    weight_sigma=50.0,
    distance_range=[30.0, 150.0],
    target_sections=['basal', 'apical'],
    delay=2.0,
    dynamics_params='AMPA_ExcToExc.json',
    model_template='exp2syn'
)

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

You can also see an example of usage in the example network in bmtk/examples/bio_stp_models/build_network.py.

Thanks!
Ping