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 EBSD Hough indexing with a thin wrapper around PyEBSDIndex #590

Merged
merged 21 commits into from
Jan 12, 2023

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Jan 11, 2023

Description of the change

This PR adds convenience methods for Hough indexing by a very thin wrapper around PyEBSDIndex. The methods are added to simplify use of kikuchipy with PyEBSDIndex.

Caveats:

  • Uses only a single thread via pyebsdindex.ebsd_index.EBSDIndexer.index_pats(). To get the best speed and memory handling, one should use PyEBSDIndex directly, e.g. via ebsd_index.index_pats_distributed().
  • Only patterns from FCC and BCC crystals can be indexed at the moment, as these are the only current phases supported by PyEBSDIndex.

A CrystalMap is returned from the new method EBSD.hough_indexing(), which removes most of the inconvenience of getting a map from the array PyEBSDIndex' returns from its EBSDIndexer.index_pats() and similar functions. A function kikuchipy.indexing.xmap_from_hough_indexing_data() requring the array and an orix PhaseList can be used to convert the array to a crystal map when using PyEBSDIndex directly (not via hough_indexing()).

EBSD.hough_indexing() requires an pyebsdindex.ebsd_index.EBSDIndexer, which can be conveniently created using a new method EBSDDetector.get_indexer(phase_list), where phase_list is a PhaseList. This ensures that all detector parameters (sample tilt, camera elevation, pattern shape) and the phase list (either FCC, BCC or both, at the moment) are handled correctly.

Lastly, a EBSD.hough_indexing_optimize_pc() method is added to optimize projection centers (PCs). This wraps pyebsdindex.pcopt.optimize() or pyebsdindex.pcopt.optimize_pso(), depending on whether Nelder-Mead or particle swarm is chosen as optimization function. A EBSDDetector with optimized PCs is returned.

All tutorial notebooks using Hough indexing have been updated. They demonstrate nicely how to use the new functionality.

PyEBSDIndex is an optional dependency. It should be installed manually or via pip install kikuchipy[all]. all is a new dependency list installing all dependencies and optional dependencies (PyEBSDIndex, NLopt, PyVista). The viz dependency list (PyVista) is deprecated and will be removed in 0.9.


@Erlendos12, @htrellin and @olavlet: These changes might interest you for your https://github.com/htrellin/EBSD-GUI.


@drowenhorst-nrl: Hough indexing in kikuchipy is a very thin wrapper around PyEBSDIndex. This PR contains no duplication of functionality. I hope the new functionality in kikuchipy will increase the use of PyEBSDIndex and help identify any bugs going forward.

Progress of the PR

Minimal example of the bug fix or new feature

The indexing tutorials in the docs built from this PR demonstrates the new functionality nicely: https://kikuchipy--590.org.readthedocs.build/en/590/tutorials/index.html#indexing

For reviewers

  • The PR title is short, concise, and will make sense 1 year later.
  • New functions are imported in corresponding __init__.py.
  • New features, API changes, and deprecations are mentioned in the unreleased
    section in CHANGELOG.rst.
  • New contributors are added to release.py, .zenodo.json and
    .all-contributorsrc with the table regenerated.

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>
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>
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>
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 added enhancement New feature or request documentation This relates to the documentation labels Jan 11, 2023
@hakonanes hakonanes added this to the v0.8.0 milestone Jan 11, 2023
@hakonanes hakonanes mentioned this pull request Jan 11, 2023
4 tasks
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>
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>
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 merged commit d2a9d84 into pyxem:develop Jan 12, 2023
@hakonanes hakonanes deleted the ebsd-hough-indexing-method branch January 12, 2023 10:59
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant