Skip to content

A python library to model and estimate the contrast transfer function of transmission electron microscopy data

License

Notifications You must be signed in to change notification settings

jojoelfe/contrasttransferfunction

Repository files navigation

contrasttransferfunction

PyPI - Version PyPI - Python Version


contrasttransferfunction is a python library to model and estimate the contrast transfer function for transmission electron microscopy data. The library is designed to:

  • Follow CTFFIND conventions and algorithms as much as possible
  • Be highly compatible by using pure python, no compiled code
  • Stay fast by using numpy vectorization

Installation

pip install contrasttransferfunction

Examples

Plot 1D powerspectrum

from contrasttransferfunction import ContrastTransferFunction
import matplotlib.pyplot as plt

myctf = ContrastTransferFunction(
    defocus1_angstroms = 8000,
    pixel_size_angstroms = 2.3
)

plt.plot(myctf.frequency_angstroms_1d, myctf.powerspectrum_1d)
plt.gca().xaxis.set_major_formatter(lambda x, pos: f"{1/x:.1f}Å")
plt.xlabel("Spatial resultion (A)")

Plot 2D powerspectrum

myctf = ContrastTransferFunction(
    defocus1_angstroms = 8000,
    defocus2_angstroms= 6000,
    defocus_angle_degrees=25.3,
    pixel_size_angstroms = 2.3
)
plt.imshow(myctf.powerspectrum_2d,cmap="Greys")

License

contrasttransferfunction is distributed under the terms of the MIT license.

About

A python library to model and estimate the contrast transfer function of transmission electron microscopy data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages