You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We rely on Gemmi for a lot of operations involving cryo-EM and crystallography maps and often have to interpolate many points fast. We are happy with the interpolate_value but we are confused about usage of the interpolate_values function. We often have a numpy array of 3D coordinates that we want to interpolate values for and a slow approach of doing this would be:
We couldn't understand how to use interpolate_values in this context for faster interpolation of an array of points. These points represent positions of atoms in a structure. My understanding is that interpolate_values will modify the input array to interpolate points at each position of the input:
However, we don't neccessarily want to interpolate over a grid that is the same shape as the map grid. Rather, we only want to interpolate an array of atomic coordinates. Is there a way to do this with interpolate_values?
Instead we ended up writing our own interpolation function to transform coordinates into the correct system but this doesn't handle NCS and crystallographic symmetry, like Gemmi's interpolate_value does:
importgemmiimportnumpyasnp# Use numpy broadcasting to transform the points and interpolate all the valuesdefinterpolate_values(arr: np.ndarray, trans_mat: np.ndarray) ->np.ndarray:
# do work...returnarr# Transformation matrix for moving to different coordinate systems e.g. fractionalizationtrans_mat=np.array([
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0]
])
dmap=gemmi.read_ccp4_map('map.mrc')
coords=np.array([[1.0, 1.1, 1.2], [2.0, 2.1, 2.2]])
interpolated=interpolate_values(coords, trans_mat)
However, we're reluctant to build all the logic needed for crystallographic and non-crystallographic symmetry. We would love to use Gemmi more throughout our pipelines and were wondering if there is already a good solution. Also happy to look into opening a pull request if this doesn't exist.
The text was updated successfully, but these errors were encountered:
We rely on Gemmi for a lot of operations involving cryo-EM and crystallography maps and often have to interpolate many points fast. We are happy with the
interpolate_value
but we are confused about usage of theinterpolate_values
function. We often have a numpy array of 3D coordinates that we want to interpolate values for and a slow approach of doing this would be:We couldn't understand how to use
interpolate_values
in this context for faster interpolation of an array of points. These points represent positions of atoms in a structure. My understanding is thatinterpolate_values
will modify the input array to interpolate points at each position of the input:gemmi/python/grid.cpp
Line 167 in fd70dfb
interpolate_values
?Instead we ended up writing our own interpolation function to transform coordinates into the correct system but this doesn't handle NCS and crystallographic symmetry, like Gemmi's
interpolate_value
does:However, we're reluctant to build all the logic needed for crystallographic and non-crystallographic symmetry. We would love to use Gemmi more throughout our pipelines and were wondering if there is already a good solution. Also happy to look into opening a pull request if this doesn't exist.
The text was updated successfully, but these errors were encountered: