Skip to content

get_beam_directions_grid() does not sample fundamental region of hexagonal systems #183

@emichr

Description

@emichr

Describe the bug
When using get_beam_directions_grid with diffsims-0.5.dev the entire fundamental region of hexagonal systems is not sampled. With 5 degree sampling resolution, only 162 orientations are sampled, while 386 orientations was sampled with diffsims-0.4.2. It seems that this only happens for hexagonal systems (6/mmm). The missing orientations are quite clear from these plots:

Result from diffsims-0.5.dev:
diffsims-0-5-dev

Result from diffsims-0.4.2:
diffsims-0-4-2

Also, the sampling grid appears different as well, which is not so clear in the figures above. I am not certain which sampling "pattern" is correct, but the sampling in diffsims 0.5.dev appears more "aesthetic".

To Reproduce

from orix import plot
from orix.quaternion import Orientation, Rotation, symmetry
from orix.vector import Vector3d
from diffsims.generators.rotation_list_generators import get_beam_directions_grid
import matplotlib.pyplot as plt
import numpy as np

resolution = 5.0

systems = {
    'cubic': symmetry.Oh,
    'hexagonal': symmetry.D6h,
    'trigonal': symmetry.D3d,
    'tetragonal': symmetry.D4h,
    'orthorhombic': symmetry.D2h,
    'monoclinic': symmetry.C2h, 
    'triclinic': symmetry.Ci
}

fig = plt.figure(figsize=[4*len(systems), 3])

for i, system in enumerate(systems):
    euler_angles = get_beam_directions_grid(system, resolution, mesh='spherified_cube_edge') #Get a uniform sampling of euler angles
    print(f'Simulated {len(euler_angles)} orientations for {systems[system].name}')

    orientations = Orientation(Rotation.from_euler(np.deg2rad(euler_angles)), symmetry=systems[system])
    ax = fig.add_subplot(1, len(systems), i+1, 
                         projection='ipf',
                         symmetry=systems[system],
                         direction=Vector3d.zvector(),
                         hemisphere='upper')
    ax.set_title(systems[system].name, fontweight='bold')
    ax.scatter(orientations)
plt.tight_layout()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions