Skip to content

Commit

Permalink
Testing: Add test for not changing underlying numpy array.
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed Dec 9, 2024
1 parent e22123c commit c612369
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pyxem/tests/signals/test_indexation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
fe_bcc_phase,
fe_fcc_phase,
)

from pyxem.signals.indexation_results import vectors_from_orientation_map, phase2dict
import hyperspy.api as hs


Expand Down Expand Up @@ -489,3 +491,24 @@ def test_vector_markers_correctness(self):
r, t = res.to_polar_markers()[0].kwargs["offsets"][0, 0][-1]
assert r > 0
assert 0 < t < np.pi / 2

def test_vectors_from_orientation_map(self, single_rot_orientation_result):
data, intensities, phases, phase_indices, hkl = (
single_rot_orientation_result.get_simulation_arrays()
)
phases_dicts = [phase2dict(p) for p in phases]
original_data = data.copy()
v = vectors_from_orientation_map(
single_rot_orientation_result.data[0, 0],
vectors=data,
phases=phases_dicts,
hkl=hkl,
phase_index=phase_indices,
intensities=intensities,
n_best_index=0,
)

np.testing.assert_almost_equal(
v.original_hkl, single_rot_orientation_result.simulation.coordinates.hkl
)
np.testing.assert_equal(original_data, data)

0 comments on commit c612369

Please sign in to comment.