tomodrgn.utils.calc_cc#
- calc_cc(vol1: ndarray | str, vol2: ndarray | str, mask: str | None = None, thresh: int = 99, dilate: int | None = None, dist: int | None = None) float [source]#
Helper function to calculate the zero-mean correlation coefficient as defined in eq 2 in https://journals.iucr.org/d/issues/2018/09/00/kw5139/index.html vol1 and vol2 should be maps of the same box size, shape (boxsize, boxsize, boxsize)
- Parameters:
vol1 – path to volume1.mrc, boxsize D,D,D, or ndarray of vol1 voxels
vol2 – path to volume2.mrc, boxsize D,D,D, or ndarray of vol2 voxels
mask – mask to calculate from volumes, one of [None, ‘sphere’, ‘tight’, ‘soft’]
thresh – data percentile threshold at which to binarize mask when calculating ‘tight’ or initializing ‘soft’ masks
dilate – for soft mask, number of pixels to expand auto-determined tight mask
dist – for soft mask, number of pixels over which to apply soft edge
- Returns:
correlation coefficient