Skip to content

Commit

Permalink
BugFix: Fix labels for miller indices.
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed Feb 1, 2024
1 parent 017b891 commit c5f2317
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion diffsims/simulations/simulation2d.py
Expand Up @@ -389,6 +389,15 @@ def get_current_coordinates(self):
else:
return copy.deepcopy(self.coordinates)

def get_current_rotation(self):
"""Returns the matrix for the current matrix"""
if self.has_multiple_phases:
return copy.deepcopy(
self.rotations[self.phase_index].to_matrix()[self.rotation_index]
)
else:
return copy.deepcopy(self.rotations.to_matrix()[self.rotation_index])

def plot_rotations(self, beam_direction: Vector3d = Vector3d.zvector()):
"""Plots the rotations of the current phase in stereographic projection"""
if self.has_multiple_phases:
Expand Down Expand Up @@ -497,7 +506,9 @@ def plot(
ax.set_ylim(-self.reciporical_radius, self.reciporical_radius)

if show_labels:
millers = coords.hkl.astype(np.int16)
millers = np.matmul(coords.hkl, self.get_current_rotation()).astype(
np.int16
)
# only label the points inside the axes
xlim = ax.get_xlim()
ylim = ax.get_ylim()
Expand Down

0 comments on commit c5f2317

Please sign in to comment.