diff --git a/doc/changelog.rst b/doc/changelog.rst index 7ea4ac97..f32a3d3b 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -42,6 +42,9 @@ Changed Deprecated ---------- +- The kikuchipy.pattern.correlate module will be removed in v0.5. Use + kikuchipy.indexing.similarity_metrics instead. + (`#377 `_) - Rename the EBSD.match_patterns() method to EBSD.dictionary_indexing(). match_patterns() will be removed in v0.5. (`#376 `_) diff --git a/kikuchipy/pattern/correlate.py b/kikuchipy/pattern/correlate.py index 5670c288..65411953 100644 --- a/kikuchipy/pattern/correlate.py +++ b/kikuchipy/pattern/correlate.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with kikuchipy. If not, see . +# TODO: Remove file after v0.4 is released + """Compute similarities between EBSD patterns.""" from typing import Union @@ -23,7 +25,14 @@ from dask.array import Array import numpy as np +from kikuchipy._util import deprecated + +@deprecated( + since="0.4", + alternative="kikuchipy.indexing.similarity_metrics.ncc", + removal="0.5", +) def normalized_correlation_coefficient( pattern: Union[np.ndarray, Array], template: Union[np.ndarray, Array], diff --git a/kikuchipy/pattern/tests/test_correlate.py b/kikuchipy/pattern/tests/test_correlate.py index 7c8e19b9..1545df14 100644 --- a/kikuchipy/pattern/tests/test_correlate.py +++ b/kikuchipy/pattern/tests/test_correlate.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with kikuchipy. If not, see . +# TODO: Remove file after v0.4 is released + import numpy as np import pytest @@ -30,9 +32,10 @@ class TestNormalizedCrossCorrelation: def test_normalised_correlation_coefficient( self, dummy_signal, pattern_idx, template_idx, answer ): - coefficient = normalized_correlation_coefficient( - pattern=dummy_signal.inav[pattern_idx].data, - template=dummy_signal.inav[template_idx].data, - zero_normalised=True, - ) - assert np.allclose(coefficient, answer, atol=1e-7) + with pytest.warns(np.VisibleDeprecationWarning, match="Function "): + coefficient = normalized_correlation_coefficient( + pattern=dummy_signal.inav[pattern_idx].data, + template=dummy_signal.inav[template_idx].data, + zero_normalised=True, + ) + assert np.allclose(coefficient, answer, atol=1e-7)