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

Overwrite deepcopy for EBSD and EBSDMasterPattern to carry over custom properties #356

Merged
merged 2 commits into from
May 7, 2021

Conversation

hakonanes
Copy link
Member

Description of the change

  • Signal2D.deepcopy() is overwritten for the EBSD and EBSDMasterPattern signals to carry over the following custom properties:
    • EBSD: xmap and detector
    • EBSDMasterPattern: phase (orix.crystal_map.Phase), projection (str), and hemisphere
  • Make the EBSD.xmap property settable. A private function located in kikuchipy.signals.util._crystal_map.py is added to ensure that the crystal map and EBSD signal has the same navigation shape and navigation step sizes (e.g. 1 um). This function should be used whenever the EBSD.xmap property is used, ensuring that a reasonable error message is raised if the map and signal aren't compatible.

Close #345.

Progress of the PR

Minimal example of the bug fix or new feature

>>> import numpy as np
>>> import kikuchipy as kp
>>> s = kp.data.nickel_ebsd_small()
>>> s.xmap
<CrystalMap repr>
>>> s.detector
<EBSDDetector repr>
>>> s2 = s.deepcopy()
>>> np.may_share_memory(s.xmap.rotations.data, s2.xmap.rotations.data)
False
>>> np.may_share_memory(s.detector.pc, s2.detector.pc)
False

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 doc/changelog.rst.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added the bug Something isn't working label May 7, 2021
@hakonanes hakonanes added this to the v0.4.0 milestone May 7, 2021
@hakonanes
Copy link
Member Author

Merging after checks pass.

@hakonanes hakonanes merged commit e43e77c into pyxem:master May 7, 2021
@hakonanes hakonanes deleted the overwrite-deepcopy branch May 7, 2021 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overwrite Signal2D.deepcopy() for EBSD and EBSDMasterPattern to carry over custom properties
1 participant