Skip to content

Commit

Permalink
Change units of in-plane angle to degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
viljarjf committed Apr 20, 2024
1 parent 303a710 commit 6fe745e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyxem/signals/polar_diffraction2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from hyperspy.signals import Signal2D
from hyperspy._signals.lazy import LazySignal
from numpy import rad2deg

from pyxem.signals.common_diffraction import CommonDiffraction
from pyxem.utils.correlation_utils import _correlation, _power, _pearson_correlation
Expand Down Expand Up @@ -328,6 +329,20 @@ def get_orientation(
output_dtype=float,
)

# Translate in-plane rotation from index to degrees
# by using the calibration of the axis
def rotation_index_to_degrees(data):
data = data.copy()
axis = self.axes_manager.signal_axes[0].axis
ind = data[:, 2].astype(int)
data[:, 2] = rad2deg(axis[ind])
# Account for the 90 degree discrepancy between the X_L axis
# and the origin of the azimuthal axis of the polar signal
data[:, 2] -= 90
return data

orientation.map(rotation_index_to_degrees)

orientation.set_signal_type("orientation_map")
orientation.simulation = simulation
orientation.column_names = ["index", "correlation", "rotation", "factor"]
Expand Down

0 comments on commit 6fe745e

Please sign in to comment.