Skip to main content

Point Spread Function calculations for fluorescence microscopy

Project description

Psf is a Python library to calculate Point Spread Functions (PSF) for fluorescence microscopy.

The psf library is no longer actively developed.

Author:

Christoph Gohlke

License:

BSD 3-Clause

Version:

2024.4.24

Quickstart

Install the psf package and all dependencies from the Python Package Index:

python -m pip install -U psf[all]

See Examples for using the programming interface.

Source code and support are available on GitHub.

Requirements

This revision was tested with the following requirements and dependencies (other versions may work):

Revisions

2024.4.24

  • Support NumPy 2.

2024.1.6

  • Change PSF.TYPES from dict to set (breaking).

2023.4.26

  • Use enums.

  • Derive Dimensions from UserDict.

  • Add type hints.

  • Convert to Google style docstrings.

  • Drop support for Python 3.8 and numpy < 1.21 (NEP29).

2022.9.26

  • Fix setup.py.

2022.9.12

  • Remove support for Python 3.7 (NEP 29).

  • Update metadata.

2021.6.6

  • Remove support for Python 3.6 (NEP 29).

2020.1.1

  • Remove support for Python 2.7 and 3.5.

  • Update copyright.

2019.10.14

  • Support Python 3.8.

2019.4.22

  • Fix setup requirements.

  • Fix compiler warning.

References

  1. Electromagnetic diffraction in optical systems. II. Structure of the image field in an aplanatic system. B Richards and E Wolf. Proc R Soc Lond A, 253 (1274), 358-379, 1959.

  2. Focal volume optics and experimental artifacts in confocal fluorescence correlation spectroscopy. S T Hess, W W Webb. Biophys J (83) 2300-17, 2002.

  3. Electromagnetic description of image formation in confocal fluorescence microscopy. T D Viser, S H Wiersma. J Opt Soc Am A (11) 599-608, 1994.

  4. Photon counting histogram: one-photon excitation. B Huang, T D Perroud, R N Zare. Chem Phys Chem (5), 1523-31, 2004. Supporting information: Calculation of the observation volume profile.

  5. Gaussian approximations of fluorescence microscope point-spread function models. B Zhang, J Zerubia, J C Olivo-Marin. Appl. Optics (46) 1819-29, 2007.

  6. The SVI-wiki on 3D microscopy, deconvolution, visualization and analysis. https://svi.nl/NyquistRate

Examples

>>> import psf
>>> args = dict(
...     shape=(32, 32),
...     dims=(4, 4),
...     ex_wavelen=488,
...     em_wavelen=520,
...     num_aperture=1.2,
...     refr_index=1.333,
...     pinhole_radius=0.55,
...     pinhole_shape='round'
... )
>>> obsvol = psf.PSF(psf.GAUSSIAN | psf.CONFOCAL, **args)
>>> obsvol.sigma.ou
(2.588..., 1.370...)
>>> obsvol = psf.PSF(psf.ISOTROPIC | psf.CONFOCAL, **args)
>>> print(obsvol, end='')
PSF
 ISOTROPIC|CONFOCAL
 shape: (32, 32) pixel
 dimensions: (4.00, 4.00) um, (55.64, 61.80) ou, (8.06, 8.06) au
 excitation wavelength: 488.0 nm
 emission wavelength: 520.0 nm
 numeric aperture: 1.20
 refractive index: 1.33
 half cone angle: 64.19 deg
 magnification: 1.00
 underfilling: 1.00
 pinhole radius: 0.550 um, 8.498 ou, 1.1086 au, 4.40 px
 computing time: ... ms
>>> obsvol[0, :3]
array([1.     , 0.51071, 0.04397])
>>> # write the image plane to file
>>> obsvol.slice(0).tofile('_test_slice.bin')
>>> # write a full 3D PSF volume to file
>>> obsvol.volume().tofile('_test_volume.bin')

Refer to psf_example.py in the source distribution for more examples.

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

psf-2024.4.24.tar.gz (26.9 kB view hashes)

Uploaded Source

Built Distributions

psf-2024.4.24-cp312-cp312-win_arm64.whl (28.9 kB view hashes)

Uploaded CPython 3.12 Windows ARM64

psf-2024.4.24-cp312-cp312-win_amd64.whl (33.0 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

psf-2024.4.24-cp312-cp312-win32.whl (30.0 kB view hashes)

Uploaded CPython 3.12 Windows x86

psf-2024.4.24-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66.8 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

psf-2024.4.24-cp312-cp312-macosx_11_0_arm64.whl (31.6 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

psf-2024.4.24-cp312-cp312-macosx_10_9_x86_64.whl (32.5 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

psf-2024.4.24-cp311-cp311-win_arm64.whl (28.9 kB view hashes)

Uploaded CPython 3.11 Windows ARM64

psf-2024.4.24-cp311-cp311-win_amd64.whl (33.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

psf-2024.4.24-cp311-cp311-win32.whl (29.9 kB view hashes)

Uploaded CPython 3.11 Windows x86

psf-2024.4.24-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66.0 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

psf-2024.4.24-cp311-cp311-macosx_11_0_arm64.whl (31.5 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

psf-2024.4.24-cp311-cp311-macosx_10_9_x86_64.whl (32.4 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

psf-2024.4.24-cp310-cp310-win_amd64.whl (33.0 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

psf-2024.4.24-cp310-cp310-win32.whl (29.9 kB view hashes)

Uploaded CPython 3.10 Windows x86

psf-2024.4.24-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (65.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

psf-2024.4.24-cp310-cp310-macosx_11_0_arm64.whl (31.5 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

psf-2024.4.24-cp310-cp310-macosx_10_9_x86_64.whl (32.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

psf-2024.4.24-cp39-cp39-win_amd64.whl (33.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

psf-2024.4.24-cp39-cp39-win32.whl (29.9 kB view hashes)

Uploaded CPython 3.9 Windows x86

psf-2024.4.24-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (64.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

psf-2024.4.24-cp39-cp39-macosx_11_0_arm64.whl (31.5 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

psf-2024.4.24-cp39-cp39-macosx_10_9_x86_64.whl (32.4 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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