extract_traces: build sparse-mask indices as integer tensors - #1268
Open
cindykrafft wants to merge 1 commit into
Open
extract_traces: build sparse-mask indices as integer tensors#1268cindykrafft wants to merge 1 commit into
cindykrafft wants to merge 1 commit into
Conversation
The pixel and ROI indices for the sparse cell and neuropil mask matrices were created with torch.Tensor(...), i.e. float32, which cannot represent integers above 2**24 exactly; for fields of view larger than 16.7 million pixels flattened pixel indices would be rounded to the wrong pixel. Create them as int64 directly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012d2sJAD5EUp4GqAStqoBX7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extract_tracescreates the pixel/ROI index tensors for the sparse cell and neuropil mask matrices withtorch.Tensor([...]), i.e. float32, which represents integers exactly only up to 2**24 = 16,777,216 (torch.Tensor([16777217]).long()gives 16777216). Flattened pixel indices in fields of view larger than about 4096 × 4096 are therefore rounded to a neighbouring pixel, silently mixing pixels between ROIs. This creates the index tensors as int64 directly; behaviour is unchanged for smaller fields of view.🤖 Generated with Claude Code
https://claude.ai/code/session_012d2sJAD5EUp4GqAStqoBX7