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 simulations of Kikuchi band positions on an EBSD detector #204

Merged
merged 22 commits into from
Sep 7, 2020

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Aug 25, 2020

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

Description

Lot's of additions in this PR... The main outcome is a geometrical model for simulation of Kikuchi band center positions on an EBSD detector, based on the supplementary material by Aimo Winkelmann (@wiai) from Britton et al. (2016) (doi: https://doi.org/10.1016/j.matchar.2016.04.008).

  • Add a kikuchipy.detectors module and an EBSDDetector class to handle projection center and gnomonic projections
  • Add a kikuchipy.projections module with projections from the above supplementary material, notably crystal planes and zone axes onto the detector. The Hesse normal form of a plane trace is also included here.
  • Add a kikuchipy.crystallography module to compute the direct structure matrix from a crystal lattice. This should be included into diffpy.structure as part of the diffpy.structure.Lattice object (Can one obtain the direct and reciprocal structure matrices from a Lattice object? diffpy/diffpy.structure#46).
  • Add a kikuchipy.draw module with convenience functions to create lists of simulation features as HyperSpy markers (line segments, points, text).
  • Add a kikuchipy.generators.ebsd_simulation.EBSDSimulationGenerator class, with a geometrical_simulation() method.
  • Add a kikuchipy.simulations module with a GeometricalEBSDSimulation class to store KikuchiBand and ZoneAxes features with gnomonic and cartesian coordinates.

The last two points should be moved to diffsims in the future.

Due to anticipated near future rapid development in kikuchipy, I've decided to add the ReciprocalLatticePoint class in the kikuchipy.crystallography module to get this PR in now. This class and functions it uses will be removed when it is merged into diffsims.

Checklist

All this will be done in separate PRs, as we need this in now.

  • Docstrings for all functions
  • Unit tests with pytest for all lines
  • Clean style in as per black
  • Complete kikuchipy.simulations.features.KikuchiBand class with different navigation shapes and docstrings
  • Complete kikuchipy.simulations.features.ZoneAxis class with changes made in KikuchiBand
  • Complete handling of different navigation shapes in EBSDDetector.pc projection center property
  • Double check detector PC vendor conversions
  • Write minimal tests to make sure large parts work as expected (more granular tests to be written in separate PRs before v0.3 release)
  • Write new user guide pages for coordinate systems and geometrical simulations, flagging these as experimental

Minimal example of the bug fix or new feature

Visual result of this PR (note that the dynamical simulations to the right are generated with EMsoft):
Peek 05-09-2020 20-15

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 the enhancement New feature or request label Aug 25, 2020
@hakonanes hakonanes added this to the v0.3.0 milestone Aug 25, 2020
@hakonanes hakonanes self-assigned this Aug 25, 2020
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
Copy link
Member Author

hakonanes commented Sep 2, 2020

I'm soon wrapping this PR up, it is a lot!

Basically, with the correct crystal structure, unit cell orientation and a calibrated detector-sample geometry, we get this:
test

@friedkitteh, the kikuchipy.projections module is the one to put stuff into, and also the kikuchipy.detectors.EBSDDetector class is important for the projection/pattern center etc.

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 changed the title Add detectors module with an EBSDDetector class Add simulations module with a geometrical model for Kikuchi bands and zone axes Sep 3, 2020
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes
Copy link
Member Author

hakonanes commented Sep 3, 2020

This commit was made so that this state of the PR is stored. Will now mess things up (more than now...) to compute a simulated pattern per orientation with dask, as is done for pattern processing.

It can be argued that computing dot products with multiple orientations at a time is faster... But I don't know. I think the algorithmic architecture is simpler to handle when calculations of band coordinates is done per orientation/pattern. It should also be easier to scale up to many cores...? And, we can provide the user with a simple progress bar via dask's diagnostics.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes
Copy link
Member Author

Actually decided against dask for now, since I found an OK way to simulate multiple sets of bands per orientation at once... Getting there!

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes
Copy link
Member Author

Due to anticipated near future rapid development in kikuchipy, I've decided to add the ReciprocalLatticePoint class in the kikuchipy.crystallography module to get this PR in now. This class and functions it uses will be removed when it is merged into diffsims.

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 changed the title Add simulations module with a geometrical model for Kikuchi bands and zone axes Add simulations of Kikuchi band positions on an EBSD detector Sep 6, 2020
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes
Copy link
Member Author

hakonanes commented Sep 7, 2020

I'm going to merge this into master as is, which I normally wouldn't do since coverage will drop and I cannot guarantee that the simulation functionality is robust enough at the moment... But I will, as especially the detector class is important for further current developments.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant