Exemple #1
0
def debugPostNeuron(no_connection, post_index):
    """Debugs a single neuron on the post layer of a single mapping

    Tries to map the neuron step by step up to the synapse layer, stopping as soon as it fails to connect.
    Prints information about every step while doing so.

    :param no_connection: The connection index of the mapping
    :type no_connection: int
    :param post_index: The post-index of the neuron
    :type post_index: int"""
    layers = model.CONNECTIONS[no_connection][0]
    neuronset1 = model.CONNECTIONS[no_connection][1]
    neuronset2 = model.CONNECTIONS[no_connection][2]
    slayer = model.CONNECTIONS[no_connection][3]
    connections = model.CONNECTIONS[no_connection][4]
    distances = model.CONNECTIONS[no_connection][5]
    for s in range(len(layers) - 1, slayer, -1):
        post_p3d, post_p2d, post_d = pam.computeMapping(
            layers[: s - 2 : -1],
            connections[: s - 2 : -1],
            distances[: s - 2 : -1],
            layers[-1].particle_systems[neuronset2].particles[post_index].location,
            debug=True,
        )
        logger.info("Layer: " + str(s))
        logger.info("   post_p3d: " + str(post_p3d))
        logger.info("   post_p2d: " + str(post_p2d))
        logger.info("   post_d: " + str(post_d))
        if post_d is None:
            break
    logger.info("==========================")
Exemple #2
0
def debugPreNeuron(no_connection, pre_index):
    """Debugs a single neuron on the pre layer of a single mapping

    Tries to map the neuron step by step up to the synapse layer, stopping as soon as it fails to connect.
    Prints information about every step while doing so.

    :param no_connection: The connection index of the mapping
    :type no_connection: int
    :param pre_index: The pre-index of the neuron
    :type pre_index: int"""
    layers = model.CONNECTIONS[no_connection][0]
    neuronset1 = model.CONNECTIONS[no_connection][1]
    neuronset2 = model.CONNECTIONS[no_connection][2]
    slayer = model.CONNECTIONS[no_connection][3]
    connections = model.CONNECTIONS[no_connection][4]
    distances = model.CONNECTIONS[no_connection][5]

    for s in range(2, (slayer + 1)):
        pre_p3d, pre_p2d, pre_d = pam.computeMapping(
            layers[0:s],
            connections[0 : (s - 1)],
            distances[0 : (s - 2)] + [pam.DIS_euclidUV],
            layers[0].particle_systems[neuronset1].particles[pre_index].location,
            debug=True,
        )
        logger.info("Layer: " + layers[s - 1].name)
        logger.info("   pre_p3d: " + str(pre_p3d))
        logger.info("   pre_p2d: " + str(pre_p2d))
        logger.info("   pre_d: " + str(pre_d))
        if pre_d is None:
            break
    logger.info("==========================")
Exemple #3
0
def debugPostMapping(no_connection):
    """Debugs a specified post-mapping for unconnected neurons

    Checks all post-neurons of a connection that do not connect to a different neuron
    using the debug mode of pam.computeMapping()
    :param no_connection: The connection index of the mapping
    :type no_connection: int"""

    con = model.MODEL.connections[no_connection]
    layers = con.layers
    slayer = con.synaptic_layer_index
    connections = con.mapping_connections
    distances = con.mapping_distances

    neuronIDs = []

    logger.info("Checking post mapping " +
                str(model.MODEL.connections[no_connection]))

    for i in range(0, con.post_layer.neuron_count):
        post_p3d, post_p2d, post_d = pam.computeMapping(
            layers[:(slayer - 1):-1], connections[:(slayer - 1):-1],
            distances[:(slayer - 1):-1], con.post_layer.getNeuronPosition(i))
        if post_p3d is None:
            neuronIDs.append(i)
    if len(neuronIDs):
        logger.info(str(len(neuronIDs)) + " neurons unconnected")
    else:
        logger.info("No unconnected neurons")

    for neuronID in neuronIDs:
        logger.info("Post-index: " + str(neuronID))
        debugPostNeuron(no_connection, neuronID)
