Exemplo n.º 1
0
def init():

    nest.ResetKernel()

    global neuron, input, vm
    neuron = nest.Create('iaf_neuron', params={'C_m': 250., 'tau_m': 10.})
    input = nest.Create('noise_generator', params={'mean': 250., 'std': 250.})
    vm = nest.Create('voltmeter')

    nest.Connect(input, neuron)
    nest.Connect(vm, neuron)

    values = request.get_json()
    nest.SetStatus(input, {
        'mean': float(values['mean']),
        'std': float(values['std'])
    })
    nest.SetStatus(neuron, {
        'C_m': float(values['C_m']),
        'tau_m': float(values['tau_m'])
    })

    nest.Simulate(1000.)

    events = nest.GetStatus(vm, 'events')[0]
    nest.SetStatus(vm, {'n_events': 0})
    return jsonify(data=hh.prep_single([events['times'], events['V_m']]))
Exemplo n.º 2
0
def init():
    # import pdb;pdb.set_trace()
    values = request.get_json()
    values["neuron"]["params"] = dict(
        zip(values["neuron"]["params"].keys(), map(lambda x: float(x), values["neuron"]["params"].values()))
    )
    values["input"]["params"] = dict(
        zip(values["input"]["params"].keys(), map(lambda x: float(x), values["input"]["params"].values()))
    )

    nest.ResetKernel()

    global neuron
    neuron = nest.Create(values["neuron"]["model"], params=values["neuron"]["params"])

    global input
    input = nest.Create(values["input"]["model"], params=values["input"]["params"])
    nest.Connect(input, neuron)

    global vm
    vm = nest.Create("voltmeter")
    nest.Connect(vm, neuron)

    nest.Simulate(1000)
    events = nest.GetStatus(vm, "events")[0]
    nest.SetStatus(vm, {"n_events": 0})
    return jsonify(data=hh.prep_single([events["times"], events["V_m"]]), values=values)
Exemplo n.º 3
0
def simulate():

    values = request.get_json()
    nest.SetStatus(input, {'mean':float(values['mean']),'std':float(values['std'])})
    nest.SetStatus(neuron, {'C_m':float(values['C_m']),'tau_m':float(values['tau_m'])})

    nest.Simulate(1.)
    events = nest.GetStatus(vm,'events')[0]
    nest.SetStatus(vm, {'n_events':0})
    return jsonify(data=hh.prep_single([events['times'], events['V_m']]))
Exemplo n.º 4
0
def simulate():
    values = request.get_json()
    values["input"]["params"] = dict(
        zip(values["input"]["params"].keys(), map(lambda x: float(x), values["input"]["params"].values()))
    )
    values["neuron"]["params"] = dict(
        zip(values["neuron"]["params"].keys(), map(lambda x: float(x), values["neuron"]["params"].values()))
    )

    nest.SetStatus(input, values["input"]["params"])
    nest.SetStatus(neuron, values["neuron"]["params"])
    nest.Simulate(1)

    events = nest.GetStatus(vm, "events")[0]
    nest.SetStatus(vm, {"n_events": 0})
    return jsonify(data=hh.prep_single([events["times"], events["V_m"]]), values=values)
Exemplo n.º 5
0
def simulate():

    values = request.get_json()
    nest.SetStatus(input, {
        'mean': float(values['mean']),
        'std': float(values['std'])
    })
    nest.SetStatus(neuron, {
        'C_m': float(values['C_m']),
        'tau_m': float(values['tau_m'])
    })

    nest.Simulate(1.)
    events = nest.GetStatus(vm, 'events')[0]
    nest.SetStatus(vm, {'n_events': 0})
    return jsonify(data=hh.prep_single([events['times'], events['V_m']]))
Exemplo n.º 6
0
def init():
    # import pdb;pdb.set_trace()
    nest.ResetKernel()

    global neuron
    neuron = nest.Create('iaf_neuron', params={'C_m': 250., 'tau_m': 10.})

    global input
    input = nest.Create('noise_generator', params={'mean':250., 'std':250.})
    nest.Connect(input,neuron)

    global vm
    vm = nest.Create('voltmeter')
    nest.Connect(vm,neuron)

    nest.Simulate(1000.)
    events = nest.GetStatus(vm,'events')[0]
    nest.SetStatus(vm, {'n_events': 0})

    # return render_template('iaf_neuron_d3-slider.html', data=hh.prep_single([events['times'], events['V_m']]))
    return render_template('iaf_neuron_jquery-slider.html', data=hh.prep_single([events['times'], events['V_m']]))
Exemplo n.º 7
0
def init():

    nest.ResetKernel()

    global neuron,input,vm
    neuron = nest.Create('iaf_neuron', params={'C_m': 250., 'tau_m': 10.})
    input = nest.Create('noise_generator', params={'mean':250., 'std':250.})
    vm = nest.Create('voltmeter')

    nest.Connect(input,neuron)
    nest.Connect(vm,neuron)

    values = request.get_json()
    nest.SetStatus(input, {'mean':float(values['mean']),'std':float(values['std'])})
    nest.SetStatus(neuron, {'C_m':float(values['C_m']),'tau_m':float(values['tau_m'])})

    nest.Simulate(1000.)

    events = nest.GetStatus(vm,'events')[0]
    nest.SetStatus(vm, {'n_events':0})
    return jsonify(data=hh.prep_single([events['times'], events['V_m']]))