pyxem / kikuchipy

Toolbox for analysis of electron backscatter diffraction (EBSD) patterns
https://kikuchipy.org
GNU General Public License v3.0
78 stars 30 forks source link

Keeping not_indexed dummy phase after orientation refinement #622

Closed hakonanes closed 1 year ago

hakonanes commented 1 year ago

Discussed in https://github.com/pyxem/kikuchipy/discussions/621

Originally posted by **Erlendos12** March 9, 2023 Hough indexing may assign the dummy phase "not_indexed". How would I keep (or deal with it) when refining orientations? I have explored 3 alternatives where neither works. 1. Keeping it while refining orientations is not possible, as it is not allowed to have multiple phases present. 2. Adding the not_indexed points in the crystal map when merging with the refined ones is not possible, because they contain no "scores" attribute. 3. I then tried adding the not_indexed phase to the refined crystal map, which would be present when doing refined_xmap.phases, but not when doing refined_xmap or refined_xmap.phases_in_data. I also tried manually setting the phase id of the points which were not indexed, however it did still not update. Here is the code: ```python ref_xmap.phases.add_not_indexed() if not xmap.all_indexed: for x in range(xmap.shape[0]): for y in range(xmap.shape[1]): if not xmap[x,y].is_indexed.any(): print("Adding not indexed") ref_xmap[x,y].phase_id = -1 ``` I know this is more related to orix than kikuchipy, but any ideas on how to keep not_indexed phase in the refined crystal map?

@Erlendos12, The issue is that the points considered "not indexed" become "not in the data" in a refined map, while you would like them to stay "not indexed", correct?

I did not consider this detail when creating the tools for refinement of multi-phase maps... Thank you for bringing it up here! So that I'm 100% sure of the problem, could you send me a notebook or script with your workflow, so that I can create a fix that solves your particular problem?

Don't know how quickly I myself can fix this and release a patch. But hopefully within the next couple weeks.

Erlendos12 commented 1 year ago

@hakonanes Sure! Should I email the code to you?

hakonanes commented 1 year ago

If it's just code and you're OK with posting it here, I suggest that. If not you can send it over email.

Erlendos12 commented 1 year ago

Think I will send them by email, so you also have access to the files I used.

hakonanes commented 1 year ago

I'm working towards fixing this bug in #632. I'm hopeful that a patch release will be available later next week.

hakonanes commented 1 year ago

This shouldn't be an issue anymore in just released 0.8.4!