Skip to content

Commit

Permalink
Speed up Pattern.is_connected() by not calling Interface.interface_po…
Browse files Browse the repository at this point in the history
…rts() and by using a set operation.
  • Loading branch information
lebedov committed Mar 25, 2015
1 parent 1cebcd7 commit 3e800ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neurokernel/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,8 @@ def is_connected(self, from_int, to_int):

# Get indices of the 'from' and 'to' interfaces as lists to speed up the
# check below [*]:
from_idx = self.interface.interface_ports(from_int, True)
to_idx = self.interface.interface_ports(to_int, True)
from_idx = set(self.interface.data[self.interface.data['interface'] == from_int].index.tolist())
to_idx = set(self.interface.data[self.interface.data['interface'] == to_int].index.tolist())

# Get index of all defined connections:
idx = self.data[self.data['conn'] != 0].index
Expand Down

0 comments on commit 3e800ea

Please sign in to comment.