This notebook is part of the kikuchipy
documentation https://kikuchipy.org.
Links to the documentation won't work from the notebook.
Warning
The Acquisition_instrument.SEM.Detector.EBSD
and Sample.Phases
metadata
nodes are deprecated and will be removed in v0.6.
There are three main reasons for this change: the first is that only the static
background array stored in the
Acquisition_instrument.SEM.Detector.EBSD.static_background
node is used
internally, and so the remaining metadata is unnecessary. The background pattern
will be stored in its own EBSD.static_background
property instead. The second
is that keeping track of the unnecessary metadata makes writing and maintaining
input/ouput plugins challenging. The third is that the
EBSD.xmap and
EBSD.detector properties,
which keeps track of the
CrystalMap
and EBSDDetector for a
signal, respectively, should be used instead of the more "static" metadata.
The EBSD class stores metadata in the
metadata
attribute provided by HyperSpy
# Exchange inline for notebook or qt5 (from pyqt) for interactive plotting
%matplotlib inline
import matplotlib.pyplot as plt
import kikuchipy as kp
s = kp.data.nickel_ebsd_small()
s
s.metadata
While kikuchipy's EBSD
(ebsd_metadata()) metadata
structure is based on
HyperSpy's metadata structure,
it includes the nodes Acquisition_instrument.Sample.Phases
to store phase
information and Acquisition_instrument.SEM.Detector.EBSD
for acquisition
information. The information in these nodes are written, along with the
patterns, to file when saving an EBSD signal in the
kikuchipy h5ebsd format.
kp.signals.util.ebsd_metadata()
The complete list of metadata looks like this
├── Acquisition_instrument
│ └── SEM
│ ├── Detector
│ │ └── EBSD
│ │ ├── azimuth_angle [º]
│ │ ├── binning
│ │ ├── detector
│ │ ├── elevation_angle [º]
│ │ ├── exposure_time [s]
│ │ ├── frame_number
│ │ ├── frame_rate [1/s]
│ │ ├── gain [dB]
│ │ ├── grid_type
│ │ ├── manufacturer
│ │ ├── sample_tilt [º]
│ │ ├── scan_time [s]
│ │ ├── static_background (numpy.ndarray)
│ │ ├── version
│ │ ├── xpc
│ │ ├── ypc
│ │ └── zpc
│ ├── beam_energy [kV]
│ ├── magnification
│ ├── microscope
│ └── working_distance [mm]
└── Sample
└── Phases
└── 1
├── atom_coordinates
│ └── 1
│ ├── atom
│ ├── coordinates (x0, y0, z0)
│ ├── debye_waller_factor [nm^2]
│ └── site_occupation
├── formula
├── info
├── lattice_constants (a, b, c and alfa, beta, gamma) [nm and º]
├── laue_group
├── material_name
├── point_group
├── setting
├── source
├── space_group
└── symmetry
The utility function
metadata_nodes() returns
the node strings for the SEM
and EBSD
nodes for convenience.
Note
If you regularly use information relevant to EBSD data not included in the metadata structure, you can request this in our issue tracker.
sem_node, ebsd_node = kp.signals.util.metadata_nodes()
print(sem_node, ebsd_node)
s.metadata.get_item(f"{ebsd_node}.xpc")
plt.imshow(s.metadata.get_item(f"{ebsd_node}.static_background"), cmap="gray")
_ = plt.axis("off")
This node contains information relevant for EBSD data. All parameters can be set with the method set_experimental_parameters(). An explanation of each parameter is given in the method's docstring.
s.set_experimental_parameters(xpc=5.64)
s.metadata.get_item(f"{ebsd_node}.xpc")
This node contains information relevant for EBSD scans or simulated patterns' phases. All parameters can be set with the EBSD class method set_phase_parameters(). An explanation of each parameter is given in the methods' docstring.
s.metadata.Sample.Phases
s.set_phase_parameters(info="Polycrystalline")
s.metadata.Sample.Phases