-
Notifications
You must be signed in to change notification settings - Fork 30
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
Improvements to dictionary indexing #419
Merged
hakonanes
merged 10 commits into
pyxem:develop
from
hakonanes:internal-improvements-to-dictionary-indexing
Aug 26, 2021
Merged
Improvements to dictionary indexing #419
hakonanes
merged 10 commits into
pyxem:develop
from
hakonanes:internal-improvements-to-dictionary-indexing
Aug 26, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 tasks
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>
e987569
to
5b61d61
Compare
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>
There are only a few minor updates to the API reference and the pattern matching notebook left now. Hope to finish this tomorrow and then merge. Please feel free to have a look e.g. at EBSD.dictionary_indexing or SimilarityMetric if anyone is interested. |
1 task
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>
This PR is now done. Will merge after checks pass. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Håkon Wiik Ånes hwaanes@gmail.com
Description of the change
This PR aims to improve the dictionary indexing implementation in kikuchipy, and simplify some parts of it.
Drawbacks in the current implementation that this PR addresses:
SimilarityMetric
class to an abstract one where three methods must be provided:prepare_simulated()
,prepare_experimental()
, andcompare()
. Previously, only thecompare()
method could be provided by the user, where all pattern preparation had to be done. This is called in every iteration, where parts of the dictionary is compared to all experimental patterns. For example in the default normalized cross correlation metric, all experimental patterns were centred and normalized in every iteration by dask. In this new implementation,prepare_experimental()
is called once before the iteration loop. The user now has to create a class instead of a function, which is more complex. However, by providing an example in the documentation, I think this should be OK.n_slices
parameter isn't self explanatory. The number of simulated patterns divided by this number decides how many simulated patterns to match to all experimental patterns in each iteration. It would be better to let the user specify how many simulated patterns to match in each iteration. Also, if the dictionary is a dask array, we could use it's chunksize as this number. This will be the default option. This will also get rid of the prompt asking if we really should index whenn_slices
were deemed too few._dictionary_indexing.py
. Whether we are indexing with a dask or numpy array is checked in an if statement, otherwise the implementation is the same in both cases.dictionary_indexing()
method: I've decided to remove the possibility to index a dataset with multiple dictionaries "at the same" by passing multiple dictionaries to the method. The user can just produce two maps, and then merge them themselves, with only two extra lines. Benefits? The API is cleaner and it is way simpler to maintain.dictionary_indexing()
method: I've decided to remove the possibility to generate an orientation similarity map with the method. The user can produce this map with one extra line themselves. See the previous point for benefits.Extra thoughts for other PRs:
scipy.spatial.distance
module. We would have to think more about memory usage here, though, since both the normalized cross-correlation and normalized dot product metrics currently implemented use dask's einsum for comparing patterns.This will close #380, #420.
Unless something comes up, I anticipate these changes to be the last ones, apart from any bugfixes, to merge before releasing v0.5.
Progress of the PR
SimilarityMetric
class- [ ] Provide an example in the documentation of a very simpleLink to the implementation ofSimilarityMetric
class to show users how they can make their ownNormalizedCrossCorrelationMetric
instead.NormalizedCrossCorrelationMetric
class using the abstract classNormalizedDotProductMetric
class using the abstract classEBSD.dictionary_indexing()
and the indexing logistics in_dictionary_indexing.py
EBSD.match_patterns()
, closing Remove deprecations for v0.5 #420.correlate
module.Minimal example of the bug fix or new feature
For reviewers
__init__.py
.section in
doc/changelog.rst
.