Skip to content

Add de la Vallée Poussin kernel on SO(3)#926

Merged
bnmajor merged 9 commits into
masterfrom
texture-DeLaValleePoussinKernel
Jun 12, 2026
Merged

Add de la Vallée Poussin kernel on SO(3)#926
bnmajor merged 9 commits into
masterfrom
texture-DeLaValleePoussinKernel

Conversation

@bnmajor

@bnmajor bnmajor commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Overview

Adds a de la Vallée Poussin kernel implementation on SO(3) for constructing smooth orientation distribution functions.

New modules:

  • SO3Kernel
  • DeLaValleePoussinKernel

New public API:

  • DeLaValleePoussinKernel(halfwidth: float) - constructor, halfwidth in radians
  • .eval(R1, R2) - evaluate kernel between rotation matrices
  • .eval_centered(R, center) - convenience wrapper for unimodal distributions
  • .misorientation_angle(R1, R2) - compute misorientation angle from 3×3 rotation matrices

Mathematical basis:
The kernel is defined as K(ω) = C · cos(ω/2)^(2κ), where C is a Beta-function normalization constant and κ is derived analytically from the halfwidth via κ = ln(0.5) / (2·ln(cos(h/2))).

Affected Workflows

N/A

Documentation Changes

User-facing documentation for the texture module will be added in the module integration PR once the full API is finalized.

@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.03922% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.18%. Comparing base (7e05098) to head (216786f).
⚠️ Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
hexrd/phase_transition/texture/kernels.py 98.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #926      +/-   ##
==========================================
+ Coverage   72.61%   73.18%   +0.57%     
==========================================
  Files         142      145       +3     
  Lines       21941    22640     +699     
==========================================
+ Hits        15933    16570     +637     
- Misses       6008     6070      +62     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@psavery

psavery commented May 6, 2026

Copy link
Copy Markdown
Collaborator

To do:

  • move the texture directory inside the phase_transition directory
  • Add a simple test for running the __str__ and __repr__ functions
  • Keep in mind that for misorientation_angle, we may need to take into account crystal symmetry (depending on how it will be used), and misorientation in the rotations.py file may be able to work.

bnmajor added 5 commits June 3, 2026 11:09
Implements the radially symmetric kernel K(ω) = C · cos(ω/2)^(2κ)
with normalization constant C = B(3/2, 1/2) / B(3/2, κ + 1/2) and
shape parameter κ derived analytically from the half-width.

- Abstract SO3Kernel base class for rotation group kernels
- Concrete DeLaValleePoussinKernel with eval, eval_centered,
  and misorientation_angle methods

Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Add optional crystal and sample symmetry support to
DeLaValleePoussinKernel. When symmetry is provided, delegate
misorientation-angle calculation to hexrd.core.rotations.misorientation.

Signed-off-by: Brianna Major <brianna.major@kitware.com>
- Update misorientation_angle docstring
- Use VslueError for symmetry validation failures
- Update return annotations for scalar-or-batched kernel operations
- Add tests covering the symmetry error behavior.

Signed-off-by: Brianna Major <brianna.major@kitware.com>
@bnmajor bnmajor force-pushed the texture-DeLaValleePoussinKernel branch from fd1dc01 to 91e615d Compare June 3, 2026 15:30
bnmajor added 2 commits June 3, 2026 11:50
Signed-off-by: Brianna Major <brianna.major@kitware.com>
@bnmajor bnmajor mentioned this pull request Jun 3, 2026
@bnmajor bnmajor requested review from psavery and saransh13 June 3, 2026 19:28
psavery added 2 commits June 12, 2026 14:51
Add SO(3) normalization, has_symmetry, and combined crystal+sample
symmetry tests; fix a name shadow and make the half-maximum test go
through eval().

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Reduce the symmetry-aware misorientation through a single batched
rotations.misorientation call (one reference vs many) instead of a
per-pair Python loop (~40x faster on cubic symmetry, identical results).
Require one operand to be a single orientation in that path and raise
otherwise. Document that symmetry is opt-in.

Tests: add SO(3) normalization, has_symmetry, combined crystal+sample,
and single-reference-required cases; fix a name shadow and make the
half-maximum test go through eval().

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>

@psavery psavery left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I added a few more tests, and made a small API change to the symmetry-reduced misorientation so it runs much faster - it now uses the pre-existing rotations.misorientation in hexrd for batched, symmetry-aware misorientation instead of a per-pair loop (~40x faster on cubic symmetry). The one behavioral note: with symmetry enabled, one of the two operands must be a single reference orientation (it raises otherwise), which matches how the kernel is actually evaluated.

I'm rebasing #939 and #941 onto these changes, so those don't need fixing on your end. This PR looks good to me!

@psavery psavery mentioned this pull request Jun 12, 2026
@psavery

psavery commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bnmajor merge when ready!

@bnmajor bnmajor merged commit 172528d into master Jun 12, 2026
10 checks passed
@bnmajor bnmajor deleted the texture-DeLaValleePoussinKernel branch June 12, 2026 13:09
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.

2 participants