Small fix to GeometricalKikuchiPatternSimulation #720
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.
Problem: calling GeometricalKikuchiPatternSimulation.plot() with the kwarg coordinates="gnomonic" and an EBSDDetector with navigation_dimension > 1 fails with a ValueError.
Description of the change
Details: plot() calls as_collections(), which calls _zone_axes_as_collection() and _zone_axis_labels_as_list(). The ValueError comes from the definition of scatter_size in the "else" branch of _zone_axes_as_collection() AND because of the application of the y_offset to the "coords" in the "else" branch of _zone_axis_labels_as_list(). For an EBSDDetector with navigation_dimension > 1, the call np.diff(self.detector.x_range)[0] results in a 2D output, whereas a float is needed to calculate the offsets,
Solution: add the "index" to each of these lines so that the specific x_range and y_range for the pattern specified by "index" is chosen. Leave the "[0]" there so that we select a float rather than a np.ndarray. The case that a 1d detector is supplied together with a >1d rotation is also handled.
Progress of the PR
Minimal example of the bug fix or new feature
For reviewers
__init__.py
.section in
CHANGELOG.rst
.kikuchipy/__init__.py
and.zenodo.json
.