master_from_emsoft#

de_ebsd.index.io.master_from_emsoft(path, device=None)[source]#

Load an EMsoft EBSD master-pattern HDF5 file as a de_ebsd MasterPattern.

Reads the square-Lambert masters EMData/EBSDmaster/mLPNH/mLPSH, summing their leading asymmetric-unit site axis (indexing only the first site is a known bug); an already-collapsed (n_energy, n, n) array is used as-is. All EkeVs energy bins are kept – pick one with SphericalIndexer(energy_kev=...).

CrystalData is rebuilt into a de_ebsd.crystal.Crystal and stashed in metadata["crystal"] so the indexer can auto-derive the phase. Atomic numbers map to symbols via ELEMENT_SYMBOLS[Z - 1], and the space-group setting (1 or 2) becomes Crystal(origin=...), defaulting to 2:

master = master_from_emsoft("Si_MC.h5")
xmap = SphericalIndexer(master, detector).index_scan(patterns, shape=shape)
Parameters:
path

Path to the EMsoft master-pattern HDF5 file.

device

Optional torch device the returned master is moved to.

Returns:
de_ebsd.sim.MasterPattern

data of shape (n_energy, 2, n, n) (axis 1 = hemisphere, north first), with metadata carrying "crystal", "dmin", "bethe" and "source". A missing or malformed CrystalData group leaves metadata["crystal_error"] instead, rather than sinking the whole load.