tomodrgn.analysis.convert_angstroms_to_voxels#

convert_angstroms_to_voxels(df: DataFrame, tomogram_array_shape: tuple[int, int, int], tomo_pixelsize: float, starfile_pixelsize: float = 1) DataFrame[source]#

Rescale dataframe coordinates from angstroms to unitless voxels corresponding to reconstructed tomograms. A starfile (loaded as a dataframe) expresses the 3-D coordinate of each particle typically in either Ångstroms or in pixels (with a pixel size set at particle extraction time). In subsequent operations we will wish to plot particle locations superimposed on tomogram voxel data. This requires rescaling the particle coordinates from units of Ångstroms or extraction-sized-pixels to tomogram-sized-voxels.

Parameters:
  • df – dataframe containing particle coordinates to rescale

  • tomogram_array_shape – shape of reconstructed tomogram in voxels

  • tomo_pixelsize – pixel size of reconstructed tomogram in Å/px

  • starfile_pixelsize – pixel size of particles at extraction time when writing the star file from which df was loaded. Note: star files produced from particle extraction in M always have pixel size 1 Å/px.

Returns:

dataframe with rescaled coordinates aligned to the tomogram voxel array