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

Allow projection of patterns with a varying PC from a master pattern #567

Merged
merged 16 commits into from Oct 2, 2022

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Oct 1, 2022

Description of the change

This PR adds the ability to project patterns with a varying projection center (PC) from a master pattern with EBSDMasterPattern.get_patterns() by passing an EBSDDetector with multiple PCs, one per rotation. An example is added to the methods' docstring. Solves #503.

The ability to not pass the energy parameter to EBSDMasterPattern.get_patterns() is also added, upon which the highest energy in the master pattern is used. Solves #554.

Finally, by restricting ipywidgets<=7.7 in the docs build, the PyVista plots of master patterns in the docs are displayed. Solves #566.

Fix #565 and #519.

Progress of the PR

Minimal example of the bug fix or new feature

The example from EBSDMasterPattern.get_patterns():

import numpy as np
from orix.quaternion import Rotation
import hyperspy.api as hs
import kikuchipy as kp


mp = kp.data.nickel_ebsd_master_pattern_small(projection="lambert")
det = kp.detectors.EBSDDetector(
    shape=(60, 60),
    pc=np.array([
        [[0.4, 0.5, 0.4], [0.6, 0.5, 0.4]],
        [[0.4, 0.5, 0.6], [0.6, 0.5, 0.6]],
    ])
)
rot = Rotation.identity(det.navigation_shape)
s = mp.get_patterns(rot, det, compute=True, show_progressbar=False)
_ = hs.plot.plot_images(
    s,
    per_row=2,
    cmap="inferno",
    label=np.array_str(det.pc.reshape((-1, 3)))[1:-1].split("\n "),
    axes_decor=None,
)

bilde

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 and .all-contributorsrc and the table
    is 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>
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 3720934 into pyxem:develop Oct 2, 2022
@hakonanes hakonanes deleted the multiple-pcs-get-patterns branch October 2, 2022 14:39
Copy link
Contributor

@ericpre ericpre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I left some comments regarding the fix for #565.

kikuchipy/signals/util/tests/test_dask.py Show resolved Hide resolved
kikuchipy/signals/util/tests/test_dask.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment