Skip to content

BUG: Fix EMsampler to FZ-reduce quaternions before averaging and store EM parameters#15

Merged
marcdegraef merged 1 commit intodevelopfrom
topic/emsampler_unit_test_changes
Apr 3, 2026
Merged

BUG: Fix EMsampler to FZ-reduce quaternions before averaging and store EM parameters#15
marcdegraef merged 1 commit intodevelopfrom
topic/emsampler_unit_test_changes

Conversation

@imikejackson
Copy link
Copy Markdown
Contributor

The sampler_ subroutine had two issues:

  1. Local variables seed1/seed2 were never assigned from enl%seed1/enl%seed2, leaving them uninitialized. They are now properly initialized from the namelist parameters before use.

  2. Sampled quaternions were passed directly to EMforDS for averaging without first being reduced to the Rodrigues Fundamental Zone (RFZ). This produced reference averages that disagreed with EMorav (which does FZ-reduce) and with EbsdLib's C++ port of the same algorithm. Both vMF and Watson sampling loops now FZ-reduce via ReduceOrientationtoRFZ before averaging.

Additionally, NumEM and NumIter are now written as scalar integer datasets
in the HDF5 output (/EMData/Sampler/) so that downstream consumers can read
the exact EM iteration parameters used to generate the reference data.

…e EM parameters

  The sampler_ subroutine had two issues:

  1. Local variables seed1/seed2 were never assigned from enl%seed1/enl%seed2,
     leaving them uninitialized. They are now properly initialized from the
     namelist parameters before use.

  2. Sampled quaternions were passed directly to EMforDS for averaging without
     first being reduced to the Rodrigues Fundamental Zone (RFZ). This produced
     reference averages that disagreed with EMorav (which does FZ-reduce) and
     with EbsdLib's C++ port of the same algorithm. Both vMF and Watson sampling
     loops now FZ-reduce via ReduceOrientationtoRFZ before averaging.

  Additionally, NumEM and NumIter are now written as scalar integer datasets
  in the HDF5 output (/EMData/Sampler/) so that downstream consumers can read
  the exact EM iteration parameters used to generate the reference data.
@imikejackson imikejackson requested a review from marcdegraef April 2, 2026 21:18
@marcdegraef marcdegraef merged commit f74d3f6 into develop Apr 3, 2026
2 checks passed
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