find_occupied_voxels

macromol_voxelize.find_occupied_voxels(atoms: DataFrame, grid: Grid)[source]

Return a multi-dimensional slice containing only those voxels that could be occupied by an atom.

Parameters:
  • atoms – See image_from_atoms().

  • grid – An object specifying the size and location of each voxel.

Returns:

A tuple of slice objects. This tuple can be directly used to index into a numpy array.

This function can be useful for comparing a small part of a structure, e.g. a single residue, to a larger image. The returned slices can quickly get rid of most of the uninteresting voxels, allowing any calculations involving the remaining voxels to complete much faster.