def test_vdf_generator_from_map(diffraction_pattern): dvm = DiffractionVectors( np.array( [[np.array([[1, 1], [2, 2]]), np.array([[1, 1], [2, 2], [1, 2]])], [np.array([[1, 1], [2, 2]]), np.array([[1, 1], [2, 2]])]], dtype=object)) dvm.axes_manager.set_signal_dimension(0) vdfgen = VDFGenerator(diffraction_pattern, dvm) assert isinstance(vdfgen, VDFGenerator)
def test_vdf_generator_init_with_vectors(self, diffraction_pattern): dvm = DiffractionVectors( np.array([[ np.array([[1, 1], [2, 2]]), np.array([[1, 1], [2, 2], [1, 2]]) ], [np.array([[1, 1], [2, 2]]), np.array([[1, 1], [2, 2]])]], dtype=object)) dvm.axes_manager.set_signal_dimension(0) vdfgen = VDFGenerator(diffraction_pattern, dvm) assert isinstance(vdfgen.signal, ElectronDiffraction2D) assert isinstance(vdfgen.vectors, DiffractionVectors)
def vdf_generator_seg(signal_data, unique_vectors): return VDFGenerator(signal_data, unique_vectors)
def vdf_segments(signal_data, unique_vectors): vdfgen = VDFGenerator(signal_data, unique_vectors) vdfs = vdfgen.get_vector_vdf_images(radius=1) return vdfs.get_vdf_segments()
def test_vector_vdfs_without_vectors(self, diffraction_pattern): vdfgen = VDFGenerator(diffraction_pattern) vdfgen.get_vector_vdf_images(radius=2.)
def test_vdf_generator_init_without_vectors(self, diffraction_pattern): vdfgen = VDFGenerator(diffraction_pattern) assert isinstance(vdfgen.signal, ElectronDiffraction2D) assert isinstance(vdfgen.vectors, type(None))
def vdf_generator(diffraction_pattern, diffraction_vectors): diffraction_pattern.data = np.where( diffraction_pattern.data == 0, 0.01, diffraction_pattern.data) #avoid divide by zeroes return VDFGenerator(diffraction_pattern, diffraction_vectors)
def test_vector_vdfs_without_vectors(self, diffraction_pattern): vdfgen = VDFGenerator(diffraction_pattern) with pytest.raises(ValueError, match="DiffractionVectors not specified by user"): vdfgen.get_vector_vdf_images(radius=2.0)
def vdf_generator(diffraction_pattern, diffraction_vectors): return VDFGenerator(diffraction_pattern, diffraction_vectors)