Skip to content

Commit

Permalink
is_mesh: only work with non-iterables
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Dec 6, 2020
1 parent 775a54f commit 10f3e54
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions navis/utils/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,17 @@ def is_numeric(array: np.ndarray, bool_numeric: bool = True) -> bool:


def is_mesh(x) -> Tuple[List[bool], List[bool]]:
"""Check if object(s) is mesh (i.e. contains vertices and faces).
"""Check if object is mesh (i.e. contains vertices and faces).
Examples
--------
>>> import navis
>>> is_mesh(navis.example_neurons(1))
False
>>> is_mesh(navis.example_volume('LH'))
True
"""
if is_iterable(x):
return np.array([is_mesh(o) for o in x])

if hasattr(x, 'vertices') and hasattr(x, 'faces'):
return True

Expand All @@ -143,7 +141,7 @@ def eval_conditions(x) -> Tuple[List[bool], List[bool]]:
Examples
--------
>>> eval_conditions('~negative condition')
(([], ['negative condition'])
([], ['negative condition'])
>>> eval_conditions(['positive cond1', '~negative cond1', 'positive cond2'])
(['positive cond1', 'positive cond2'], ['negative cond1'])
Expand Down

0 comments on commit 10f3e54

Please sign in to comment.