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

Geometrical and kinematical Kikuchi pattern simulations for all point groups #537

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7de369f
Generalize parts of vector handling
hakonanes Feb 24, 2022
26d88cf
Toward generalizing geometrical sim. for all point groups
hakonanes Mar 4, 2022
0160029
Start on generalizing EBSD simulations
hakonanes Mar 8, 2022
75ee0e3
Update EBSDDetector PC conventions
hakonanes Mar 8, 2022
e39ff25
Apply stash
hakonanes Mar 15, 2022
442ec10
Add 3D plotting of Kikuchi map, possibly with PyVista
hakonanes Mar 16, 2022
0260fb5
Working geometrical simulations triclinic
hakonanes Mar 17, 2022
943819c
Add zone axes to geometrical simulation
hakonanes Mar 17, 2022
d6a2648
Fix transformation functions, simplify
hakonanes Mar 22, 2022
f77f6f7
Generalize simulations to 1D or 2D
hakonanes Mar 23, 2022
7632cec
Make plotting lines as markers work again
hakonanes Mar 23, 2022
6ad9df4
Use flexible alignment in orix
hakonanes Apr 7, 2022
4f97d5a
Cont. improving reflector plotting
hakonanes Apr 19, 2022
8c83cd8
Cont. improvements
hakonanes May 12, 2022
9e4520f
Merge branch 'develop' into geometrical-simulations-all-point-groups
hakonanes Jun 2, 2022
6679377
Move some operations to Dask in on_detector()
hakonanes Jun 9, 2022
2fa9892
Merge branch 'develop' into geometrical-simulations-all-point-groups
hakonanes Jun 9, 2022
1a66f34
Remove "3d" pip selector in favour of "viz"
hakonanes Jun 9, 2022
2f8ad2f
Add kinematical simulations of the Kikuchi sphere
hakonanes Jun 12, 2022
1a021ad
Format some powers with Black
hakonanes Jun 12, 2022
93facf9
Revert changes to existing geometrical simulations
hakonanes Jun 12, 2022
7a8dc74
Set minimal version of diffsims to >= 0.5
hakonanes Jun 12, 2022
1834269
Revert change of EMsoft PC convention
hakonanes Jun 12, 2022
55f3b21
Fix #487
hakonanes Jun 12, 2022
8214752
Fix plotting of geometrical simulations on rect. patterns
hakonanes Jun 12, 2022
94fc291
Fix use of EBSD detector's aspect ratio in tests
hakonanes Jun 13, 2022
b47be31
Correct minimal version of diffsims in CI workflow
hakonanes Jun 13, 2022
b5be058
Deprecate kikuchipy.crystallography.matrices module
hakonanes Jun 13, 2022
4c27bdc
Make test for gnomonic circles on detector pass with older Matplotlib
hakonanes Jun 13, 2022
d1c4bcc
Skip certain print checks in docstring checks
hakonanes Jun 13, 2022
b9d637c
Complete docstrings for KikuchiPatternSimulator
hakonanes Jun 13, 2022
f41c394
Start on tests for KikuchiPatternSimulator
hakonanes Jun 13, 2022
69abad9
Complete tests of KikuchiPatternSimulator
hakonanes Jun 13, 2022
285a2cb
Complete tests of GeometricalKikuchiPatternSimulation
hakonanes Jun 14, 2022
38d1834
Add deprecation notices to 'features' module
hakonanes Jun 14, 2022
7bf52bb
Replace some int with np.int64
hakonanes Jun 14, 2022
c97bf5e
Change rotations in test to avoid rounding giving different OS results
hakonanes Jun 14, 2022
7b47311
Round dot products, sort vectors before plotting according to intensity
hakonanes Jun 14, 2022
bb7ae63
Update simulation notebook with improvements and kinematical simulations
hakonanes Jun 14, 2022
41a2fc5
Add EMsoft license in file because some functionality is derived
hakonanes Jun 14, 2022
c112207
Remove "mode" attribute to master patterns, fix lists in notebook
hakonanes Jun 15, 2022
2f18c6e
Remove use of "mode" attribute in tests
hakonanes Jun 15, 2022
db5db6f
Fix some documentation links
hakonanes Jun 15, 2022
db82f27
Add stereo. to Lambert proj., change hemisphere north/south to upper/…
hakonanes Jun 15, 2022
942f1ac
Change hemisphere north/south to upper/lower in tests and other places
hakonanes Jun 15, 2022
6812d2a
Exclude zone axes labels outside gnomonic bounds, remove brackets
hakonanes Jun 15, 2022
bd570e8
Return correct axes manager for master pattern from simulator
hakonanes Jun 15, 2022
8530f92
Add use of stereo. to Lambert proj. in user guide
hakonanes Jun 15, 2022
f911166
Update links to simulation user guide, use new simulator
hakonanes Jun 15, 2022
f53f9d6
Fix bug in gray rectangle in EBSD detector plot
hakonanes Jun 15, 2022
225c59c
Correct zone axes labels [uvw]
hakonanes Jun 15, 2022
f10aa47
Return line and zone axis coordinates as new arrays
hakonanes Jun 15, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- os: ubuntu-latest
python-version: 3.7
OLDEST_SUPPORTED_VERSION: true
DEPENDENCIES: dask==2021.8.1 diffsims==0.4.0 hyperspy==1.7 matplotlib==3.3 numba==0.52 numpy==1.19 orix==0.9.0 scikit-image==0.16.2
DEPENDENCIES: dask==2021.8.1 diffsims==0.5.0 hyperspy==1.7 matplotlib==3.3 numba==0.52 numpy==1.19 orix==0.9.0 scikit-image==0.16.2
LABEL: -oldest
steps:
- uses: actions/checkout@v2
Expand Down
34 changes: 29 additions & 5 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ Added
- ``EBSDMasterPattern.plot_spherical()`` for plotting a master pattern in the
stereographic projection on the 3D sphere.
(`#536 <https://github.com/pyxem/kikuchipy/pull/536>`_)
- A new package dependency on `pyvista` for 3D plotting and on `pythreejs` for the docs
are introduced. (`#536 <https://github.com/pyxem/kikuchipy/pull/536>`_)
- Projection of master pattern in the stereographic projection to the square Lambert
projection via ``EBSDMasterPattern.to_lambert()``.
(`#536 <https://github.com/pyxem/kikuchipy/pull/536>`_)
- New package dependencies on ``pyvista`` for 3D plotting and on ``pythreejs`` for the
docs are introduced. (`#536 <https://github.com/pyxem/kikuchipy/pull/536>`_)
- Reduce time and memory use of the following ``kikuchipy.signals.EBSD`` methods by
using ``hyperspy.signal.BaseSignal.map()``: ``remove_static_background()``,
``remove_dynamic_background()`` and ``get_image_quality()``.
Expand All @@ -38,21 +41,40 @@ Added

Changed
-------
- Valid ``EBSDMasterPattern.hemisphere`` values from ``"north"`` and ``"south"`` to
``"upper"`` and ``"lower"``, respectively, to be in line with `orix`.
(`#537 <https://github.com/pyxem/kikuchipy/pull/537>`_)
- Increase minimal version of diffsims to 0.5.
(`#537 <https://github.com/pyxem/kikuchipy/pull/537>`_)
- Chunking of EBSD signal navigation dimensions in
``EBSD.average_neighbour_patterns()`` to reduce memory use.
(`#532 <https://github.com/pyxem/kikuchipy/pull/532>`_)
- Remove requirement that the crystal map used for EBSD refinement has identical step
size(s) to the EBSD signal's navigation axes. This raised an error previously, but now
only emits a warning. (`#531 <https://github.com/pyxem/kikuchipy/pull/531>`_)
- Restrict minimal version of HyperSpy to 1.7.
- Increase minimal version of HyperSpy to 1.7.
(`#527 <https://github.com/pyxem/kikuchipy/pull/527>`_)
- Restrict minimal version of SciPy to 1.7.
- Increase minimal version of SciPy to 1.7.
(`#504 <https://github.com/pyxem/kikuchipy/pull/504>`_)

Deprecated
----------
- The ``kikuchipy.simulations.GeometricalEBSDSimulation`` class is deprecated and will
be removed in version 0.7. Obtain
``kikuchipy.simulations.GeometricalKikuchiPatternSimulation`` via
``kikuchipy.simulations.KikuchiPatternSimulator.on_detector()`` instead. The
``kikuchipy.simulations.features`` module is also deprecated and will be removed in
version 0.7. Obtain Kikuchi line and zone axis detector/gnomonic coordinates of a
simulation via ``lines_coordinates()`` and ``zone_axes_coordinates()`` instead.
(`#537 <https://github.com/pyxem/kikuchipy/pull/537>`_)
- The ``kikuchipy.generators.EBSDSimulationGenerator`` class is deprecated and will be
removed in version 0.7. Use the ``kikuchipy.simulations.KikuchiPatternSimulator``
class instead. (`#537 <https://github.com/pyxem/kikuchipy/pull/537>`_)
- The ``kikuchipy.crystallography.matrices`` module is depreacted and will be removed in
version 0.7, access the matrices via :class:`diffpy.structure.Lattice` attributes
instead. (`#537 <https://github.com/pyxem/kikuchipy/pull/537>`_)
- The following functions for processing of pattern chunks in the
``kikuchipy.pattern.chunk`` module are deprecated in 0.6 and will be removed in 0.7:
``kikuchipy.pattern.chunk`` module are deprecated and will be removed in version 0.7:
``get_image_quality()``, ``remove_dynamic_background()`` and
``remove_static_background()``. Use the ``EBSD`` class for processing of many
patterns. (`#527 <https://github.com/pyxem/kikuchipy/pull/527>`_,
Expand All @@ -66,6 +88,8 @@ Removed

Fixed
-----
- Plotting of geometrical simulation markers on rectangular patterns.
(`#537 <https://github.com/pyxem/kikuchipy/pull/537>`_)
- Hopefully prevent EBSD refinement tests using random data to fail on Azure.
(`#465 <https://github.com/pyxem/kikuchipy/pull/465>`_)

Expand Down
20 changes: 11 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Code style
==========

The code making up kikuchipy is formatted closely following the `Style Guide for Python
Code <https://www.python.org/dev/peps/pep-0008/>`_ with `The Black Code style
Code <https://peps.python.org/pep-0008/>`_ with `The Black Code style
<https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html>`_. We
use `pre-commit <https://pre-commit.com>`_ to run ``black`` automatically prior to each
local commit. Please install it in your environment::
Expand All @@ -82,7 +82,7 @@ Next time you commit some code, your code will be formatted inplace according to
``black``.

Note that ``black`` won't format `docstrings
<https://www.python.org/dev/peps/pep-0257/>`_. We follow the `numpydoc
<https://peps.python.org/pep-0257/>`_. We follow the `numpydoc
<https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard>`_ standard.

Comment lines should preferably be limited to 72 characters.
Expand Down Expand Up @@ -132,7 +132,7 @@ Add and commit your created, modified or deleted files::
The ``-s`` makes sure that you sign your commit with your `GitHub-registered email
<https://github.com/settings/emails>`_ as the author. You can set this up following
`this GitHub guide
<https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address>`_.
<https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address>`_.

Keeping your branch up-to-date
==============================
Expand Down Expand Up @@ -161,8 +161,9 @@ Update your remote branch::
git push -u origin your-awesome-feature-name

You can then make a `pull request
<https://guides.github.com/activities/forking/#making-a-pull-request>`_ to kikuchipy's
``develop`` branch for new features and ``main`` branch for bug fixes. Good job!
<https://docs.github.com/en/get-started/quickstart/contributing-to-projects#making-a-pull-request>`_
to kikuchipy's ``develop`` branch for new features and ``main`` branch for bug fixes.
Good job!

Building and writing documentation
==================================
Expand Down Expand Up @@ -245,7 +246,7 @@ the documentation doesn't take too long to build, either by us locally or the Re
Docs GitHub action. To check that the notebooks with stored cell outputs are compatible
with the current API, we run a scheduled GitHub Action every Monday morning which checks
that the notebooks run OK and that they produce the same output now as when they were
last executed. We use `nbval <https://nbval.readthedocs.io>`_ for this.
last executed. We use `nbval <https://nbval.readthedocs.io/en/latest/>`_ for this.

Deprecations
============
Expand Down Expand Up @@ -277,8 +278,9 @@ answers. Install necessary dependencies to run the tests::

pip install --editable .[tests]

Some useful `fixtures <https://docs.pytest.org/en/latest/fixture.html>`_, like a dummy
scan and corresponding background pattern, are available in the ``conftest.py`` file.
Some useful `fixtures <https://docs.pytest.org/en/latest/explanation/fixtures.html>`_,
like a dummy scan and corresponding background pattern, are available in the
``conftest.py`` file.

.. note::

Expand Down Expand Up @@ -309,7 +311,7 @@ e.g. when you're creating or updating a test. But remember to run the full test
before pushing!

Docstring examples are tested `with pytest
<https://docs.pytest.org/en/stable/doctest.html>`_ as well::
<https://docs.pytest.org/en/stable/how-to/doctest.html>`_ as well::

pytest --doctest-modules --ignore-glob=kikuchipy/*/tests

Expand Down
19 changes: 19 additions & 0 deletions doc/bibliography.bib
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,25 @@ @phdthesis{lassen1994automated
title = {{Automated Determanation of Crystal Orientations from Electron Backscattering Patterns}},
year = {1994}
}
@book{kirkland1998advanced,
author = {Kirkland, Earl J},
publisher = {Springer},
title = {{Advanced computing in electron microscopy}},
volume = {12},
year = {1998},
doi = {10.1007/978-1-4757-4406-4}
}
@article{lobato2014accurate,
author = {Lobato, Ivan and {Van Dyck}, Dirk},
journal = {Acta Crystallographica Section A: Foundations and Advances},
number = {6},
pages = {636–649},
publisher = {International Union of Crystallography},
title = {{An accurate parameterization for scattering factors, electron densities and electrostatic potentials for neutral atoms that obey all physical constraints}},
volume = {70},
year = {2014},
doi = {10.1107/S205327331401643X}
}
@article{marquardt2017quantitative,
author = {Marquardt, Katharina and {De Graef}, Marc and Singh, Saransh and Marquardt, Hauke and Rosenthal, Anja and Koizuimi, Sanae},
doi = {10.2138/am-2017-6062},
Expand Down
794 changes: 111 additions & 683 deletions doc/examples/mandm2021_sunday_short_course.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kikuchipy
=========

.. Launch binder
.. image:: https://mybinder.org/badge_logo.svg
.. image:: https://static.mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/pyxem/kikuchipy/HEAD
:alt: Launch binder

Expand All @@ -28,11 +28,11 @@ kikuchipy

.. PyPI version
.. image:: https://img.shields.io/pypi/v/kikuchipy.svg
:target: https://pypi.python.org/pypi/kikuchipy
:target: https://pypi.org/project/kikuchipy/
:alt: PyPI version

.. Downloads per month
.. image:: https://pepy.tech/badge/kikuchipy/month
.. image:: https://static.pepy.tech/badge/kikuchipy/month
:target: https://pepy.tech/project/kikuchipy
:alt: Downloads per month

Expand All @@ -54,7 +54,7 @@ multi-dimensional data analysis provided by the HyperSpy library.
Notebooks with many links to detailed explanations of the input parameters and output
of functions and class methods (the API reference). The notebooks can be inspected
statically on the web page or via `nbviewer
<https://nbviewer.jupyter.org/github/pyxem/kikuchipy/tree/develop/doc/user_guide/>`_,
<https://nbviewer.org/github/pyxem/kikuchipy/tree/develop/doc/user_guide/>`_,
downloaded and run locally, or run interactively in the browser by clicking the Binder
link above and navigating to the `doc/user_guide` directory. We hope you find them
useful!
Expand Down Expand Up @@ -87,7 +87,7 @@ multi-dimensional data analysis provided by the HyperSpy library.
user_guide/feature_maps.ipynb
user_guide/virtual_backscatter_electron_imaging.ipynb
user_guide/pattern_matching.ipynb
user_guide/geometrical_ebsd_simulations.ipynb
user_guide/kikuchi_pattern_simulations.ipynb
user_guide/multivariate_analysis.ipynb
user_guide/metadata_structure.ipynb

Expand Down
32 changes: 31 additions & 1 deletion doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,38 @@ simulations
.. currentmodule:: kikuchipy.simulations

.. autosummary::
GeometricalEBSDSimulation
KikuchiPatternSimulator
GeometricalKikuchiPatternSimulation
features
GeometricalEBSDSimulation

KikuchiPatternSimulator
-----------------------

.. currentmodule:: kikuchipy.simulations.KikuchiPatternSimulator

.. autosummary::
calculate_master_pattern
on_detector
plot

.. autoclass:: kikuchipy.simulations.KikuchiPatternSimulator
:members:

GeometricalKikuchiPatternSimulation
-----------------------------------

.. currentmodule:: kikuchipy.simulations.GeometricalKikuchiPatternSimulation

.. autosummary::
as_collections
as_markers
lines_coordinates
plot
zone_axes_coordinates

.. autoclass:: kikuchipy.simulations.GeometricalKikuchiPatternSimulation
:members:

GeometricalEBSDSimulation
-------------------------
Expand Down
Loading