def test_load_hspy_Signal2D(make_saved_Signal2D): """ This tests that we can "load a Signal2D" with pxm.load and that we auto cast safetly into ElectronDiffraction2D """ dp = pxm.load_hspy('S2D_temp.hspy', assign_to='electron_diffraction2d') assert dp.metadata.Signal.signal_type == 'electron_diffraction2d' assert dp.metadata.Signal.tracker == 'make_save_Signal2D'
def test_load_hspy_Signal2D_not_pyxem(make_saved_Signal2D): """ This tests that we can "load a Signal2D" with pxm.load and that we auto cast safetly into ElectronDiffraction2D """ dp = pxm.load_hspy('S2D_temp.hspy', assign_to='not_pyxem_signal')
## create crystall structure from CIF files aug = diffpy.structure.loadStructure('augite.cif') pig = diffpy.structure.loadStructure('pigeonite.cif') structure_library_generator = StructureLibraryGenerator( [('Aug', aug, 'monoclinic'), ('Pig', pig, 'monoclinic')]) in_plane_rotation = [(0,), (0,)] angular_resolution = 1 structure_library = structure_library_generator.get_orientations_from_stereographic_triangle( in_plane_rotation, # In-plane rotations angular_resolution) # Angular resolution of the library ### load fft and set as ElectronDiffraction2D im = pxm.load_hspy(dps.loc[image,'dp']) dp = pxm.ElectronDiffraction2D(im.data) dp.set_diffraction_calibration(im.axes_manager['kx'].scale) dp.set_scan_calibration(im.axes_manager['x'].scale) pattern_size = dp.axes_manager['x'].size calibration = dp.axes_manager['kx'].scale diffraction_calibration = calibration half_pattern_size = pattern_size // 2 reciprocal_radius = diffraction_calibration*(half_pattern_size - 1) beam_energy = 300.0 ediff = DiffractionGenerator(beam_energy, 0.025)