How to use the nml.PatternConnection 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
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