torch-ctf-estimation
Contrast transfer function estimation for cryo-EM images in PyTorch.
Overview
torch-ctf-estimation fits defocus, astigmatism, and (optionally) sample
thickness from a micrograph power spectrum.
- 1D defocus on the mean spectrum, then 2D defocus / astigmatism on patches
- Spatial defocus as a spline grid or a linear tilt model
- 1D thickness grid search against a thickness-modulated CTF, with optional joint defocus+thickness refinement (1D scalar or 2D field)
- Laser phase plate (LPP) CTF support via
torch-ctf
This package is the algorithm: estimate_ctf (defocus only) and
estimate_ctf_and_thickness (defocus + thickness) are self-contained
compositions of the lower-level primitives, usable directly from notebooks,
tests, or another program. Downstream tools can chain these primitives
differently and add optics / metrics file I/O.
Installation
This package is part of the TeamTomo monorepo. See the main repository README for development setup instructions.
Usage
import torch
from torch_ctf_estimation import estimate_ctf
from torch_ctf_estimation.models import CTFFittingParams, OpticalParams
image = torch.randn(1024, 1024)
optical = OpticalParams(
pixel_spacing_angstroms=1.0,
voltage_kev=300.0,
spherical_aberration_mm=2.7,
amplitude_contrast_fraction=0.07,
)
fitting = CTFFittingParams(
defocus_grid_resolution=(1, 3, 3),
frequency_fit_range_angstroms=(30.0, 5.0),
defocus_range_microns=(0.5, 5.0),
patch_sidelength=128,
)
mean_ps, result1d, result2d = estimate_ctf(image, optical, fitting)
To also estimate sample thickness, use estimate_ctf_and_thickness with a
ThicknessParams:
from torch_ctf_estimation import estimate_ctf_and_thickness
from torch_ctf_estimation.models import ThicknessParams
thickness = ThicknessParams(refine_dim="2d")
result = estimate_ctf_and_thickness(image, optical, fitting, thickness)
result.result2d, result.thickness1d, result.thickness_joint
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_ctf_estimation-0.6.0.tar.gz.
File metadata
- Download URL: torch_ctf_estimation-0.6.0.tar.gz
- Upload date:
- Size: 74.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0406658309b479b47837b41b91cd3e0eaac0124e95e6eea53471f668f4b75b04
|
|
| MD5 |
17a0d1521ae9017a301be7cb909f5746
|
|
| BLAKE2b-256 |
ec72a34fe89d5c83fc7b765e2cbb4d022fad16a06ace2262b87daf304b2aed32
|
Provenance
The following attestation bundles were made for torch_ctf_estimation-0.6.0.tar.gz:
Publisher:
deploy.yml on teamtomo/teamtomo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_ctf_estimation-0.6.0.tar.gz -
Subject digest:
0406658309b479b47837b41b91cd3e0eaac0124e95e6eea53471f668f4b75b04 - Sigstore transparency entry: 2798485846
- Sigstore integration time:
-
Permalink:
teamtomo/teamtomo@181e7dd30d6548fa65ca93e887f4aaee5af438eb -
Branch / Tag:
refs/tags/teamtomo@v0.6.0 - Owner: https://github.com/teamtomo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@181e7dd30d6548fa65ca93e887f4aaee5af438eb -
Trigger Event:
push
-
Statement type:
File details
Details for the file torch_ctf_estimation-0.6.0-py3-none-any.whl.
File metadata
- Download URL: torch_ctf_estimation-0.6.0-py3-none-any.whl
- Upload date:
- Size: 89.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48a134c7d2d18a6d82ffe316d685bc53af33af16657c45078d8a8ae75cbaaa9d
|
|
| MD5 |
b8c8e354a78b48bf0e83313e2ff6afe4
|
|
| BLAKE2b-256 |
4866ab90beb8c5095f975b22526a43682c4d9423754a6d8f863f9e13fd0f31bf
|
Provenance
The following attestation bundles were made for torch_ctf_estimation-0.6.0-py3-none-any.whl:
Publisher:
deploy.yml on teamtomo/teamtomo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_ctf_estimation-0.6.0-py3-none-any.whl -
Subject digest:
48a134c7d2d18a6d82ffe316d685bc53af33af16657c45078d8a8ae75cbaaa9d - Sigstore transparency entry: 2798485938
- Sigstore integration time:
-
Permalink:
teamtomo/teamtomo@181e7dd30d6548fa65ca93e887f4aaee5af438eb -
Branch / Tag:
refs/tags/teamtomo@v0.6.0 - Owner: https://github.com/teamtomo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@181e7dd30d6548fa65ca93e887f4aaee5af438eb -
Trigger Event:
push
-
Statement type: