Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate kikuchipy.pattern.correlate module #377

Merged
merged 2 commits into from
Jun 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Changed

Deprecated
----------
- The kikuchipy.pattern.correlate module will be removed in v0.5. Use
kikuchipy.indexing.similarity_metrics instead.
(`#377 <https://github.com/pyxem/kikuchipy/pull/377>`_)
- Rename the EBSD.match_patterns() method to EBSD.dictionary_indexing().
match_patterns() will be removed in v0.5.
(`#376 <https://github.com/pyxem/kikuchipy/pull/376>`_)
Expand Down
9 changes: 9 additions & 0 deletions kikuchipy/pattern/correlate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@
# You should have received a copy of the GNU General Public License
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.

# TODO: Remove file after v0.4 is released

"""Compute similarities between EBSD patterns."""

from typing import Union

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],
Expand Down
15 changes: 9 additions & 6 deletions kikuchipy/pattern/tests/test_correlate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.

# TODO: Remove file after v0.4 is released

import numpy as np
import pytest

Expand All @@ -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)