Skip to content

Conversation

@augustocattafesta
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “topology suppression” to the clustering pipeline to zero-out pixels that don’t match an expected neighborhood pattern, aiming to improve cluster quality before reconstruction.

Changes:

  • Introduces ClusteringBase.topology_suppress() to suppress pixels that don’t match the expected neighbor topology and re-sort outputs.
  • Integrates topology suppression into ClusteringNN.run() prior to trimming zero-suppressed pixels.
Comments suppressed due to low confidence (1)

src/hexsample/clustering.py:331

  • After topology_suppress, pha, col, and row have already been sliced/reordered to match the selected pixels. Reusing mask (which still contains indices into the original 7-pixel arrays) to index col/row/pha will produce incorrect selections and can raise IndexError when mask contains values > len(col)-1. Use a boolean keep mask derived from the post-suppression arrays (e.g., keep = pha > 0) and apply it directly to pha/col/row, or reset mask to np.arange(len(pha))[pha > 0] before indexing.
        mask = mask[pha > 0]
        # Trim the relevant arrays.
        col = col[mask]
        row = row[mask]
        pha = pha[mask]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@augustocattafesta augustocattafesta merged commit 4b22104 into main Feb 10, 2026
2 checks passed
@augustocattafesta augustocattafesta deleted the issue_68 branch February 10, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants