How to use the nml.Interface 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 the pattern's ports (nodes) and connections
        (edges).
    id : str
        Pattern identifier.

    Returns
    -------
    pattern : neurokernel.neuroml.Pattern
        pattern instance.
    """

    pattern = Pattern(id=id)
    interface = Interface()
    for p in g.nodes():
        attr_dict = g.node[p]
        port = Port(identifier=attr_dict['identifier'],
                    interface=attr_dict['interface'],
                    io=attr_dict['io'],
                    type=attr_dict['type'])
        interface.ports.append(port)

    pattern.interface = interface
    for c in g.edges():
        connection = PatternConnection(from_=c[0], to=c[1])
        pattern.connections.append(connection)

    return pattern
github neurokernel / neurokernel / neurokernel / neuroml / utils.py View on Github external
gmax=attr_dict['gmax'],
                           reverse=attr_dict['reverse'])
            module.al_synapses.append(al)
        elif attr_dict['model'] == 'power_gpot_gpot':
            pgg = PGGSynapse(id=attr_dict['name'],
                             class_=attr_dict['class'],
                             slope=attr_dict['slope'],
                             threshold=attr_dict['threshold'],
                             power=attr_dict['power'],
                             saturation=attr_dict['saturation'],
                             delay=attr_dict['delay'],
                             reverse=attr_dict['reverse'],
                             conductance=attr_dict['conductance'])
            module.pgg_synapses.append(pgg)

    interface = Interface()
    for p in i.nodes():
        attr_dict = i.node[p]
        port = Port(identifier=p,
                    interface=attr_dict['interface'],
                    io=attr_dict['io'],
                    type=attr_dict['type'])
        interface.ports.append(port)
    module.interface = interface

    return module