Пример #1
0
def setupLayerRN(params, neuronModel, cell_params, injectionPopulations, popPoissionNoiseSource, populationsRN):
    
    #create a single RN population divided into virtual clusters one per VR
    #this will be fed by the noise population and modulated by the relevant ratecoded neuron 
    #to create a rate coded population
    
    numVR = params['NUM_VR']
    rnClusterSize = int(params['CLUSTER_SIZE']) #* params['NETWORK_SCALE']
    rnPopSize = rnClusterSize * numVR
    popName = 'popRN'
    popRN = spynnaker.Population(rnPopSize, neuronModel, cell_params, label=popName)
    populationsRN.append(popRN)

    #connect one random poisson neuron to each RN neuron
    weight = params['WEIGHT_POISSON_TO_CLUSTER_RN']
    delay =  params['DELAY_POISSON_TO_CLUSTER_RN']
    connections = utils.fromList_OneRandomSrcForEachTarget(popPoissionNoiseSource._size,popRN._size,weight,delay)
    projPoissonToClusterRN = spynnaker.Projection(popPoissionNoiseSource, popRN, spynnaker.FromListConnector(connections), target='excitatory')
    
    vr = 0
    for injectionPopn in injectionPopulations:
        connections = list()
        for fromNeuronIdx in range(injectionPopn._size):
            #connect the correct VR ratecode neuron in popRateCodeSpikes to corresponding subsection (cluster) of the RN population
            weight = params['WEIGHT_RATECODE_TO_CLUSTER_RN']
            firstIndex = vr * rnClusterSize
            lastIndex = firstIndex + rnClusterSize - 1
            connections += utils.fromList_SpecificNeuronToRange(fromNeuronIdx,firstIndex,lastIndex,weight,params['MIN_DELAY_RATECODE_TO_CLUSTER_RN'],params['MAX_DELAY_RATECODE_TO_CLUSTER_RN'])
            vr  = vr + 1
        #after the last neuron in the current injection pop, create a projection to the RN  
        projRateToClusterRN = spynnaker.Projection(injectionPopn, popRN, spynnaker.FromListConnector(connections), target='excitatory')
        print 'Added projection to RN of ', len(connections), " connections from injection pop ", injectionPopn.label, "(size ", injectionPopn._size,")"
def setupLayerRN(params, neuronModel, cell_params, popRateCodeSpikes, popPoissionNoiseSource, populationsRN):

    # create a single RN population divided into virtual clusters one per VR
    # this will be fed by the noise population and modulated by the relevant
    # ratecoded neuron
    # to create a rate coded population

    numVR = params["NUM_VR"]
    rnClusterSize = params["CLUSTER_SIZE"] * params["NETWORK_SCALE"]
    rnPopSize = rnClusterSize * numVR
    popName = "popRN"

    popRN = spynnaker.Population(rnPopSize, neuronModel, cell_params, label=popName)
    populationsRN.append(popRN)

    # connect one random poisson neuron to each RN neuron
    weight = params["WEIGHT_POISSON_TO_CLUSTER_RN"]
    delay = params["DELAY_POISSON_TO_CLUSTER_RN"]

    connections = utils.fromList_OneRandomSrcForEachTarget(popPoissionNoiseSource._size, popRN._size, weight, delay)

    projPoissonToClusterRN = spynnaker.Projection(
        popPoissionNoiseSource, popRN, spynnaker.FromListConnector(connections), target="excitatory"
    )

    connections = list()
    for vr in range(numVR):
        # connect the correct VR ratecode neuron in popRateCodeSpikes to
        # corresponding subsection (cluster) of the RN population
        weight = params["WEIGHT_RATECODE_TO_CLUSTER_RN"]
        firstIndex = vr * rnClusterSize
        lastIndex = firstIndex + rnClusterSize - 1
        connections += utils.fromList_SpecificNeuronToRange(
            vr,
            firstIndex,
            lastIndex,
            weight,
            params["MIN_DELAY_RATECODE_TO_CLUSTER_RN"],
            params["MAX_DELAY_RATECODE_TO_CLUSTER_RN"],
        )

    projRateToClusterRN = spynnaker.Projection(
        popRateCodeSpikes, popRN, spynnaker.FromListConnector(connections), target="excitatory"
    )