From 32ae9d8c5f555967bd41644e6fc810b8f12d94bb Mon Sep 17 00:00:00 2001 From: Tanguy Fardet Date: Mon, 29 Jan 2024 19:41:05 +0100 Subject: [PATCH] Add setuptools to windows, fix shapely issues --- extra/install_debian.sh | 1 + src/pymodule/dense/morphology/connections.py | 16 ++++++++++------ tests/todo/test_retraction.py | 1 - 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/extra/install_debian.sh b/extra/install_debian.sh index ea7cea0..3a11b86 100644 --- a/extra/install_debian.sh +++ b/extra/install_debian.sh @@ -5,6 +5,7 @@ sudo apt install cmake g++ python3 python3-dev python3-pip libgeos++-dev doxygen # workaround for PyOpenGL for lg in /usr/lib/x86_64-linux-gnu/libglut.so.3.*; do sudo ln -s "${lg}" /usr/lib/x86_64-linux-gnu/libglut.so.3 + sudo ln -s "${lg}" /usr/lib/x86_64-linux-gnu/libglut.so done pip3 install --user setuptools diff --git a/src/pymodule/dense/morphology/connections.py b/src/pymodule/dense/morphology/connections.py index 3ed03e0..7fe581b 100644 --- a/src/pymodule/dense/morphology/connections.py +++ b/src/pymodule/dense/morphology/connections.py @@ -312,7 +312,9 @@ def _get_synapses_intersection(axon_polygon, d_polygon, synapse_density, somas, ''' intsct = axon_polygon.intersection(d_polygon) - if not isinstance(intsct, MultiPolygon): + if isinstance(intsct, MultiPolygon): + intsct = intsct.geoms + else: intsct = [intsct] for poly in intsct: @@ -324,8 +326,8 @@ def _get_synapses_intersection(axon_polygon, d_polygon, synapse_density, somas, s_soma = np.array(somas[i]) t_soma = np.array(somas[j]) pos = np.array(poly.centroid.coords)[0] - dist = np.linalg.norm(s_soma - pos) \ - + np.linalg.norm(t_soma - pos) + dist = np.linalg.norm(s_soma - pos) + \ + np.linalg.norm(t_soma - pos) positions.extend([pos]*num_synapses) edges.extend([etuple]*num_synapses) @@ -413,9 +415,11 @@ def _edges_from_spines(source_set, target_set, axons, dendrites, somas, if num_syn > 0: s_soma = np.array(somas[i]) t_soma = np.array(somas[j]) - pos = insct_line.centroid - dist = np.linalg.norm(s_soma - pos) \ - + np.linalg.norm(t_soma - pos) + pos = np.array( + insct_line.centroid.coords)[0] + + dist = np.linalg.norm(s_soma - pos) + \ + np.linalg.norm(t_soma - pos) positions.extend([pos]*num_syn) edges.extend([etuple]*num_syn) diff --git a/tests/todo/test_retraction.py b/tests/todo/test_retraction.py index 5dcacaf..1acfd64 100644 --- a/tests/todo/test_retraction.py +++ b/tests/todo/test_retraction.py @@ -112,7 +112,6 @@ lower.append(low) - ax.plot(resolutions, median, color="b", alpha=0.8) ax.plot(resolutions, lower, ls="--", color="b", alpha=0.5) ax.plot(resolutions, upper, ls="--", color="b", alpha=0.5)