[3/5] Refactor: extract the charged fragment type annotation and the pointer reannotation - #436
Open
GeorgWa wants to merge 1 commit into
Conversation
…tion Move two concerns out of the body of `flatten_fragments`: the per-column annotation of the charged fragment types, and the reannotation of the precursor pointers. The function now reads as its steps, and the memory refactoring that follows changes a named helper instead of a long function body. `_annotate_charged_frag_types` returns typed arrays rather than four parallel lists of Python ints. Tiling a typed array keeps its dtype, so the dense type/loss_type/charge/direction arrays no longer pass through an int64 intermediate of 8 bytes per dense slot. No functional change. Output stays bit-identical to main across 5400 generated configurations of library shape, padding, top-k, intensity threshold and custom_columns. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mschwoer
approved these changes
Aug 31, 2026
| fragment_mz_df.columns.values | ||
| ) | ||
|
|
||
| # tiling the typed arrays keeps their dtype. A tiled list of Python ints gave |
Contributor
There was a problem hiding this comment.
"tiling the typed arrays keeps their dtype" -> I feel this is redundant? like "a = 1+1 # this will stay an int" ? also, second part of comment references previous implementation.
(I am not saying the information is not valuable, it's just that code is not the right place for it .. this would be a good example of the PR author commenting his own code to guide the review)
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.
Pure refactor. No functional change, output bit-identical to main.
Move two concerns out of the body of
flatten_fragments, so the memory changes that follow are diffs in named helpers instead of a long function body.int64intermediate of 8 bytes per dense slot.Stacked on #435. Splitting #429.
🤖 Generated with Claude Code