Navigate in custom map
Correlating results from e.g. crystal and phase structure determination, i.e.
indexing, with experimental patterns can inform their interpretation. When
calling plot()
without any input
parameters, the navigator map is a grey scale image with pixel values
corresponding to the sum of all detector intensities within that pattern:
However, any BaseSignal
object with a
two-dimensional signal_shape
corresponding to the scan navigation_shape
can be passed in to the navgiator
parameter in
plot()
, including a virtual image showing
diffraction contrast, any quality metric map, or an orientation map or a phase
map.
Virtual image
A virtual backscatter electron (VBSE) image created from any detector region of
interest with the get_virtual_image()
method, explained in the Virtual backscatter electron imaging section,
can be used as a navigator for a scan s
:
>>> import hyperspy.api as hs
>>> roi = hs.roi.RectangularROI(left=18, top=20, right=23, bottom=25)
>>> vbse = s.get_virtual_image(roi)
>>> s
<EBSD, title: Pattern_c, dimensions: (200, 149|60, 60)>
>>> vbse
<EBSD, title: Virtual Dark Field, dimensions: (|200, 149)>
>>> s.plot(navigator=vbse)
Any image
Images loaded into a Signal2D
object can be used as
navigators. E.g. a quality metric map, like the orientation similarity obtained
from dictionary indexing with EMsoft
(see e.g. [Marquardt2017]):
>>> import matplotlib.pyplot as plt
>>> import hyperspy.api as hs
>>> osm = plt.imread('path/to/orientation_similarity_map.png'))
>>> s_osm = hs.signals.Signal2D(osm)
>>> s_osm
<Signal2D, title: , dimensions: (|2140, 1603)>
>>> s_osm = s_osm.rebin(new_shape=s.axes_manager.navigation_shape)
>>> s_osm
<Signal2D, title: , dimensions: (|200, 149)>
>>> s.plot(navigator=s_osm)
Using colour images, e.g. an orientation om
or phase map, is a bit more
involved:
>>> om = plt.imread('/path/to/orientation_map.jpg')
>>> om_scaled = ske.rescale_intensity(om, out_range=np.uint8)
>>> s_om = hs.signals.Signal2D(om_scaled)
>>> s_om
<Signal2D, title: , dimensions: (149|3, 200)>
>>> s_om = s_om.transpose(signal_axes=1)
>>> print(s_om, s_om.data.dtype)
<Signal1D, title: , dimensions: (200, 149|3)> uint8
>>> s_om.change_dtype('rgb8')
>>> s_om
<Signal2D, title: , dimensions: (|200, 149)> [('R', 'u1'), ('G', 'u1'), ('B', 'u1')]
>>> s.plot(navigator=s_om)
Plot multiple scans
HyperSpy provides the function plot_signals()
to plot
multiple signals with the same navigator, as explained in the HyperSpy user
guide.
This enables e.g. plotting of experimental and simulated patterns side by side
as a visual inspection of the indexing results:
>>> import hyperspy.api as hs
>>> import h5py
>>> with h5py.File('/path/to/simulated_patterns/sim.h5', mode='r') as f:
patterns = f['EMData/EBSD/EBSDPatterns'][()]
>>> s_sim = kp.signals.EBSD(patterns.reshape(s.data.shape))
>>> hs.plot.plot_signals([s, s_sim], navigator=s_om)