Skip to content

Commit

Permalink
Neaten off-set construction
Browse files Browse the repository at this point in the history
  • Loading branch information
mundya committed Oct 27, 2016
1 parent e10a559 commit 6b0c776
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nengo_spinnaker/operators/lif.py
Expand Up @@ -525,15 +525,16 @@ def load_to_machine(self, netlist, controller):
}

# Hence build the set of keys and masks which should NOT match against
# each routing region.
# each routing region. Do this by building a set of all the expected
# keys and masks and then subtracting from that set the ones which are
# expected to match in each region.
off_sets = collections.defaultdict(set)
for a, on_set in iteritems(on_sets):
for b in RoutingRegions:
# Add the on-set for this region `b` to the off-set
off_sets[a].update(on_sets[b])
for off_set in itervalues(on_sets):
off_sets[a].update(off_set)

# Elements which are in the on-set for `a` cannot be in the off-set
off_sets[a].difference_update(on_sets[a])
off_sets[a].difference_update(on_set)

# Build the filter routing region, minimising the entries subject to
# the off-sets which were just constructed.
Expand Down

0 comments on commit 6b0c776

Please sign in to comment.