How to use the nml.Module function in nml

To help you get started, we’ve selected a few nml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neurokernel / neurokernel / neurokernel / neuroml / utils.py View on Github external
Parameters
    ----------
    g : networkx.DiGraph
        Directed graph containing a module's neurons and synapses
    i : networkx.Graph
        Undirected graph containing a module's interface ports.
    id : str
        Module identifier.

    Returns
    -------
    module : neurokernel.neuroml.Module
        Module instance.
    """

    module = Module(id=id)

    for n in g.nodes():
        attr_dict = g.node[n]
        if attr_dict['model'] == 'MorrisLecar':
            ml = MLNeuron(id=attr_dict['name'],
                          extern=attr_dict['extern'],
                          public=attr_dict['public'],
                          spiking=attr_dict['spiking'],
                          V1=attr_dict['V1'],
                          V2=attr_dict['V2'],
                          V3=attr_dict['V3'],
                          V4=attr_dict['V4'],
                          phi=attr_dict['phi'],
                          offset=attr_dict['offset'],
                          init_v=attr_dict['initV'],
                          initn=attr_dict['initn'])
github neurokernel / neurokernel / neurokernel / neuroml / utils.py View on Github external
Convert a module expressed in Neurokernel NeuroML into NetworkX graphs.

    Parameters
    ----------
    module : neurokernel.neuroml.Module
        Module instance.

    Returns
    -------
    g : networkx.DiGraph
        Directed graph containing a module's neurons and synapses
    i : networkx.Graph
        Undirected graph containing a module's interface ports.
    """

    assert isinstance(module, Module)

    # Ensure that none of the neurons or synapses have duplicate IDs:
    assert len(set([n.id for n in module.ml_neurons])) == \
        len(module.ml_neurons)
    assert len(set([n.id for n in module.lif_neurons])) == \
        len(module.lif_neurons)
    assert len(set([s.id for s in module.al_synapses])) == \
        len(module.al_synapses)
    assert len(set([s.id for s in module.pgg_synapses])) == \
        len(module.pgg_synapses)

    g = nx.DiGraph()
    for n in module.ml_neurons:
        g.add_node(n.id)
        g.node[n.id] = {
            'model': 'MorrisLecar',