Skip to content

Instantly share code, notes, and snippets.

@Seanny123
Created October 15, 2016 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seanny123/9e484b573bc2da76fe3a96cc1fddf7ab to your computer and use it in GitHub Desktop.
Save Seanny123/9e484b573bc2da76fe3a96cc1fddf7ab to your computer and use it in GitHub Desktop.
Nengo thresholding neuron ensemble example
import nengo
# create a configuration for a threshold of 0.3
thresh_config = nengo.presets.ThresholdingEnsembles(0.3)
with nengo.Network() as model:
# make a cycling ramp input to show the threshold is working
in_node = nengo.Node(lambda t: 2*(t % 1) - 1)
# make an ensemble with the thresholding configuration
with thresh_config:
thresh_ens = nengo.Ensemble(100, 1)
nengo.Connection(in_node, thresh_ens)
_viz_0 = nengo_gui.components.Value(thresh_ens)
_viz_config[_viz_0].synapse = 0.01
_viz_config[_viz_0].max_value = 1
_viz_config[_viz_0].min_value = -1
_viz_config[_viz_0].legend_labels = [u'label_0']
_viz_config[_viz_0].height = 0.36381262622249616
_viz_config[_viz_0].label_visible = True
_viz_config[_viz_0].width = 0.20411653802553706
_viz_config[_viz_0].show_legend = False
_viz_config[_viz_0].y = -0.35777043239494083
_viz_config[_viz_0].x = 0.8046551435545211
_viz_1 = nengo_gui.components.Value(in_node)
_viz_config[_viz_1].synapse = 0.01
_viz_config[_viz_1].max_value = 1
_viz_config[_viz_1].min_value = -1
_viz_config[_viz_1].legend_labels = [u'label_0']
_viz_config[_viz_1].height = 0.37979894087579813
_viz_config[_viz_1].label_visible = True
_viz_config[_viz_1].width = 0.2206176761069449
_viz_config[_viz_1].show_legend = False
_viz_config[_viz_1].y = -0.344506069290224
_viz_config[_viz_1].x = 0.19079329398908626
_viz_2 = nengo_gui.components.Slider(in_node)
_viz_config[_viz_2].label_visible = True
_viz_config[_viz_2].width = 0.13506853676021696
_viz_config[_viz_2].x = -0.17346765562537164
_viz_config[_viz_2].y = 0.5138880094719239
_viz_config[_viz_2].max_value = 1
_viz_config[_viz_2].min_value = -1
_viz_config[_viz_2].height = 0.3798203888328087
_viz_ace_editor = nengo_gui.components.AceEditor()
_viz_net_graph = nengo_gui.components.NetGraph()
_viz_sim_control = nengo_gui.components.SimControl()
_viz_config[_viz_sim_control].kept_time = 4.0
_viz_config[_viz_sim_control].shown_time = 0.5
_viz_config[in_node].pos=(0.19696969696969696, 0.5)
_viz_config[in_node].size=(0.1212121212121212, 0.2)
_viz_config[model].pos=(1.300252525253887, 1.202589234876865)
_viz_config[model].size=(0.33273225123007283, 0.33273225123007283)
_viz_config[model].expanded=True
_viz_config[model].has_layout=True
_viz_config[thresh_ens].pos=(0.7727272727272727, 0.5)
_viz_config[thresh_ens].size=(0.15151515151515152, 0.25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment