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

Add test/notebook for matching projected to experimental patterns #263

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Dec 16, 2020

Signed-off-by: Håkon Wiik Ånes hwaanes@gmail.com

Description of the change

  • Add test to pass simulated patterns obtained from EBSDMasterPattern.get_patterns() directly to EBSD.match_patterns()
  • Add pattern matching notebook

Progress of the PR

Minimal example of the bug fix or new feature

The notebook basically does

>>> import hyperspy.api as hs
>>> from orix import sampling
>>> import kikuchipy as kp
>>> s = kp.data.nickel_ebsd_small()
>>> s.remove_static_background()
>>> s.remove_dynamic_background()
>>> mp = kp.data.nickel_ebsd_master_pattern_small(projection="lambert")
>>> ni = mp.phase
>>> r = sampling.get_sample_fundamental(
...     resolution=5, space_group=ni.space_group.number
... )
>>> detector = kp.detectors.EBSDDetector(
...    shape=s.axes_manager.signal_shape[::-1],
...    pc=[0.421, 0.7794, 0.5049],
...    sample_tilt=70,
...    convention="tsl",
... )
>>> sim = mp.get_patterns(rotations=r, detector=detector, energy=20)
>>> xmap = s.match_patterns(sim, n_slices=10, keep_n=10)
>>> ncc = xmap.get_map_data(xmap.scores[:, 0])
>>> best_patterns = sim.data[xmap.simulation_indices[:, 0]].reshape(s.data.shape)
>>> s_sim = kp.signals.EBSD(best_patterns.compute())
>>> hs.plot.plot_signals([s, s_sim], navigator=hs.signals.Signal2D(ncc))

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    the unreleased section in doc/changelog.rst.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added documentation This relates to the documentation 📋 tests labels Dec 16, 2020
@hakonanes hakonanes added this to the v0.3.0 milestone Dec 16, 2020
@hakonanes hakonanes self-assigned this Dec 16, 2020
@hakonanes hakonanes marked this pull request as draft December 16, 2020 11:27
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes marked this pull request as ready for review December 20, 2020 12:42
@hakonanes hakonanes merged commit cb1a4a8 into pyxem:master Dec 20, 2020
@hakonanes hakonanes deleted the add-test-using-own-dictionaries-for-immediate-indexing branch December 20, 2020 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This relates to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant