import nengo import nengo.spa as spa D=64 model = spa.SPA(label='Binding') with model: model.a = spa.Buffer(D) model.b = spa.Buffer(D) model.c = spa.Buffer(D) model.q = spa.Buffer(D) model.r = spa.Buffer(D) model.cortical = spa.Cortical(spa.Actions( 'c = a*b', 'c = c', 'r = c*~q'), synapse=0.1) nengo.Probe(model.a.state.output) nengo.Probe(model.b.state.output) nengo.Probe(model.c.state.output) nengo.Probe(model.q.state.output) nengo.Probe(model.r.state.output) import nengo import nengo.spa as spa model = spa.SPA(label="SPA1") with model: model.state = spa.Buffer(16) model.motor = spa.Buffer(16) actions = spa.Actions( 'dot(state, DOG) --> motor=BARK', 'dot(state, CAT) --> motor=MEOW', 'dot(state, RAT) --> motor=SQUEAK', 'dot(state, COW) --> motor=MOO', ) model.bg = spa.BasalGanglia(actions) model.thalamus = spa.Thalamus(model.bg) nengo.Probe(model.state.state.output) nengo.Probe(model.motor.state.output) nengo.Probe(model.bg.input) nengo.Probe(model.thalamus.actions.output) import nengo import nengo.spa as spa model = spa.SPA(label="SPA2") with model: model.state = spa.Buffer(16) actions = spa.Actions( 'dot(state, A) --> state=B', 'dot(state, B) --> state=C', 'dot(state, C) --> state=D', 'dot(state, D) --> state=E', 'dot(state, E) --> state=A', ) model.bg = spa.BasalGanglia(actions) model.thalamus = spa.Thalamus(model.bg) nengo.Probe(model.state.state.output) nengo.Probe(model.bg.input) nengo.Probe(model.thalamus.actions.output) import nengo import nengo.spa as spa model = spa.SPA(label="SPA1") with model: model.state = spa.Buffer(16) actions = spa.Actions( 'dot(state, A) --> state=B', 'dot(state, B) --> state=C', 'dot(state, C) --> state=D', 'dot(state, D) --> state=E', 'dot(state, E) --> state=A', ) model.bg = spa.BasalGanglia(actions) model.thalamus = spa.Thalamus(model.bg) def state_in(t): if t<0.1: return 'C' else: return '0' model.input = spa.Input(state=state_in) nengo.Probe(model.state.state.output) nengo.Probe(model.bg.input) nengo.Probe(model.thalamus.actions.output) import nengo import nengo.spa as spa model = spa.SPA(label="SPA1") with model: model.vision = spa.Buffer(16) model.state = spa.Buffer(16) actions = spa.Actions( 'dot(vision, A+B+C+D+E) --> state=vision', 'dot(state, A) --> state=B', 'dot(state, B) --> state=C', 'dot(state, C) --> state=D', 'dot(state, D) --> state=E', 'dot(state, E) --> state=A', ) model.bg = spa.BasalGanglia(actions) model.thalamus = spa.Thalamus(model.bg) def vision_in(t): if t<0.1: return 'C' else: return '0' model.input = spa.Input(vision=vision_in) nengo.Probe(model.state.state.output) nengo.Probe(model.vision.state.output) nengo.Probe(model.bg.input) nengo.Probe(model.thalamus.actions.output)