Skip to content

Convert GetConnections.sources() to iterator of NodeCollections? #2204

Open
@stinebuu

Description

@stinebuu

For SynapseCollection we have two ways of getting the source and target node ids: conns.source and conns.sources() in the snippet below

E = nest.Create('aeif_cond_exp',2)
I = nest.Create('aeif_cond_exp',2)
nest.Connect(E,I)

conns = nest.GetConnections()
s = conns.source          # returns a list of node ids
s_iter = conns.sources()  # returns an iterator, iterating over node ids

Both return node id's, but as we are using NodeCollection everywhere now, we should think about changing conns.sources() and conns.targets() to instead be iterators returning the source and target NodeCollections. As sources and targets most often are not unique, we cannot return a NodeCollection iterator directly, but we can create our own iterator that converts the node id to a NodeCollection and returns it.

This first came up in this mailing list question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I: User InterfaceUsers may need to change their code due to changes in function callsS: NormalHandle this with default priorityT: DiscussionStill searching for the right way to proceed / suggestions welcomestaleAutomatic marker for inactivity, please have another look here

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions