示例#1
0
    def test_independent_axon_count_zero(self):
        nodes = [
            test_node(id=1, type=SOMA, parent_node_id=-1),
            test_node(id=2, type=AXON, parent_node_id=1)
        ]
        test_morphology = Morphology(nodes,
                                     node_id_cb=lambda node: node['id'],
                                     parent_id_cb=lambda node: node['parent'])
        test_morphology.validate(strict=False)

        stat = morphology_statistics(test_morphology)
        self.assertEqual(stat["Number of Independent Axons"], 0)
示例#2
0
def test_tree(nodes=None, strict_validation=False):

    if not nodes:
        return None

    for node in nodes:
        # unfortunately, pandas automatically promotes numeric types to float in to_dict
        node['parent'] = int(node['parent'])
        node['id'] = int(node['id'])
        node['type'] = int(node['type'])

    node_id_cb = lambda node: node['id']
    parent_id_cb = lambda node: node['parent']

    morpho = Morphology(nodes, node_id_cb, parent_id_cb)
    morpho.validate(strict=strict_validation)
    return morpho