Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon committed Dec 3, 2024
1 parent a989d35 commit c313042
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 106 deletions.
36 changes: 18 additions & 18 deletions tests/data/apical.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
14a03569d26b949692e5dfe8cb1855fe:
- 5.5464959144592285
- 113.9891357421875
- -2.365058422088623
- 4.3279709815979
- 59.805320739746094
- -0.6919530630111694
216363698b529b4a97b750923ceb3ffd:
- -4.380718231201172
- 116.65441131591797
- 6.396718978881836
- -70.52275085449219
- 129.78277587890625
- -7.857072830200195
4462ebfc5f915ef09cfbac6e7687a66e:
- -44.474491119384766
- 68.06861877441406
- -7.087465286254883
- 1.484359622001648
- 52.40570831298828
- -4.806603908538818
87751d4ca8501e2c44dcda6a797d76de:
- 4.237551689147949
- 369.3919677734375
- -0.3368062376976013
- 13.616881370544434
- 252.8784942626953
- 4.428127288818359
e3e70682c2094cac629f6fbed82c07cd:
- -5.780806541442871
- 164.6251678466797
- 0.9229676723480225
- -14.571318626403809
- 114.34882354736328
- 6.069221019744873
e8d79f49af6d114c4a6f188a424e617b:
- -28.59885025024414
- 215.1460723876953
- -12.506669998168945
- -77.39925384521484
- 345.1856994628906
- -33.771915435791016
12 changes: 6 additions & 6 deletions tests/data/apical_NRN_sections.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
14a03569d26b949692e5dfe8cb1855fe:
- 9
- 3
216363698b529b4a97b750923ceb3ffd:
- 9
- 46
4462ebfc5f915ef09cfbac6e7687a66e:
- 12
- 3
87751d4ca8501e2c44dcda6a797d76de:
- 35
- 6
e3e70682c2094cac629f6fbed82c07cd:
- 50
- 18
e8d79f49af6d114c4a6f188a424e617b:
- 20
- 32
28 changes: 14 additions & 14 deletions tests/data/apical_NRN_sections_no_axon.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
14a03569d26b949692e5dfe8cb1855fe:
- 9
- 3
216363698b529b4a97b750923ceb3ffd:
- 9
- 46
4462ebfc5f915ef09cfbac6e7687a66e:
- 12
- 3
5bc8fbbcbde5c0994164d8399f767c45:
- 12
- 3
6018366cf658f7a75ed34fe53a096533:
- 49
- 3
6513270e269e0d37f2a74de452e6b438:
- 5
- 56
7b89296c6dcbac5008577eb1924770d3:
- 5
- 3
87751d4ca8501e2c44dcda6a797d76de:
- 35
- 6
b8a1abcd1a6916c74da4f9fc3c6da5d7:
- 10
- 58
cd613e30d8f16adf91b7584a2265b1f5:
- 6
- 46
d95bafc8f2a4d27bdcf4bb99f4bea973:
- 3
- 11
db5b5fab8f4d3e27dda1494c73cf256d:
- 7
- 5
e3e70682c2094cac629f6fbed82c07cd:
- 50
- 18
e8d79f49af6d114c4a6f188a424e617b:
- 20
- 32
84 changes: 42 additions & 42 deletions tests/data/apical_no_axon.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
14a03569d26b949692e5dfe8cb1855fe:
- 5.5464959144592285
- 113.9891357421875
- -2.365058422088623
- 4.3279709815979
- 59.805320739746094
- -0.6919530630111694
216363698b529b4a97b750923ceb3ffd:
- -4.380718231201172
- 116.65441131591797
- 6.396718978881836
- -70.52275085449219
- 129.78277587890625
- -7.857072830200195
4462ebfc5f915ef09cfbac6e7687a66e:
- -44.474491119384766
- 68.06861877441406
- -7.087465286254883
- 1.484359622001648
- 52.40570831298828
- -4.806603908538818
5bc8fbbcbde5c0994164d8399f767c45:
- -2.684163808822632
- 112.33018493652344
- 3.1389687061309814
- 1.9180573225021362
- 56.46493911743164
- -4.888937473297119
6018366cf658f7a75ed34fe53a096533:
- -57.31629180908203
- 105.37586975097656
- -68.1922836303711
- -1.085249662399292
- 57.62152099609375
- -4.8218231201171875
6513270e269e0d37f2a74de452e6b438:
- 0.15954150259494781
- 112.9250717163086
- -2.502075672149658
- 8.458586692810059
- 162.99160766601562
- 4.474689960479736
7b89296c6dcbac5008577eb1924770d3:
- 0.4192541837692261
- 57.192779541015625
- 5.780771255493164
- 0.7617863416671753
- 57.46580123901367
- 1.8977699279785156
87751d4ca8501e2c44dcda6a797d76de:
- 4.237551689147949
- 369.3919677734375
- -0.3368062376976013
- 13.616881370544434
- 252.8784942626953
- 4.428127288818359
b8a1abcd1a6916c74da4f9fc3c6da5d7:
- -4.5237274169921875
- 114.20574188232422
- -1.732434630393982
- -84.93132019042969
- 116.4366455078125
- -6.362834453582764
cd613e30d8f16adf91b7584a2265b1f5:
- -1.3810073137283325
- 115.31499481201172
- -1.1782004833221436
- -71.48829650878906
- 137.7943115234375
- -5.734889030456543
d95bafc8f2a4d27bdcf4bb99f4bea973:
- 1.7359588146209717
- 57.819026947021484
- 0.7563515901565552
- 7.555803298950195
- 96.93486785888672
- 2.7653095722198486
db5b5fab8f4d3e27dda1494c73cf256d:
- -45.093421936035156
- 75.82533264160156
- 6.015667915344238
- -3.1312777996063232
- 57.919647216796875
- -0.5503649115562439
e3e70682c2094cac629f6fbed82c07cd:
- -5.780806541442871
- 164.6251678466797
- 0.9229676723480225
- -14.571318626403809
- 114.34882354736328
- 6.069221019744873
e8d79f49af6d114c4a6f188a424e617b:
- -28.59885025024414
- 215.1460723876953
- -12.506669998168945
- -77.39925384521484
- 345.1856994628906
- -33.771915435791016
Binary file modified tests/data/debug_data.pkl
Binary file not shown.
24 changes: 12 additions & 12 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,28 +196,28 @@ def test_synthesize_morphologies(
)
assert equal_infos.all()
assert debug_data["apical_sections"].tolist() == [
[72],
[55],
None,
[23],
[46],
None,
[42],
[49],
None,
[38],
[62],
None,
[67],
[74],
[34],
[49],
]
assert debug_data["apical_NRN_sections"].tolist() == [
[50],
[18],
None,
[9],
[46],
None,
[9],
[3],
None,
[12],
[3],
None,
[35],
[20],
[6],
[32],
]

