Open maclariz opened 2 years ago
Can you explain what you mean by "maps" in terms of rotations (axis/angle pairs)? You mean giving the axes [uvw] in the inverse pole figure of a symmetry a color, like for orientations?
Masking of maps are most easily done with boolean arrays and CrystalMap
, see examples of this a bit down in the "Crystal map/Plotting" section of the tutorial in the docs.
Rotational color scale would be nice, but I haven't considered this at all myself, and don't have time to unfortunately. I'd be happy to help review a pull request.
Plot a vector from a AxAngle object with a colour given by an pole figure key. Ci symmetry would sensible, as the vector could point anywhere.
@hakonanes I managed the blacking out with the data via the following:
I don't know if you can create extra keys on the fly
Yes, you can. How to do that is detailed in the above referenced tutorial in its own section, "Map properties".
Useful to know!
Also detailed is how to set some data to "not indexed" in the tutorial, which then will not be included when accessing properties like CrystalMap.rotations
etc. or when plotting. What I'm saying is that I think all the tools you want are available in the CrystalMap class.
xmap.phases.add_not_indexed() seems to do nothing on my data
That's strange. The general procedure for marking some data as not indexed I usually use is as follows:
>>> from orix import data
>>> xmap = data.sdss_ferrite_austenite(allow_download=True)
Downloading file 'sdss/sdss_ferrite_austenite.ang' from 'https://github.com/pyxem/orix-data/raw/main/sdss_ferrite_austenite/sdss_ferrite_austenite.ang' to '/home/hakon/.cache/orix/0.9.0.post0'.
100%|████████████████████████████████████████| 192k/192k [00:00<00:00, 183MB/s]
# Inspect data and phase map
>>> xmap
Phase Orientations Name Space group Point group Proper point group Color
1 5657 (48.4%) austenite None 432 432 tab:blue
2 6043 (51.6%) ferrite None 432 432 tab:orange
Properties: iq, dp
Scan unit: um
>>> xmap.plot()
EDIT: The following original figure contained not-indexed pixels, that was incorrect. Here's the correct figure:
# Inspect values to remove (low image quality)
>>> xmap.plot("iq", colorbar=True)
>>> xmap[xmap.iq < 20]
Phase Orientations Name Space group Point group Proper point group Color
1 392 (69.0%) austenite None 432 432 tab:blue
2 176 (31.0%) ferrite None 432 432 tab:orange
Properties: iq, dp
Scan unit: um
# Add "special" not-indexed phase to data
>>> xmap.phases
Id Name Space group Point group Proper point group Color
1 austenite None 432 432 tab:blue
2 ferrite None 432 432 tab:orange
>>> xmap.phases.add_not_indexed()
>>> xmap.phases
Id Name Space group Point group Proper point group Color
-1 not_indexed None None None w
1 austenite None 432 432 tab:blue
2 ferrite None 432 432 tab:orange
# Mark values below threshold as not indexed
>>> xmap[xmap.iq < 20].phase_id = -1
>>> xmap
Phase Orientations Name Space group Point group Proper point group Color
-1 568 (4.9%) not_indexed None None None w
1 5265 (45.0%) austenite None 432 432 tab:blue
2 5867 (50.1%) ferrite None 432 432 tab:orange
Properties: iq, dp
Scan unit: um
>>> xmap.plot()
@hakonanes Yes, strange, but not really any trouble. I just created a new prop called "indexed" and marked 0 or 1 depending on whether below or above the threshold. And then used that to set things. Works pretty nicely.
It would be nice to be able to plot the axis/angle pairs nicely as maps. I have the angles out and plotted, although blacking out the bits where there is no data (e.g. vacuum) would make this nicer still. I am still trying to figure out a way to get the axes in a plottable form on a rational color scale.