Skip to content

Added transformation return to orient_principal_components - #934

Draft
nablacart wants to merge 14 commits into
biotite-dev:v2from
nablacart:orient_pc_return_transform
Draft

Added transformation return to orient_principal_components#934
nablacart wants to merge 14 commits into
biotite-dev:v2from
nablacart:orient_pc_return_transform

Conversation

@nablacart

Copy link
Copy Markdown

Modified transform.orient_principal_components to return an AffineTransformation of centering translation and cumulative rotation to align with specified axes, in addition to transformed coordinates. Updated tests to reflect changes.

Returning the transformation allows for downstream alignment to a specific component of the input structure.

Validated with:

  • pixi run -e test test tests/structure/test_transform.py -q: 1135 passed

@padix-key padix-key left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea 👍. However it changes the function signature, so it would put this into the biotite v2 release (which is already planned after the next release).

Otherwise, I left a minor review comment

break
cumulative_rotation = cumulative_rotation @ rotation
# Apply rotation, keep molecule centered on the origin
centered = centered @ rotation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have a AffineTransformation at hand now, I see no reason to carry centered around. Instead we can simply

return transform.apply(atoms), transform

@padix-key

padix-key commented Aug 6, 2026

Copy link
Copy Markdown
Member

I'll change the target branch to v2. Could you rebase your branch on it?

@padix-key
padix-key changed the base branch from main to v2 August 6, 2026 18:58
@padix-key

Copy link
Copy Markdown
Member

If I see correctly you merged previous PRs from v2 into this one instead of rebasing, right? Could you instead run git rebase -i v2 and only keep the commits relevant to this PR?

@codspeed-hq

codspeed-hq Bot commented Aug 11, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.43%

⚡ 1 improved benchmark
❌ 5 regressed benchmarks
✅ 97 untouched benchmarks
⏩ 17 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
benchmark_superimpose[superimpose_without_outliers] 13.5 ms 16.8 ms -19.3%
benchmark_superimpose[superimpose] 2 ms 2.4 ms -17.66%
benchmark_cell_list_compute_contacts[PAIRS] 15.8 ms 19.1 ms -17.08%
benchmark_cell_list_compute_contacts[MAPPING] 15.9 ms 19.2 ms -17%
benchmark_cell_list_compute_contacts[MASK] 18.5 ms 21.2 ms -12.63%
benchmark_match_kmer_selection[KmerTable-11*11*1*1***111] 276.4 µs 245 µs +12.83%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing nablacart:orient_pc_return_transform (a2b02f4) with main (d9e7f49)2

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on v2 (1b203c7) during the generation of this report, so main (d9e7f49) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@nablacart

Copy link
Copy Markdown
Author

If I see correctly you merged previous PRs from v2 into this one instead of rebasing, right? Could you instead run git rebase -i v2 and only keep the commits relevant to this PR?

My apologies, I am inexperienced with contributing from a fork instead of a branch. I did rebase on v2 but may have done so incorrectly, so I'll revert and try again.

@nablacart
nablacart marked this pull request as draft August 12, 2026 02:57
@padix-key

Copy link
Copy Markdown
Member

No worries, if you prefer I can also rerun the rebase (although I am not sure if GitHub allows me force-pushing to your branch afterwards)

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.

4 participants