Exemplo n.º 1
0
import psyneulink as pnl
import FN

FN = pnl.Composition(name='FN')

FNpop_0 = pnl.IntegratorMechanism(name='FNpop_0',
                                  function=pnl.FitzHughNagumoIntegrator(
                                      name='Function_FitzHughNagumoIntegrator',
                                      d_v=1,
                                      initial_v=-1))

FN.add_node(FNpop_0)
import psyneulink as pnl
import sys

fhn = pnl.FitzHughNagumoIntegrator(
    a_v=0.7,
    a_w=0.7,
    b_v=0.8,
    b_w=0.8,
    initial_v=-1.2,
    initial_w=-0.6,
    time_step_size=0.001,
)

syn1_flat = pnl.TransferMechanism(name='syn1_flat', function=pnl.Exponential)

fn_pop1 = pnl.IntegratorMechanism(name='fnPop1', function=fhn)
fn_pop2 = pnl.IntegratorMechanism(name='fnPop2', function=fhn)

composition = pnl.Composition()
composition.add_linear_processing_pathway([fn_pop1, syn1_flat, fn_pop2])

sys.stderr.write(composition.json_summary)
import psyneulink as pnl

comp = pnl.Composition(name='comp')

fn = pnl.IntegratorMechanism(name='fn',
                             function=pnl.FitzHughNagumoIntegrator(
                                 name='FitzHughNagumoIntegrator Function-0',
                                 d_v=1,
                                 initial_v=-1,
                                 initializer=[[0]],
                                 default_variable=[[0]]))
im = pnl.IntegratorMechanism(name='im',
                             function=pnl.AdaptiveIntegrator(
                                 initializer=[[0]],
                                 rate=0.5,
                                 default_variable=[[0]]))

comp.add_node(fn)
comp.add_node(im)

comp.add_projection(projection=pnl.MappingProjection(
    name='MappingProjection from fn[OutputPort-0] to im[InputPort-0]',
    function=pnl.LinearMatrix(matrix=[[1.0]], default_variable=[-1.0])),
                    sender=fn,
                    receiver=im)

comp.scheduler.add_condition(fn, pnl.Always())
comp.scheduler.add_condition(
    im, pnl.All(pnl.EveryNCalls(fn, 20.0), pnl.AfterNCalls(fn, 1600.0)))

comp.scheduler.termination_conds = {
Exemplo n.º 4
0
import psyneulink as pnl
import matplotlib.pyplot as plt

dt = 0.05
simtime = 100

time_step_size = dt

fhn = pnl.FitzHughNagumoIntegrator(
    initial_v=-1,
    initial_w=0,
    d_v=1,
    time_step_size=time_step_size,
)

print(f"Running simple model of FitzHugh Nagumo cell for {simtime}ms: {fhn}")

fn = pnl.IntegratorMechanism(name="fn", function=fhn)

comp = pnl.Composition(name="comp")

im = pnl.IntegratorMechanism(name="im")  # only used to demonstrate conditions
comp.add_linear_processing_pathway([fn, im])
comp.scheduler.add_condition_set({
    fn:
    pnl.TimeInterval(repeat=0.05, unit="ms"),
    im:
    pnl.TimeInterval(start=80, repeat=1, unit="ms"),
})

comp.termination_processing = {
Exemplo n.º 5
0
import psyneulink as pnl

comp = pnl.Composition(name='comp')

fn = pnl.IntegratorMechanism(name='fn', function=pnl.FitzHughNagumoIntegrator(name='FitzHughNagumoIntegrator Function-0', d_v=1, initial_v=-1, initializer=[1.0], default_variable=[[0]]))

comp.add_node(fn)


comp.scheduler.add_condition(fn, pnl.Always())

comp.scheduler.termination_conds = {pnl.TimeScale.RUN: pnl.Never(), pnl.TimeScale.TRIAL: pnl.AllHaveRun()}
comp.show_graph()
Exemplo n.º 6
0
import psyneulink as pnl

comp = pnl.Composition(name="comp")

fn = pnl.IntegratorMechanism(
    name="fn",
    function=pnl.FitzHughNagumoIntegrator(
        name="FitzHughNagumoIntegrator_Function_0",
        d_v=1,
        initial_v=-1,
        initializer=[[0]],
        default_variable=[[0]],
    ),
)
im = pnl.IntegratorMechanism(
    name="im",
    function=pnl.AdaptiveIntegrator(initializer=[[0]],
                                    rate=0.5,
                                    default_variable=[[0]]),
)

comp.add_node(fn)
comp.add_node(im)

comp.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection_from_fn_OutputPort_0__to_im_InputPort_0_",
        function=pnl.LinearMatrix(default_variable=[-1.0], matrix=[[1.0]]),
    ),
    sender=fn,
    receiver=im,