Repository navigation
Conversation
| ] | ||
|
|
||
|
|
||
| def test_apply_chain_wise_empty(array): |
There was a problem hiding this comment.
This is basically A duplicate of the corresponding residue test. I would remove it.
Merging this PR will degrade performance by 39.88%1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance ChangesTip Investigate this regression by commenting Comparing Footnotes
|
|
Thanks for the approval. One note in case it's what is holding this up: the CI run on the last commit (64502c2) ended in a startup failure, so the tests never ran on it. I'm happy to rebase onto main to trigger a fresh run if that would help. |
|
Yes, please rebase on |
64502c2 to
e69fb0d
Compare
apply_residue_wise(),apply_chain_wise()andapply_segment_wise()returnNonefor an emptyAtomArray, although they are typed to return anndarray:Since #889,
get_residue_starts(empty, add_exclusive_stop=True)is[0], so the loop inapply_segment_wise()never runs and the initialNoneis returned. The comment saying the loop runs at least once no longer holds, so I removed it.With no segments
functionis never called, so the shape and dtype of its return value are unknown. This PR uses the dtype ofdataand its shape withoutaxis:(0,)withoutaxis,(0, 3)for coordinates withaxis=0. Happy to change that if you'd rather have something else, e.g. alwaysfloat.A related empty-input case:
get_residue_positions(empty, [])andget_residue_starts_for(empty, [])raiseIndexError.np.asarray([])is a float array, and with0 >= 0the lookup-table branch indexes with it. Empty indices now return an empty int array.Tests: the new empty-input tests fail on main (
None,IndexError) and pass with the change. I couldn't build main here (no Rust toolchain), so I rantests/structureagainst the 2.0.0 wheel with the patchedsegments.pyswapped in (the file is identical to main before this change): no new failures.ruff check,ruff format --diff,numpydoc lintandpyrightat the lock-file versions are clean.AI assistance: drafted with Claude Opus 5.5 (
claude-opus-5-5); I ran the checks above.