cols = ["apical_sections", "apical_NRN_sections", "apical_points", "debug_infos"]
Expand Down
14 changes: 8 additions & 6 deletions tests/test_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,30 @@ def test_output_scaling_useless_min(self, root_sec):

def test_output_scaling_min(self, root_sec):
"""Test with a min value that is greater than a few values (useful)."""
assert modify.output_scaling(root_sec, [0, 1, 0], 40.657597, None) == pytest.approx(
1.7270042868523088
)
assert modify.output_scaling(root_sec, [0, 1, 0], 40.657597, None) == pytest.approx(1)

def test_output_scaling_useless_max(self, root_sec):
"""Test with a max value that is greater than all values (useless)."""
assert modify.output_scaling(root_sec, [0, 1, 0], None, 1000) == 1

def test_output_scaling_max(self, root_sec):
"""Test with a max value that is greater than a few values (useful)."""
assert modify.output_scaling(root_sec, [0, 1, 0], None, 27.105065) == pytest.approx(1)
assert modify.output_scaling(root_sec, [0, 1, 0], None, 27.105065) == pytest.approx(
0.2607304228132
)

def test_output_scaling_useless_min_useless_max(self, root_sec):
"""Test with an useless min value and useless max values."""
assert modify.output_scaling(root_sec, [0, 1, 0], 1, 1000) == 1

def test_output_scaling_useless_min_max(self, root_sec):
"""Test with an useless min value and useful max values."""
assert modify.output_scaling(root_sec, [0, 1, 0], 1, 27.105065) == pytest.approx(1)
assert modify.output_scaling(root_sec, [0, 1, 0], 1, 27.105065) == pytest.approx(
0.2607304228132
)

def test_output_scaling_min_max(self, root_sec):
"""Test with an useful min value and useful max values."""
assert modify.output_scaling(root_sec, [0, 1, 0], 40.657597, 27.105065) == pytest.approx(
1.7270042868523088
0.2607304228132996
)
16 changes: 8 additions & 8 deletions tests/test_synthesize_morphologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ def test_synthesize(
args["out_apical_nrn_sections"],
)
if with_NRN and with_axon:
assert_allclose(max_y, 168.1047)
assert_allclose(max_y, 115.22123)
else:
if with_NRN and with_axon:
assert_allclose(max_y, 149.30412)
assert_allclose(max_y, 103.0715)


def test_synthesize_empty_population(
Expand Down Expand Up @@ -303,16 +303,16 @@ def test_synthesize_skip_write(
"e8d79f49af6d114c4a6f188a424e617b",
]
assert [[i[0].tolist()] if i else i for i in res["apical_points"].tolist()] == [
[[-5.780806541442871, 164.6251678466797, 0.9229676723480225]],
[[-14.571318626403809, 114.34882354736328, 6.069221019744873]],
None,
[[-4.380718231201172, 116.65441131591797, 6.396718978881836]],
[[-70.52275085449219, 129.78277587890625, -7.857072830200195]],
None,
[[5.5464959144592285, 113.9891357421875, -2.365058422088623]],
[[4.3279709815979, 59.805320739746094, -0.6919530630111694]],
None,
[[-44.474491119384766, 68.06861877441406, -7.087465286254883]],
[[1.484359622001648, 52.40570831298828, -4.806603908538818]],
None,
[[4.237551689147949, 369.3919677734375, -0.3368062376976013]],
[[-28.59885025024414, 215.1460723876953, -12.506669998168945]],
[[13.616881370544434, 252.8784942626953, 4.428127288818359]],
[[-77.39925384521484, 345.1856994628906, -33.771915435791016]],
]

# Check that the morphologies were not written
Expand Down

0 comments on commit c313042

Please sign in to comment.