Step 2: vectorize NormalizationManager._determine_sorted_rows#85
Open
mschwoer wants to merge 4 commits into
Open
Conversation
Add regression tests before vectorizing the row-sort: index labels ordered by ascending NaN-count with stable tie-breaking, and order preserved when no NaNs are present. Tests pass against the unmodified baseline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the per-row .loc MultiIndex lookup inside sorted()'s key with a single numpy nan-count over df.to_numpy() plus a stable argsort. np.argsort(kind= "stable") reproduces Python sorted()'s tie-breaking. Bit-identical protein + ion output (max_abs_diff=0); unit + full pytest suite pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The numpy vectorization of _determine_sorted_rows (step 2) left the njit _get_num_nas_in_row helper on NormalizationManager with no callers. The identically-named helper on ProtvalCutter was already unused (it computes nan counts inline). Remove both, and the now-unused numba import in protein_intensity_estimation.py. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Replaces the per-row
.locMultiIndex lookup insidesorted()'s key with a numpy nan-count + stableargsort(reproduces Pythonsorted()'s tie-breaking).Estimated speedup: estimate stage 123.9 s → 116.9 s (~1.06×), single-core HYE benchmark.
Bit-identical protein + ion output (
max_abs_diff=0); suite passes.🤖 Generated with Claude Code