Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
peaks : array
Coordinates of peaks in the matching results object in calibrated units.
"""
best_fit = get_nth_best_solution(single_match_result, rank=rank)
phase_names = list(library.keys())
phase_index = int(best_fit[0])
phase = phase_names[phase_index]
try:
simulation = library.get_library_entry(
phase=phase,
angle=tuple(best_fit[1]))['Sim']
except ValueError:
structure = library.structures[phase_index]
rotation_matrix = euler2mat(*np.deg2rad(best_fit[1]), 'rzxz')
simulation = simulate_rotated_structure(
library.diffraction_generator,
structure,
rotation_matrix,
library.reciprocal_radius,
library.with_direct_beam)
peaks = simulation.coordinates[:, :2] # cut z
return peaks
Diffraction library containing the phases and rotations
rank : int
Get peaks from nth best orientation (default: 0, best vector match)
Returns
-------
peaks : ndarray
Coordinates of peaks in the matching results object in calibrated units.
"""
best_fit = get_nth_best_solution(single_match_result, rank=rank)
phase_index = best_fit.phase_index
rotation_matrix = best_fit.rotation_matrix
# Don't change the original
structure = library.structures[phase_index]
sim = simulate_rotated_structure(
library.diffraction_generator,
structure,
rotation_matrix,
library.reciprocal_radius,
with_direct_beam=False)
# Cut z
return sim.coordinates[:, :2]