Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
viljarjf committed Jun 13, 2024
1 parent ea63284 commit 852c9d0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyxem/signals/indexation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def to_ipf_correlation_heatmap_markers(
This will not look good if the rotations used in the simulation(s) consists of
multiple different regions in the IPF.
"""
phase_idx_signal = hs.signals.Signal1D(self.to_phase_index())
phases = self.simulation.phases
Expand Down
52 changes: 48 additions & 4 deletions pyxem/tests/signals/test_indexation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,18 +368,62 @@ def test_to_crystal_map_error(self, simple_multi_rot_orientation_result):
with pytest.raises(ValueError):
rotations = orientations.to_crystal_map()

def test_plot_over_signal(self, simple_multi_rot_orientation_result):
@pytest.mark.parametrize("add_vector_markers", [False, True])
@pytest.mark.parametrize("add_ipf_markers", [False, True])
@pytest.mark.parametrize("add_ipf_correlation_heatmap", [False, True])
@pytest.mark.parametrize("add_ipf_colorkey", [False, True])
@pytest.mark.parametrize(
"vector_kwargs", [None, {"annotate": False}, {"annotate": True}]
)
def test_plot_over_single_phase_signal(
self,
simple_multi_rot_orientation_result,
add_vector_markers,
add_ipf_markers,
add_ipf_correlation_heatmap,
add_ipf_colorkey,
vector_kwargs,
):
orientations, rotations, s = simple_multi_rot_orientation_result
orientations.plot_over_signal(s)
orientations.plot_over_signal(
s,
add_vector_markers=add_vector_markers,
add_ipf_markers=add_ipf_markers,
add_ipf_correlation_heatmap=add_ipf_correlation_heatmap,
add_ipf_colorkey=add_ipf_colorkey,
vector_kwargs=vector_kwargs,
)

def test_plot_over_signal_multi_phase(self, multi_phase_orientation_result):
@pytest.mark.parametrize("add_vector_markers", [False, True])
@pytest.mark.parametrize("add_ipf_markers", [False, True])
@pytest.mark.parametrize("add_ipf_correlation_heatmap", [False, True])
@pytest.mark.parametrize("add_ipf_colorkey", [False, True])
@pytest.mark.parametrize(
"vector_kwargs", [None, {"annotate": False}, {"annotate": True}]
)
def test_plot_over_multi_phase_signal(
self,
multi_phase_orientation_result,
add_vector_markers,
add_ipf_markers,
add_ipf_correlation_heatmap,
add_ipf_colorkey,
vector_kwargs,
):
# Mock signal
s = hs.signals.Signal2D(
np.zeros(multi_phase_orientation_result.data.shape[:-2])[
..., np.newaxis, np.newaxis
]
)
multi_phase_orientation_result.plot_over_signal(s)
multi_phase_orientation_result.plot_over_signal(
s,
add_vector_markers=add_vector_markers,
add_ipf_markers=add_ipf_markers,
add_ipf_correlation_heatmap=add_ipf_correlation_heatmap,
add_ipf_colorkey=add_ipf_colorkey,
vector_kwargs=vector_kwargs,
)

def test_to_ipf_correlation_heatmap_markers_single_phase(
self, simple_multi_rot_orientation_result
Expand Down

0 comments on commit 852c9d0

Please sign in to comment.