Skip to main content

Core functionality for local resolution estimation of cryo-EM half-maps

Project description

torch-local-resolution

Core functionality for local resolution estimation of cryo-EM half-maps.

Overview

torch-local-resolution estimates local resolution by computing the local cosine similarity between two bandpass-filtered half-maps. For each resolution shell, the correlation is measured within a sliding spherical window across the map. Statistical significance is assessed by comparing the observed correlations against a null distribution derived from phase-permuted or voxel-shuffled surrogates.

  • Supports 2D (single-slice) and 3D half-maps
  • Batched processing of multiple half-map pairs
  • Configurable resolution shells, window sizes, and step sizes
  • Statistical p-value maps or raw correlation output

Installation

This package is part of the TeamTomo monorepo. See the main repository README for development setup instructions.

Usage

import torch
from torch_local_resolution import estimate_local_resolution

# Load your half-maps as (B, Z, Y, X) tensors
# For 2D maps, set Z=1: (B, 1, Y, X)
half_map1 = torch.randn(1, 64, 64, 64)
half_map2 = torch.randn(1, 64, 64, 64)

# Define resolution shells and matching window radii
apix=1.0
resolutions = [10.0, 8.0, 6.0, 4.0]  # in Ångström
windows_radii = [10.5, 9.1, 7.2, 4.5]  # in voxels, one per shell

# Compute local resolution p-value map
pvalue_map = estimate_local_resolution(
    apix=apix,                    # voxel size in Å/pixel
    windows_radii=windows_radii,
    resolutions=resolutions,
    batch_half_map1=half_map1,
    batch_half_map2=half_map2,
    step_size=3,                 # stride between sampling points
    gpu_id=0,                   # use first CUDA device (None for CPU)
)

# To get raw correlation values instead of p-values
correlation_map = estimate_local_resolution(
    apix=1.0,
    windows_radii=windows_radii,
    resolutions=resolutions,
    batch_half_map1=half_map1,
    batch_half_map2=half_map2,
    step_size=3,
    gpu_id=0,
    skip_statistics=True,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch_local_resolution-0.5.2.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_local_resolution-0.5.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file torch_local_resolution-0.5.2.tar.gz.

File metadata

  • Download URL: torch_local_resolution-0.5.2.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for torch_local_resolution-0.5.2.tar.gz
Algorithm Hash digest
SHA256 fcf07fde220bcadbbf0f3e89ff9871818544281039b64e3767f8d51325c60acb
MD5 d391dfcc2478afe0e782dcc8ab42ec1a
BLAKE2b-256 8072d0fda66db192dd1204d2b899f0493d71bee67cc6e6c1fd2df00e765e4be4

See more details on using hashes here.

Provenance

The following attestation bundles were made for torch_local_resolution-0.5.2.tar.gz:

Publisher: deploy.yml on teamtomo/teamtomo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torch_local_resolution-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for torch_local_resolution-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a6c16e7c064953242d18d5753ff7562318a2ed220cf1ddd0b3f1031f062b467
MD5 a38540a503db6be56c354f16ea582ed2
BLAKE2b-256 0009a0a5e5190b9895bc15a1fbbd59ac13d22b66eca311065b93601fbe12251f

See more details on using hashes here.

Provenance

The following attestation bundles were made for torch_local_resolution-0.5.2-py3-none-any.whl:

Publisher: deploy.yml on teamtomo/teamtomo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page