Skip to main content

Tools to model and estimate the contrast transfer function for transmission electron microscopy data

Project description

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.

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

contrasttransferfunction-0.0.1.tar.gz (5.2 MB view hashes)

Uploaded Source

Built Distribution

contrasttransferfunction-0.0.1-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

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