Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. Simulate the patterns
    1. Create a text file with the best matching patterns' orientations using the EMsoft program EMgetEulers.
    2. Simulate the patterns using EMEBSD. This will create an HDF5 file (.h5) with the simulated patterns with the file size equal to the file size of experimental pattern file if patterns were simulated to 8-bit depth (0-255).
  2. Visualise the simulated and experimental patterns. The patterns can be read into KikuchiPy by for now (a reader for the simulated patterns will be created so the file can be loaded with the kikuchipy.load() function) using the following, followed by plotting the two data sets together, and if desired saving patterns of interest to file, using:

    import kikuchipy as kp
    import h5py
    import hyperspy.api as hs

    import matplotlib.pyplot as plt

    s = kp.load('/path/to/experimental/patterns/Pattern.dat')
    with h5py.File('/path/to/emebsd/file/simulated_patterns.h5', mode='r') as f:
        simulated_patterns = f['EMData/EBSD/EBSDPatterns][()]
    s_sim = kp.signals.EBSD(simulated_patterns.reshape(
    hs.plot.plot_signals([s, s_sim])
    x, y = (100, 100)  # Navigation indices for pattern of interest (the red letters when plotting)
    plt.imsave(fname='/path/to/place/single/patterns/into/pattern_exp.png', arr=s.inav[x, y].data)
    plt.imsave(fname='/path/to/place/single/patterns/into/pattern_sim.png', arr=s_sim.inav[x, y].data)