Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 2f3a548

Browse files
authored
Merge pull request #451 from arnaudon/fix_location
Fix location if section list is empty
2 parents d841b86 + 1a182b7 commit 2f3a548

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bluepyopt/ephys/locations.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,15 @@ def set_sec_index(self, icell=None):
521521
for section in getattr(icell, self.seclist_name)
522522
]
523523
)
524-
if self.direction == 'radial':
525-
self.sec_index = int(np.argmax(np.linalg.norm(points, axis=1)))
524+
if len(points) > 0:
525+
if self.direction == 'radial':
526+
self.sec_index = int(np.argmax(np.linalg.norm(points, axis=1)))
527+
else:
528+
self.sec_index = int(np.argmax(points.dot(self.direction)))
526529
else:
527-
self.sec_index = int(np.argmax(points.dot(self.direction)))
530+
raise EPhysLocInstantiateException(
531+
"Empty seclist: %s" % self.seclist_name
532+
)
528533

529534
def instantiate(self, sim=None, icell=None):
530535
""" """

0 commit comments

Comments
 (0)