.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/creating_a_simulation_library/migration_guide.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_creating_a_simulation_library_migration_guide.py: 0.5.x --> 0.6.x Migration Guide =============================== This is a migration guide for version 0.5.x to 0.6.x. This guide helps to show the changes that were made to the API and how to update your code to use the new API. Here you can see how to make an equivalent to a diffraction library Old --- .. GENERATED FROM PYTHON SOURCE LINES 12-42 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from diffpy.structure import Atom, Lattice, Structure from diffsims.libraries.structure_library import StructureLibrary from diffsims.generators.diffraction_generator import DiffractionGenerator from diffsims.generators.library_generator import DiffractionLibraryGenerator latt = Lattice(4, 4, 4, 90, 90, 90) atoms = [ Atom(atype="Al", xyz=[0.0, 0.0, 0.0], lattice=latt), Atom(atype="Al", xyz=[0.5, 0.5, 0.0], lattice=latt), Atom(atype="Al", xyz=[0.5, 0.0, 0.5], lattice=latt), Atom(atype="Al", xyz=[0.0, 0.5, 0.5], lattice=latt), ] structure_matrix = Structure(atoms=atoms, lattice=latt) euler_angles = np.array([[0, 0, 0], [10.0, 0.0, 0.0]]) struct_library = StructureLibrary(["Al"], [structure_matrix], [euler_angles]) diff_gen = DiffractionGenerator(accelerating_voltage=200) lib_gen = DiffractionLibraryGenerator(diff_gen) diff_lib = lib_gen.get_diffraction_library( struct_library, calibration=0.0262, reciprocal_radius=1.6768, half_shape=64, with_direct_beam=True, max_excitation_error=0.02, ) .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/2 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: migration_guide.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: migration_guide.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_