def create_brain():
    # Brain simulation set-up
    sim.setup(timestep=0.1,
              min_delay=0.1,
              max_delay=20.0,
              threads=1,
              rng_seeds=[1234])

    ## NEURONS ##
    # Neuronal parameters
    NEURONPARAMS = {
        'cm': 0.025,
        'v_rest': -60.5,
        'tau_m': 10.,
        'e_rev_E': 0.0,
        'e_rev_I': -75.0,
        'v_reset': -60.5,
        'v_thresh': -60.0,
        'tau_refrac': 10.0,
        'tau_syn_E': 2.5,
        'tau_syn_I': 2.5
    }
    # Build the neuronal model
    cell_class = sim.IF_cond_alpha(**NEURONPARAMS)
    # Define the neuronal population
    population = sim.Population(size=4, cellclass=cell_class)

    ## SYNAPSES ##
    # Build the weights matrix
    weights = np.zeros((2, 2))
    weights[0, 1] = 1.
    weights[1, 0] = 1.
    weights *= 5e-5
    # Synaptic parameters
    SYNAPSE_PARAMS = {
        "weight": weights,
        "delay": 1.0,
        'U': 1.0,
        'tau_rec': 1.0,
        'tau_facil': 1.0
    }
    # Build synaptic model
    synapse_type = sim.TsodyksMarkramSynapse(**SYNAPSE_PARAMS)

    ## NETWORK ##
    # Connect neurons
    connector = sim.AllToAllConnector()
    sim.Projection(presynaptic_population=population[0:2],
                   postsynaptic_population=population[2:4],
                   connector=connector,
                   synapse_type=synapse_type,
                   receptor_type='excitatory')
    # Initialize the network
    sim.initialize(population, v=population.get('v_rest'))

    return population
Ejemplo n.º 2
0
def create_brain():
    """
    Initializes PyNN with the minimal neuronal network
    """

    sim.setup(timestep=0.1,
              min_delay=0.1,
              max_delay=20.0,
              threads=1,
              rng_seeds=[1234])

    # Following parameters were taken from the husky braitenberg brain experiment (braitenberg.py)

    SENSORPARAMS = {
        'cm': 0.025,
        'v_rest': -60.5,
        'tau_m': 10.,
        'e_rev_E': 0.0,
        'e_rev_I': -75.0,
        'v_reset': -60.5,
        'v_thresh': -60.0,
        'tau_refrac': 10.0,
        'tau_syn_E': 2.5,
        'tau_syn_I': 2.5
    }

    SYNAPSE_PARAMS = {
        "weight": 0.5e-4,
        "delay": 20.0,
        'U': 1.0,
        'tau_rec': 1.0,
        'tau_facil': 1.0
    }

    cell_class = sim.IF_cond_alpha(**SENSORPARAMS)

    # Define the network structure: 2 neurons (1 sensor and 1 actors)
    population = sim.Population(size=2, cellclass=cell_class)

    synapse_type = sim.TsodyksMarkramSynapse(**SYNAPSE_PARAMS)
    connector = sim.AllToAllConnector()

    # Connect neurons
    sim.Projection(presynaptic_population=population[0:1],
                   postsynaptic_population=population[1:2],
                   connector=connector,
                   synapse_type=synapse_type,
                   receptor_type='excitatory')

    sim.initialize(population, v=population.get('v_rest'))

    return population
def create_brain(dna=l):
    """
    Initializes PyNN with the neuronal network that has to be simulated
    """

    NEURONPARAMS = {
        'v_rest': -60.5,
        'tau_m': 4.0,
        'tau_refrac': 2.0,
        'tau_syn_E': 10.0,
        'tau_syn_I': 10.0,
        'v_thresh': -60.4,
        'v_reset': -60.5
    }

    SYNAPSE_PARAMS = {"weight": 1.0, "delay": 2.0}

    population = sim.Population(10, sim.IF_cond_alpha())
    population[0:10].set(**NEURONPARAMS)

    # Connect neurons
    CIRCUIT = population

    SYN = sim.StaticSynapse(**SYNAPSE_PARAMS)

    row_counter = 0
    for row in dna:
        logger.info(row)
        n = np.array(row)
        for i in range(1, 11):
            if n[i] == 1:
                r_type = 'excitatory' if dna[i - 1][0] else 'inhibitory'
                logger.info('Synapse from Neuron: ' + str(i) + ' to ' +
                            str(row_counter + 1) + ' ' + r_type)
                sim.Projection(
                    presynaptic_population=CIRCUIT[row_counter:row_counter +
                                                   1],
                    postsynaptic_population=CIRCUIT[i - 1:i],
                    connector=sim.OneToOneConnector(),
                    synapse_type=SYN,
                    receptor_type=r_type)

        row_counter += 1

    sim.initialize(population, v=population.get('v_rest'))

    logger.debug("Circuit description: " + str(population.describe()))

    return population
