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

Remove master pattern metadata, add projection, hemisphere and phase attributes #246

Merged

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Nov 12, 2020

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

Description of the change

  • Remove the EBSDMasterPattern metadata Simulation node, since it is unused by the class.
  • Instead, we add three settable attributes projection (str), hemisphere (str) and phase (orix Phase), which WILL be used in the class (Detector Pattern Simulation #239). These can also be used when creating a master pattern class via init (see example below).
  • Remove the EBSDMasterPattern.set_simulation_parameters() and EBSDMasterPattern.set_phase_parameters() methods.
  • All parameter info from EMsoft's master pattern HDF5 file is stored in the original_metadata property, which carries over when saving and loading HDF5 files in the HyperSpy format. The three added properties above DOES NOT carry over in a save/load with ANY format supported by kikuchipy or HyperSpy... We will address this in the future if necessary.
  • The EBSD master pattern metadata and Sample.Phases node is removed from the user guide page.

I hope to adopt this approach for the EBSD class as well, removing various metadata setting methods, so that all relevant parameters are available via e.g. EBSD.acceleration_voltage etc. (talking to the metadata, of course).

Progress of the PR

Minimal example of the bug fix or new feature

>>> import kikuchipy as kp
>>> from orix.crystal_map import Phase
>>> s_mp = kp.data.nickel_ebsd_master_pattern_small(projection="lambert")
>>> s_mp.projection
lambert
>>> s_mp.phase.point_group.contains_inversion
True
>>> s_mp2 = kp.signals.EBSDMasterPattern(
...     np.zeros((2, 10, 11, 11)), hemisphere="both", projection="lambert", phase=Phase("a")
... )
>>> s_mp2.phase.name
a

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 enhancement New feature or request documentation This relates to the documentation labels Nov 12, 2020
@hakonanes hakonanes added this to the v0.3.0 milestone Nov 12, 2020
@hakonanes hakonanes self-assigned this Nov 12, 2020
@hakonanes hakonanes changed the title Set up necessary (empty) tests, add desired changes to changelog Expose master pattern metadata as class properties Nov 12, 2020
@hakonanes hakonanes marked this pull request as draft November 12, 2020 13:48
@hakonanes
Copy link
Member Author

It's challenging to maintain phase information in both the metadata and a EBSDMasterPattern.phase property... Therefore, I've decided to scrap the Sample.Phases metadata for the EBSDMasterPattern class and just provide the orix Phase object as a phase property.

This means that writing and reading a master pattern to and from the HyperSpy HDF5 format DOES NOT maintain phase information.

@hakonanes hakonanes changed the title Expose master pattern metadata as class properties Remove master pattern metadata, add projection, hemisphere and phase attributes Nov 12, 2020
@friedkitteh friedkitteh mentioned this pull request Nov 12, 2020
8 tasks
…e docs/tests

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes marked this pull request as ready for review November 12, 2020 19:37
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes merged commit 8dc22a1 into pyxem:master Nov 13, 2020
@hakonanes hakonanes deleted the ebsd-master-pattern-metadata-properties branch November 13, 2020 10:31
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