From 35d09d5a253b7b0073f02f636c80d9f7062f8d34 Mon Sep 17 00:00:00 2001 From: Gerd Duscher <50049264+gduscher@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:44:14 -0400 Subject: [PATCH] Update graph_tools.py --- pyTEMlib/graph_tools.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyTEMlib/graph_tools.py b/pyTEMlib/graph_tools.py index b5bcf981..8ae76ec3 100644 --- a/pyTEMlib/graph_tools.py +++ b/pyTEMlib/graph_tools.py @@ -8,6 +8,7 @@ # from scipy.spatial import cKDTree, Voronoi, ConvexHull import scipy.spatial import scipy.optimize +import scipy.interpolate from skimage.measure import grid_points_in_poly, points_in_poly @@ -139,10 +140,13 @@ def get_bond_radii(atoms, bond_type='bond'): r_a = [] for atom in atoms: - if bond_type == 'covalent': - r_a.append(pyTEMlib.crystal_tools.electronFF[atom.symbol]['bond_length'][0]) + if atom.symbol == 'X': + r_a.append(1.2) else: - r_a.append(pyTEMlib.crystal_tools.electronFF[atom.symbol]['bond_length'][1]) + if bond_type == 'covalent': + r_a.append(pyTEMlib.crystal_tools.electronFF[atom.symbol]['bond_length'][0]) + else: + r_a.append(pyTEMlib.crystal_tools.electronFF[atom.symbol]['bond_length'][1]) if atoms.info is None: atoms.info = {} atoms.info['bond_radii'] = r_a @@ -911,7 +915,7 @@ def undistort(distortion_matrix, image_data): grid_x, grid_y = np.mgrid[0:size_x - 1:size_x * 1j, 0:size_y - 1:size_y * 1j] print('interpolate') - interpolated = griddata(np.array(corrected), np.array(intensity_values), (grid_x, grid_y), method='linear') + interpolated = scipy.interpolate.griddata(np.array(corrected), np.array(intensity_values), (grid_x, grid_y), method='linear') return interpolated