Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

small refactor in artifacts.nx_gx() #154

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions neatnet/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,10 +1073,6 @@ def nx_gx(
# correctly pick-up the highest hierarchy and drop all lower
if artifact.C > 0:
logger.debug("HIGHEST C")
# define mask for E and S strokes
es_mask = edges.coins_group.isin(all_ends.coins_group)
# filter Cs
highest_hierarchy = edges[~es_mask]
else:
logger.debug("HIGHEST E")
singles = set()
Expand All @@ -1089,12 +1085,14 @@ def nx_gx(
):
singles.add(group)
visited.append(group)
# filter ends
# re-filter ends
all_ends = edges[edges.coins_group.isin(singles)]
# define mask for E and S strokes
es_mask = edges.coins_group.isin(all_ends.coins_group)
# filter Cs
highest_hierarchy = edges[~es_mask]

# define mask for E and S strokes
es_mask = edges.coins_group.isin(all_ends.coins_group)

# filter Cs
highest_hierarchy = edges[~es_mask]

# get nodes forming the artifact
relevant_nodes = nodes.iloc[
Expand Down
Loading