Skip to content

parentbeta_reconstruct: exit cleanly when no parent survives the nulls#8

Merged
marinerhemant merged 1 commit into
mainfrom
fix/reconstruct-zero-parents
Jul 24, 2026
Merged

parentbeta_reconstruct: exit cleanly when no parent survives the nulls#8
marinerhemant merged 1 commit into
mainfrom
fix/reconstruct-zero-parents

Conversation

@marinerhemant

Copy link
Copy Markdown
Member

When the iterative extraction finds no prior-β parent that beats the random and decoy
nulls, parents is empty and the GATE 5/6 block crashed on p1=parents[0] with
IndexError — after printing "=> 0 significant prior-beta grain(s)", so the run looked
like it had succeeded right up to the crash.

Sparse scans land here legitimately: a small-area or coarse-step map has too few recurring
orientations to resolve a parent at the default min-cluster-size. Found while folding a
20×20 µm scan into the cross-series — it crashed at min-cluster-size 30 and resolves 1
parent at size 10.

Fix: if no parent survives, write a well-formed empty reconstruction.npz (so
downstream variant_coherence.py finds a file rather than FileNotFoundError) and exit(0)
with a message suggesting a smaller min-cluster-size.

Verified against the exact crash case: min-cluster-size 30 on that scan now prints
"0 parents, writing empty reconstruction" and exits 0, instead of the IndexError.

When the iterative extraction finds no prior-beta parent that beats the random
and decoy nulls, `parents` is empty and the GATE 5/6 block crashed on
`p1=parents[0]` with IndexError -- after already printing "=> 0 significant
prior-beta grain(s)", so the run looked like it had succeeded up to the crash.

Sparse scans land here legitimately: a small-area or coarse-step map has too few
recurring orientations to resolve a parent at the default min-cluster-size. On
one 20x20 um scan at min-cluster-size 30 this crashed; the same scan resolves 1
parent at size 10.

Guard it: if no parent survives, write a well-formed EMPTY reconstruction.npz
(so downstream variant_coherence.py finds a file rather than FileNotFoundError)
and exit(0) with a message suggesting a smaller min-cluster-size.

Verified against the exact case that crashed: min-cluster-size 30 on that scan
now prints "0 parents, writing empty reconstruction" and exits 0.
@marinerhemant
marinerhemant merged commit 8057479 into main Jul 24, 2026
2 checks passed
@marinerhemant
marinerhemant deleted the fix/reconstruct-zero-parents branch July 24, 2026 17:24
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.

1 participant