def create_brain():
    """
    Initializes PyNN with the minimal neuronal network
    """
    #sim.setup(timestep=0.1, min_delay=0.1, max_delay=20., threads=1, rng_seeds=[1234])

    ## PARAMETER

    # neuron setup
    n_refl = 100  # amount of reflex neurons
    n_raphe = 100  # amount of Raphe neuros per pool
    n_total = n_refl + 2 * n_raphe

    w = 1.0  # neuron weight

    # neuron and synapse parameter
    SENSORPARAMS = {
        'v_rest': -70.0,
        'tau_m': 10.0,
        'v_thresh': -50.0,
        'tau_refrac': 5.0
    }

    REFL_PARAMS = {
        'cm': 0.025,
        'tau_m': 10.0,
        'v_reset': -60.0,
        'v_thresh': -55.0
    }

    RAPHENUCLEI_PARAMS = {'cm': 0.025, 'v_reset': -60.0, 'v_thresh': -55.0}

    SYNAPSE_PARAMS = {
        'weight': w,
        'delay': 0.0,
        'U': 1.0,
        'tau_rec': 1.0,
        'tau_facil': 1.0
    }

    refl_class = sim.IF_cond_alpha(**SENSORPARAMS)
    neurons = sim.Population(size=n_total,
                             cellclass=refl_class,
                             label='neurons')

    sim.initialize(neurons)
    return neurons
Ejemplo n.º 5
0
def create_brain():
    NEURONPARAMS = {'v_rest': -60.5,
                    'tau_m': 4.0,
                    'tau_refrac': 2.0,
                    'tau_syn_E': 10.0,
                    'tau_syn_I': 10.0,
                    'e_rev_E': 0.0,
                    'e_rev_I': -75.0,
                    'v_thresh': -60.4,
                    'v_reset': -60.5}

    SYNAPSE_PARAMS = {"weight": 1.0,
                      "delay": 2.0}

    population = sim.Population(10, sim.IF_cond_alpha())
    population[0:10].set(**NEURONPARAMS)

    # Connect neurons
    CIRCUIT = population

    SYN = sim.StaticSynapse(**SYNAPSE_PARAMS)

    row_counter = 0
    for row in dna:
        logger.info(row)
        n = np.array(row)
        r_type = 'excitatory'
        if n[0] == 0:
            r_type = 'inhibitory'
        for i in range(19, 29):
            if n[i] == 1:
                sim.Projection(presynaptic_population=CIRCUIT[row_counter:1 + row_counter],
                               postsynaptic_population=CIRCUIT[i - 19:i - 18],
                               connector=sim.OneToOneConnector(), synapse_type=SYN,
                               receptor_type=r_type)

        row_counter += 1

    sim.initialize(population, v=population.get('v_rest'))

    logger.debug("Circuit description: " + str(population.describe()))

    return population
def create_brain ():
    NEURON_PARAMS = {
        'v_rest'    : -60.5,
        'cm'        :   0.025,
        'tau_m'     :  10.0,
        'tau_refrac':  10.0,
        'tau_syn_E' :   2.5,
        'tau_syn_I' :   2.5,
        'e_rev_E'   :   0.0,
        'e_rev_I'   : -75.0,
        'v_thresh'  : -60.0,
        'v_reset'   : -60.5
        }

    neuron_pop = sim.Population (
        1,
        sim.IF_cond_alpha (**NEURON_PARAMS),
        label="neuron_pop"
        )

    return {"neuron_pop" : neuron_pop}
def create_brain():
    """
    Initializes PyNN with the neuronal network that has to be simulated
    """
    SENSORPARAMS = {'v_rest': -60.5,
                    'cm': 0.025,
                    'tau_m': 10.,
                    'tau_refrac': 10.0,
                    'tau_syn_E': 2.5,
                    'tau_syn_I': 2.5,
                    'e_rev_E': 0.0,
                    'e_rev_I': -75.0,
                    'v_thresh': -60.0,
                    'v_reset': -60.5}

    GO_ON_PARAMS = {'v_rest': -60.5,
                    'cm': 0.025,
                    'tau_m': 10.0,
                    'e_rev_E': 0.0,
                    'e_rev_I': -75.0,
                    'v_reset': -61.6,
                    'v_thresh': -60.51,
                    'tau_refrac': 10.0,
                    'tau_syn_E': 2.5,
                    'tau_syn_I': 2.5}

    # POPULATION_PARAMS = SENSORPARAMS * 5 + GO_ON_PARAMS + SENSORPARAMS * 2

    population = sim.Population(8, sim.IF_cond_alpha())
    population[0:5].set(**SENSORPARAMS)
    population[5:6].set(**GO_ON_PARAMS)
    population[6:8].set(**SENSORPARAMS)

    # Shared Synapse Parameters
    syn_params = {'U': 1.0, 'tau_rec': 1.0, 'tau_facil': 1.0}

    # Synaptic weights
    WEIGHT_RED_TO_ACTOR = 1.5e-4
    WEIGHT_RED_TO_GO_ON = 1.2e-3  # or -1.2e-3?
    WEIGHT_GREEN_BLUE_TO_ACTOR = 1.05e-4
    WEIGHT_GO_ON_TO_RIGHT_ACTOR = 1.4e-4
    DELAY = 0.1

    # Connect neurons
    CIRCUIT = population

    SYN = sim.TsodyksMarkramSynapse(weight=abs(WEIGHT_RED_TO_ACTOR),
                                    delay=DELAY, **syn_params)
    sim.Projection(presynaptic_population=CIRCUIT[2:3],
                   postsynaptic_population=CIRCUIT[7:8],
                   connector=sim.AllToAllConnector(),
                   synapse_type=SYN,
                   receptor_type='excitatory')
    sim.Projection(presynaptic_population=CIRCUIT[3:4],
                   postsynaptic_population=CIRCUIT[6:7],
                   connector=sim.AllToAllConnector(),
                   synapse_type=SYN,
                   receptor_type='excitatory')

    SYN = sim.TsodyksMarkramSynapse(weight=abs(WEIGHT_RED_TO_GO_ON),
                                    delay=DELAY, **syn_params)
    sim.Projection(presynaptic_population=CIRCUIT[0:2],
                   postsynaptic_population=CIRCUIT[5:6],
                   connector=sim.AllToAllConnector(),
                   synapse_type=SYN,
                   receptor_type='inhibitory')

    SYN = sim.TsodyksMarkramSynapse(weight=abs(WEIGHT_GREEN_BLUE_TO_ACTOR),
                                    delay=DELAY, **syn_params)
    sim.Projection(presynaptic_population=CIRCUIT[4:5],
                   postsynaptic_population=CIRCUIT[7:8],
                   connector=sim.AllToAllConnector(),
                   synapse_type=SYN,
                   receptor_type='excitatory')

    SYN = sim.TsodyksMarkramSynapse(weight=abs(WEIGHT_GO_ON_TO_RIGHT_ACTOR),
                                    delay=DELAY, **syn_params)
    sim.Projection(presynaptic_population=CIRCUIT[5:6],
                   postsynaptic_population=CIRCUIT[7:8],
                   connector=sim.AllToAllConnector(),
                   synapse_type=SYN,
                   receptor_type='excitatory')

    sim.initialize(population, v=population.get('v_rest'))

    logger.info("Circuit description: " + str(population.describe()))

    return population
Ejemplo n.º 8
0
def create_brain():
    """
    Initializes PyNN with the minimal neuronal network
    """
    #sim.setup(timestep=0.1, min_delay=0.1, max_delay=20.0, threads=1, rng_seeds=[1234])

    ## PARAMETER

    # neuron setup
    #n_sens = 10         # amount of sensory neurons (per joint)
    n_refl = 100  # amount of reflex neurons
    n_raphe = 100
    n_test = 100
    n_total = n_refl + 2 * n_raphe

    w = 1.0  # neuron weight

    # neuron and synapse parameter
    SENSORPARAMS = {
        'cm': 0.025,
        'v_rest': -60.5,
        'tau_m': 10.,
        'e_rev_E': 0.0,
        'e_rev_I': -75.0,
        'v_reset': -60.5,
        'v_thresh': -60.0
    }

    REFL_PARAMS = {
        'cm': 0.025,
        'tau_m': 10.0,
        'v_reset': -60.0,
        'v_thresh': -55.0
    }

    RAPHENUCLEI_PARAMS = {'cm': 0.025, 'v_reset': -60.0, 'v_thresh': -55.0}

    SYNAPSE_PARAMS = {
        'weight': w,
        'delay': 0.0,
        'U': 1.0,
        'tau_rec': 1.0,
        'tau_facil': 1.0
    }

    # ask PHILIPP which kind of neurons from PyNN
    refl_class = sim.IF_cond_alpha(**SENSORPARAMS)
    neurons = sim.Population(size=n_total,
                             cellclass=refl_class,
                             label='neurons')

    #neurons[0:n_refl].set(**REFL_PARAMS)
    #neurons[n_refl:n_total].set(**RAPHENUCLEI_PARAMS)

    #sim.Projection(presynaptic_population=pop_j1,
    #               postsynaptic_population=pop_refl,
    #               connector=connector,
    #               synapse_type=synapse_type,
    #               receptor_type='excitatory')

    #poisson_class = sim.SpikeSourcePoisson()
    #test_pop = sim.Population(size=n_test, cellclass=poisson_class, label='test_pop')
    #test_pop2= sim.Population(size=1, cellclass=refl_class, label='test_pop2')
    #test_pop.rate = 1000000.0
    #sim.Projection(test_pop, test_pop2, connector = sim.AllToAllConnector())
    #population = sim.Assembly(neurons, test_pop, test_pop2)
    #sim.initialize(population)
    #return population

    sim.initialize(neurons)
    return neurons