Skip to content

Commit

Permalink
remove single point contour somas in h5 and asc tests (#1045)
Browse files Browse the repository at this point in the history
* this is in prep for MorphIO to be more consistent and picky with contour somas
  • Loading branch information
mgeplf committed Jun 14, 2022
1 parent 7bca0e8 commit 7ef31d9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 27 deletions.
8 changes: 2 additions & 6 deletions tests/check/test_morphology_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def test__bool__():

def test_has_multifurcation():
m = load_morphology(StringIO(u"""
((CellBody) (0 0 0 2))
((CellBody) (-1 0 0 2) (1 0 0 2))
( (Color Blue)
(Axon)
(0 5 0 2)
Expand Down Expand Up @@ -418,11 +418,7 @@ def test_has_multifurcation():

def test_has_unifurcation():
m = load_morphology(StringIO(u"""
("CellBody"
(Color Red)
(CellBody)
(0 0 0 2)
)
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
Expand Down
3 changes: 1 addition & 2 deletions tests/check/test_morphtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def _generate_back_track_tree(n, dev):
points = np.array(dev) + np.array([1, 3 if n == 0 else -3, 0])

m = load_morphology(StringIO(u"""
((CellBody)
(0 0 0 0.4))
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 0.4)
Expand Down
3 changes: 1 addition & 2 deletions tests/core/test_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def test_iter_segments_pop():

def test_iter_segments_section():
sec = load_morphology(StringIO(u"""
((CellBody)
(0 0 0 2))
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(1 2 3 8)
Expand Down
Binary file modified tests/data/h5/v1/ordering/sample.h5
Binary file not shown.
Binary file modified tests/data/h5/v1/ordering/sample_mixed_tree_sections.h5
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/features/test_get_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def test_segment_meander_angles():


def test_segment_meander_angles_single_section():
m = nm.load_morphology(StringIO(u"""((CellBody) (0 0 0 0))
m = nm.load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2)
Expand Down
31 changes: 15 additions & 16 deletions tests/features/test_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_segment_taper_rates():


def test_section_area():
sec = load_morphology(StringIO(u"""((CellBody) (0 0 0 2))
sec = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2))"""), reader='asc').sections[SECTION_ID]
Expand All @@ -85,7 +85,7 @@ def test_section_area():


def test_segment_areas():
sec = load_morphology(StringIO(u"""((CellBody) (0 0 0 2))
sec = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 4)
(1 0 0 4)
Expand All @@ -95,7 +95,7 @@ def test_segment_areas():


def test_segment_volumes():
sec = load_morphology(StringIO(u"""((CellBody) (0 0 0 2))
sec = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 4)
(1 0 0 4)
Expand All @@ -105,7 +105,7 @@ def test_segment_volumes():


def test_segment_mean_radii():
sec = load_morphology(StringIO(u"""((CellBody) (0 0 0 2))
sec = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 4)
Expand All @@ -115,7 +115,7 @@ def test_segment_mean_radii():


def test_segment_midpoints():
sec = load_morphology(StringIO(u"""((CellBody) (0 0 0 2))
sec = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 4)
Expand All @@ -126,15 +126,15 @@ def test_segment_midpoints():

def test_section_tortuosity():
sec_a = load_morphology(StringIO(u"""
((CellBody) (0 0 0 2))
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2)
(2 0 0 2)
(3 0 0 2))"""), reader='asc').sections[SECTION_ID]

sec_b = load_morphology(StringIO(u"""
((CellBody) (0 0 0 2))
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2)
Expand All @@ -149,15 +149,15 @@ def test_section_tortuosity():
morphmath.section_length(s.points) / morphmath.point_dist(s.points[0], s.points[-1]))

def test_setion_tortuosity_single_point():
sec = load_morphology(StringIO(u"""((CellBody) (0 0 0 2))
sec = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(1 2 3 2))"""), reader='asc').sections[SECTION_ID]
assert section.section_tortuosity(sec) == 1.0


def test_section_tortuosity_looping_section():
sec = load_morphology(StringIO(u"""
((CellBody) (0 0 0 2))
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2)
Expand All @@ -169,7 +169,7 @@ def test_section_tortuosity_looping_section():


def test_section_meander_angles():
s0 = load_morphology(StringIO(u"""((CellBody) (0 0 0 0))
s0 = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2)
Expand All @@ -178,7 +178,7 @@ def test_section_meander_angles():
(4 0 0 2))"""), reader='asc').sections[SECTION_ID]
assert section.section_meander_angles(s0) == [math.pi, math.pi, math.pi]

s1 = load_morphology(StringIO(u"""((CellBody) (0 0 0 0))
s1 = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 0 0 2)
Expand All @@ -187,7 +187,7 @@ def test_section_meander_angles():
(2 2 0 2))"""), reader='asc').sections[SECTION_ID]
assert section.section_meander_angles(s1) == [math.pi / 2, math.pi / 2, math.pi / 2]

s2 = load_morphology(StringIO(u"""((CellBody) (0 0 0 0))
s2 = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(0 0 1 2)
Expand All @@ -197,7 +197,7 @@ def test_section_meander_angles():


def test_section_meander_angles_single_segment():
s = load_morphology(StringIO(u"""((CellBody) (0 0 0 0))
s = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 2)
(1 1 1 2))"""), reader='asc').sections[SECTION_ID]
Expand All @@ -212,7 +212,7 @@ def test_strahler_order():


def test_locate_segment_position():
s = load_morphology(StringIO(u"""((CellBody) (0 0 0 0))
s = load_morphology(StringIO(u"""((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 0)
(3 0 4 200)
Expand All @@ -231,8 +231,7 @@ def test_locate_segment_position():

def test_mean_radius():
n = load_morphology(StringIO(u"""
((CellBody)
(0 0 0 1))
((CellBody) (-1 0 0 2) (1 0 0 2))
((Dendrite)
(0 0 0 0)
Expand Down

0 comments on commit 7ef31d9

Please sign in to comment.