[nengo-user] Passing parameters via a GUI in Nengo

Terry Stewart terry.stewart at gmail.com
Thu May 28 14:34:01 EDT 2015


Hello,

I find the easiest way to do that it to add a separate input that
controls those parameters, and feed that into your wave object.
Here's a quick example:

--------------
import nef
import math

net=nef.Network('Sine Wave')

# define the SimpleNode
class SineWave(nef.SimpleNode):
    def __init__(self,name):
        self.anyparam = 0
        self.duration = 0
        nef.SimpleNode.__init__(self,name)
    def termination_inputs(self, x, dimensions=2):
        self.anyparam = x[0]
        self.duration = x[1]
    def origin_wave(self):
        return [math.sin(self.t * self.duration) + self.anyparam]
wave=net.add(SineWave('wave'))
net.make('neurons',100,1)

control = net.make_input('control', [0, 0])
net.connect(control, wave.getTermination('inputs'))

# connect the SimpleNode to the group of neurons
net.connect(wave.getOrigin('wave'),'neurons')
net.add_to_nengo()
--------------------

That was you can have some sliders that control "anyparam" and
"duration", or whatever other parameters you want.

:)
Terry

On Thu, May 28, 2015 at 1:53 PM, Sourbh Bhadane
<bhadane.sourbh at gmail.com> wrote:
> Hi all,
>
> I am making a model in Nengo and I want to be able to modify custom
> parameters using some graphical interface. How can I do this using Nengo ?
>
> For example in the code : http://pastebin.com/QN1jA4YX
>
> What can I change/add so that the parameters anyparam, duration can be seen
> in some GUI or say in the Inspector ?
>
>
>
> _______________________________________________
> nengo-user mailing list
> nengo-user at ctnsrv.uwaterloo.ca
> http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user
>



More information about the nengo-user mailing list