Exemple #4
0
def debugPreNeuron(no_connection, pre_index):
    """Debugs a single neuron on the pre layer of a single mapping

    Tries to map the neuron step by step up to the synapse layer, stopping as soon as it fails to connect.
    Prints information about every step while doing so.

    :param no_connection: The connection index of the mapping
    :type no_connection: int
    :param pre_index: The pre-index of the neuron
    :type pre_index: int"""

    con = model.MODEL.connections[no_connection]
    layers = con.layers
    slayer = con.synaptic_layer_index
    connections = con.mapping_connections
    distances = con.mapping_distances

    for s in range(2, (slayer + 1)):
        pre_p3d, pre_p2d, pre_d = pam.computeMapping(
            layers[0:s],
            connections[0:(s - 1)],
            distances[0:(s - 2)] + [constants.DIS_euclidUV],
            con.pre_layer.getNeuronPosition(pre_index),
            debug=True)
        logger.info("Layer: " + layers[s - 1].name)
        logger.info("   pre_p3d: " + str(pre_p3d))
        logger.info("   pre_p2d: " + str(pre_p2d))
        logger.info("   pre_d: " + str(pre_d))
        if pre_d is None:
            break
    logger.info("==========================")
Exemple #5
0
def debugPostNeuron(no_connection, post_index):
    """Debugs a single neuron on the post layer of a single mapping

    Tries to map the neuron step by step up to the synapse layer, stopping as soon as it fails to connect.
    Prints information about every step while doing so.

    :param no_connection: The connection index of the mapping
    :type no_connection: int
    :param post_index: The post-index of the neuron
    :type post_index: int"""

    con = model.MODEL.connections[no_connection]
    layers = con.layers
    slayer = con.synaptic_layer_index
    connections = con.mapping_connections
    distances = con.mapping_distances

    for s in range(len(layers) - 1, slayer, -1):
        post_p3d, post_p2d, post_d = pam.computeMapping(
            layers[:s - 2:-1],
            connections[:s - 2:-1],
            distances[:s - 2:-1],
            con.post_layer.getNeuronPosition(post_index),
            debug=True)
        logger.info("Layer: " + str(s))
        logger.info("   post_p3d: " + str(post_p3d))
        logger.info("   post_p2d: " + str(post_p2d))
        logger.info("   post_d: " + str(post_d))
        if post_d is None:
            break
    logger.info("==========================")
def debugPostMapping(no_connection):
    """Debugs a specified post-mapping for unconnected neurons

    Checks all post-neurons of a connection that do not connect to a different neuron
    using the debug mode of pam.computeMapping()
    :param no_connection: The connection index of the mapping
    :type no_connection: int"""

    con = model.MODEL.connections[no_connection] 
    layers = con.layers
    slayer = con.synaptic_layer_index
    connections = con.mapping_connections
    distances = con.mapping_distances

    neuronIDs = []

    logger.info("Checking post mapping " + str(model.MODEL.connections[no_connection]))

    for i in range(0, con.post_layer.neuron_count):
        post_p3d, post_p2d, post_d = pam.computeMapping(layers[:(slayer - 1):-1],
                                                    connections[:(slayer - 1):-1],
                                                    distances[:(slayer - 1):-1],
                                                    con.post_layer.getNeuronPosition(i))
        if post_p3d is None:
            neuronIDs.append(i)
    if len(neuronIDs):
        logger.info(str(len(neuronIDs)) + " neurons unconnected")
    else:
        logger.info("No unconnected neurons")

    for neuronID in neuronIDs:
        logger.info("Post-index: " + str(neuronID))
        debugPostNeuron(no_connection, neuronID)
