I believe the solution I proposed in your other thread (i.e., using multi-dimensional outputs for nodes) will solve this issue.
However, if you really want to use the approach you’ve taken above, then I suggest making another class function which serves only to increment the counter variable. You should also remove the counter logic from the other functions (sepal_length
, sepal_width
, etc.)
class Datafeeder:
...
def incr_count(t):
self.t = t
self.counter = self.index()
...
Then, in your Nengo model, you’ll need to create a node to call this function. Whether or not you call the other function does not matter, just as long as this function is called:
with model:
...
count_node = nengo.Node(data_feeder.incr_count)
feature_1 = nengo.Node(data_feeder.sepal_length)
...