Skip to content

Commit

Permalink
subset_neuron: fix bug with dropping connectors if subset is mask
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Oct 11, 2023
1 parent 9a583a9 commit 6f2fa29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions navis/morpho/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ def _subset_treeneuron(x, subset, keep_disc_cn, prevent_fragments):

# Filter connectors
if not keep_disc_cn and x.has_connectors:
x._connectors = x.connectors[x.connectors.node_id.isin(subset)]
x._connectors = x.connectors[x.connectors.node_id.isin(x.nodes.node_id)]
x._connectors.reset_index(inplace=True, drop=True)

if getattr(x, 'tags', None) is not None:
# Filter tags
x.tags = {t: [tn for tn in x.tags[t] if tn in subset] for t in x.tags} # type: ignore # TreeNeuron has no tags
x.tags = {t: [tn for tn in x.tags[t] if tn in x.nodes.node_id.values] for t in x.tags} # type: ignore # TreeNeuron has no tags

# Remove empty tags
x.tags = {t: x.tags[t] for t in x.tags if x.tags[t]} # type: ignore # TreeNeuron has no tags
Expand Down

0 comments on commit 6f2fa29

Please sign in to comment.