class TestMorphologyMemoryManagement(unittest.TestCase): def setUp(self): self.morphology = Morphology(morphology_path) def test_soma(self): soma = self.morphology.soma() del self.morphology points = soma.profile_points() sum = numpy.zeros(4) for p in points: sum += p def test_section(self): section = self.morphology.section(1) del self.morphology samples = section.samples() sum = numpy.zeros(4) for s in samples: sum += s
class TestMorphologyFunctions(unittest.TestCase): def setUp(self): self.morphology = Morphology(morphology_path) def test_array_accessors(self): points = self.morphology.points() assert (points.shape == (96, 4)) sections = self.morphology.sections() assert (sections.shape == (13, 2)) section_types = self.morphology.section_types() assert (section_types.shape == (13, )) apicals = self.morphology.apicals() assert (len(apicals) == 0) def test_section(self): Type = brain.neuron.SectionType neurites = [Type.axon, Type.dendrite, Type.apical_dendrite] ids = self.morphology.section_ids([Type.soma]) assert (ids == [0]) self.assertRaises(RuntimeError, lambda: self.morphology.section(0)) ids = self.morphology.section_ids(neurites) assert (len(ids) == 12) sections = self.morphology.sections([Type.soma]) assert (len(sections) == 0) sections = self.morphology.sections(neurites) assert (len(sections) == 12) for id in ids: self.morphology.section(int(id)) self.assertRaises(RuntimeError, lambda: self.morphology.section(1234)) def test_soma(self): soma = self.morphology.soma() assert (len(soma.profile_points()) == 4) for p in soma.profile_points(): assert (len(p) == 4) assert (numpy.isclose(soma.mean_radius(), 0.1)) assert (soma.centroid() == (0, 0, 0))
class TestMorphologyFunctions(unittest.TestCase): def setUp(self): self.morphology = Morphology(morphology_path) def test_array_accessors(self): points = self.morphology.points() assert(points.shape == (96, 4)) sections = self.morphology.sections() assert(sections.shape == (13, 2)) section_types = self.morphology.section_types() assert(section_types.shape == (13,)) apicals = self.morphology.apicals() assert(len(apicals) == 0) def test_section(self): Type = brain.neuron.SectionType neurites = [Type.axon, Type.dendrite, Type.apical_dendrite] ids = self.morphology.section_ids([Type.soma]) assert(ids == [0]) self.assertRaises(RuntimeError, lambda: self.morphology.section(0)) ids = self.morphology.section_ids(neurites) assert(len(ids) == 12) sections = self.morphology.sections([Type.soma]) assert(len(sections) == 0) sections = self.morphology.sections(neurites) assert(len(sections) == 12) for id in ids: self.morphology.section(int(id)) self.assertRaises(RuntimeError, lambda: self.morphology.section(1234)) def test_soma(self): soma = self.morphology.soma() assert(len(soma.profile_points()) == 4) for p in soma.profile_points(): assert(len(p) == 4) assert(numpy.isclose(soma.mean_radius(), 0.1)) assert(soma.centroid() == (0, 0, 0))