def debugPreNeuron(no_connection, pre_index):
    """Debugs a single neuron on the pre layer of a single mapping

    Tries to map the neuron step by step up to the synapse layer, stopping as soon as it fails to connect.
    Prints information about every step while doing so.

    :param no_connection: The connection index of the mapping
    :type no_connection: int
    :param pre_index: The pre-index of the neuron
    :type pre_index: int"""
    
    con = model.MODEL.connections[no_connection] 
    layers = con.layers
    slayer = con.synaptic_layer_index
    connections = con.mapping_connections
    distances = con.mapping_distances

    for s in range(2, (slayer + 1)):
        pre_p3d, pre_p2d, pre_d = pam.computeMapping(
            layers[0:s],
            connections[0:(s - 1)],
            distances[0:(s - 2)] + [constants.DIS_euclidUV],
            con.pre_layer.getNeuronPosition(pre_index),
            debug=True
        )
        logger.info("Layer: " + layers[s-1].name)
        logger.info("   pre_p3d: " + str(pre_p3d))
        logger.info("   pre_p2d: " + str(pre_p2d))
        logger.info("   pre_d: " + str(pre_d))
        if pre_d is None:
            break
    logger.info("==========================")
def debugPostNeuron(no_connection, post_index):
    """Debugs a single neuron on the post layer of a single mapping

    Tries to map the neuron step by step up to the synapse layer, stopping as soon as it fails to connect.
    Prints information about every step while doing so.

    :param no_connection: The connection index of the mapping
    :type no_connection: int
    :param post_index: The post-index of the neuron
    :type post_index: int"""

    con = model.MODEL.connections[no_connection] 
    layers = con.layers
    slayer = con.synaptic_layer_index
    connections = con.mapping_connections
    distances = con.mapping_distances

    for s in range(len(layers) - 1, slayer, -1):
        post_p3d, post_p2d, post_d = pam.computeMapping(layers[:s-2:-1],
                                                        connections[:s-2:-1],
                                                        distances[:s-2:-1],
                                                        con.post_layer.getNeuronPosition(post_index),
                                                        debug = True)
        logger.info("Layer: " + str(s))
        logger.info("   post_p3d: " + str(post_p3d))
        logger.info("   post_p2d: " + str(post_p2d))
        logger.info("   post_d: " + str(post_d))
        if post_d is None:
            break
    logger.info("==========================")
Exemple #9
0
def debugPostMapping(no_connection):
    """Debugs a specified post-mapping for unconnected neurons

    Checks all post-neurons of a connection that do not connect to a different neuron
    using the debug mode of pam.computeMapping()
    :param no_connection: The connection index of the mapping
    :type no_connection: int"""
    layers = model.CONNECTIONS[no_connection][0]
    neuronset1 = model.CONNECTIONS[no_connection][1]
    neuronset2 = model.CONNECTIONS[no_connection][2]
    slayer = model.CONNECTIONS[no_connection][3]
    connections = model.CONNECTIONS[no_connection][4]
    distances = model.CONNECTIONS[no_connection][5]

    neuronIDs = []

    logger.info(
        "Checking post mapping "
        + str(model.CONNECTIONS[no_connection][0][0].name)
        + " -> "
        + str(model.CONNECTIONS[no_connection][0][-1].name)
    )

    for i in range(0, len(layers[-1].particle_systems[neuronset2].particles)):
        post_p3d, post_p2d, post_d = pam.computeMapping(
            layers[: (slayer - 1) : -1],
            connections[: (slayer - 1) : -1],
            distances[: (slayer - 1) : -1],
            layers[-1].particle_systems[neuronset2].particles[i].location,
        )
        if post_p3d is None:
            neuronIDs.append(i)
    if len(neuronIDs):
        logger.info(str(len(neuronIDs)) + " neurons unconnected")
    else:
        logger.info("No unconnected neurons")

    for neuronID in neuronIDs:
        logger.info("Post-index: " + str(neuronID))
        debugPostNeuron(no_connection, neuronID)