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

Fix merging of maps with non-indexed points and release v0.8.5 #639

Merged
merged 5 commits into from
May 21, 2023

Conversation

hakonanes
Copy link
Member

Description of the change

Fixes #637.

@Erlendos12, can you test this branch in EBSP Indexer against your problem reported in #637 for me?

Progress of the PR

Minimal example of the bug fix or new feature

Create two crystal maps with some points considered not-indexed, only some of them not-indexed in both maps

import kikuchipy as kp
import numpy as np
from orix.crystal_map import CrystalMap
from orix.quaternion import Rotation


xmap_a = CrystalMap.empty((4, 3))
xmap_a.phases[0].name = "a"
is_indexed_a = np.array([[1, 1, 0], [1, 0, 1], [0, 1, 1], [0, 1, 1]], dtype=bool).ravel()
xmap_a.phases.add_not_indexed()
xmap_a[~is_indexed_a].phase_id = -1
xmap_a.prop["scores"] = np.array([[2, 2, 0], [3, 0, 4], [0, 4, 3], [0, 2, 1]], dtype=float).ravel()

xmap_b = CrystalMap.empty((4, 3))
xmap_b.phases[0].name = "b"
is_indexed_b = np.array([[1, 1, 0], [1, 1, 1], [0, 1, 1], [0, 1, 0]], dtype=bool).ravel()
xmap_b.phases.add_not_indexed()
xmap_b[~is_indexed_b].phase_id = -1
xmap_b.prop["scores"] = np.array([[3, 1, 0], [2, 1, 5], [0, 2, 4], [0, 1, 0]], dtype=float).ravel()

xmap_ab = kp.indexing.merge_crystal_maps([xmap_a, xmap_b])

print(xmap_ab)
# Before:
# Phase  Orientations         Name  Space group  Point group  Proper point group       Color
#     0   12 (100.0%)  not_indexed         None         None                None      w
# Properties: scores, merged_scores
# Scan unit: px

# Now:
# Phase  Orientations         Name  Space group  Point group  Proper point group       Color
#    -1     3 (25.0%)  not_indexed         None         None                None           w
#     0     5 (41.7%)            a         None         None                None    tab:blue
#     1     4 (33.3%)            b         None         None                None  tab:orange
# Properties: scores, merged_scores
# Scan unit: px

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 CHANGELOG.rst.
  • New contributors are added to release.py, .zenodo.json and
    .all-contributorsrc with the table regenerated.

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 added bug Something isn't working maintenance This relates to package maintenance labels May 20, 2023
@hakonanes hakonanes added this to the v0.8.5 milestone May 20, 2023
@Erlendos12
Copy link
Contributor

@Erlendos12, can you test this branch in EBSP Indexer against your problem reported in #637 for me?

Thanks! Checking it out now, will let you know by the end of the day.

@Erlendos12
Copy link
Contributor

@Erlendos12, can you test this branch in EBSP Indexer against your problem reported in #637 for me?

Thanks! Checking it out now, will let you know by the end of the day.

I can confirm that the branch fixes our problem in #637, @hakonanes 👍

@hakonanes
Copy link
Member Author

Fantastic, thank you for checking. I'll release v0.8.5 later today.

@hakonanes hakonanes merged commit d5e1236 into pyxem:main May 21, 2023
10 checks passed
@hakonanes hakonanes deleted the fix-637 branch May 21, 2023 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maintenance This relates to package maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merging crystal maps with not_indexed points results in removal of phase
2 participants