Scalar and vectorial models of the microscope point spread function (PSF).
Project description
psfmodels
Python bindings for scalar and vectorial models of the point spread function.
Original C++ code and MATLAB MEX bindings Copyright © 2006-2013, Francois Aguet, distributed under GPL-3.0 license. Python bindings by Talley Lambert
The model is described in Auget et al 20091. For more information and implementation details, see Francois' Thesis2.
1 F. Aguet et al., (2009) Opt. Express 17(8), pp. 6829-6848
see also:
For a different (faster) scalar-based Gibson–Lanni PSF model, see the MicroscPSF project, based on Li et al (2017) which has been implemented in Python, MATLAB, and ImageJ/Java
Install
Prebuilt binaries available on pypi for OS X and Windows, sdist available for linux
pip install psfmodels
from source
git clone https://github.com/tlambert03/PSFmodels.git
cd PSFmodels
pip install -e ".[dev]" # will compile c code via pybind11
Usage
There are two main functions in psfmodels
: vectorial_psf
and scalar_psf
.
Additionally, each version has a helper function called vectorial_psf_centered
and scalar_psf_centered
respectively. The main difference is that the _psf
functions accept a vector of Z positions zv
(relative to coverslip) at which
PSF is calculated. As such, the point source may or may not actually be in the
center of the rendered volume. The _psf_centered
variants, by contrast, do
not accecpt zv
, but rather accept nz
(the number of z planes) and dz
(the z step size in microns), and always generates an output volume in which the
point source is positioned in the middle of the Z range, with planes equidistant
from each other. All functions accept an argument pz
, specifying the position
of the point source relative to the coverslip. See additional keyword arguments
below
Note, all output dimensions (nx
and nz
) should be odd.
import psfmodels as psfm
import matplotlib.pyplot as plt
from matplotlib.colors import PowerNorm
# generate centered psf with a point source at `pz` microns from coverslip
# shape will be (127, 127, 127)
psf = psfm.make_psf(127, 127, dxy=0.05, dz=0.05, pz=0)
fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.imshow(psf[nz//2], norm=PowerNorm(gamma=0.4))
ax2.imshow(psf[:, nx//2], norm=PowerNorm(gamma=0.4))
plt.show()
# instead of nz and dz, you can directly specify a vector of z positions
import numpy as np
# generate 31 evenly spaced Z positions from -3 to 3 microns
psf = psfm.make_psf(np.linspace(-3, 3, 31), nx=127)
psf.shape # (31, 127, 127)
all PSF functions accept the following parameters. Units should be provided in microns unless otherwise stated. Python API may change slightly in the future. See function docstrings as well.
nx (int): XY size of output PSF in pixels, must be odd.
dxy (float): pixel size in sample space (microns) [default: 0.05]
pz (float): depth of point source relative to coverslip (in microns) [default: 0]
ti0 (float): working distance of the objective (microns) [default: 150.0]
ni0 (float): immersion medium refractive index, design value [default: 1.515]
ni (float): immersion medium refractive index, experimental value [default: 1.515]
tg0 (float): coverslip thickness, design value (microns) [default: 170.0]
tg (float): coverslip thickness, experimental value (microns) [default: 170.0]
ng0 (float): coverslip refractive index, design value [default: 1.515]
ng (float): coverslip refractive index, experimental value [default: 1.515]
ns (float): sample refractive index [default: 1.47]
wvl (float): emission wavelength (microns) [default: 0.6]
NA (float): numerical aperture [default: 1.4]
Comparison with other models
While these models are definitely slower than the one implemented in Li et al (2017) and MicroscPSF, there are some interesting differences between the scalar and vectorial approximations, particularly with higher NA lenses, non-ideal sample refractive index, and increasing spherical aberration with depth from the coverslip.
For an interactive comparison, see the examples.ipynb Jupyter notebook.
Lightsheet PSF utility function
The psfmodels.tot_psf()
function provides a quick way to simulate the total
system PSF (excitation x detection) as might be observed on a light sheet
microscope (currently, only strictly orthogonal illumination and detection are
supported). See the lightsheet.ipynb Jupyter notebook for
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
Built Distributions
File details
Details for the file psfmodels-0.3.0.tar.gz
.
File metadata
- Download URL: psfmodels-0.3.0.tar.gz
- Upload date:
- Size: 575.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d5baee8cc99ad4a8399d272c2a4b13f8a7ba49f54302f6d1746467d69a89e42 |
|
MD5 | eafc64e6b47118462c8e787ce16f8033 |
|
BLAKE2b-256 | 4309bf7f316a52b53963ffd9c204621f73c7806ae28ecacdda7329f4adf77967 |
File details
Details for the file psfmodels-0.3.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 106.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8b3e364c2a1c0244c10d5f833b8ae77ebaa214c25fa99dbf50439d26eeb4253 |
|
MD5 | d2a404c7cb609dca5b8e171e7688250a |
|
BLAKE2b-256 | 1d0999629f63dc68bd8ec6ece4fd551cae96b2a8a5e5bb32be65804edb38cb1c |
File details
Details for the file psfmodels-0.3.0-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 665.1 kB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d1427ccde696630827e4fe052f3d72a9083b37b9ae4476bb6a4d693361980ed |
|
MD5 | 59003b40a0df21d73e1c42f5bdd19539 |
|
BLAKE2b-256 | 4f37949891de3631307c32e501434e75bf34b2da415fc5064f1f997dac32afc5 |
File details
Details for the file psfmodels-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 150.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ef48c66bcb07bb26c401c7a52669f0f4fab8dd41fdd118087f5dc9d02af58c8 |
|
MD5 | 2e0beab39ce531ce3db5e601766f5453 |
|
BLAKE2b-256 | 3c8c13fb83a8512d4fd7b7b1aced492e58779980257ca9491c16f2fa1f2ca539 |
File details
Details for the file psfmodels-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 101.4 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ad92844a2a3ebc380be1c13b72f70e60c930b4a01cc8f98040dcf2a7255712c |
|
MD5 | 0ff7611661ca347c95c32e139047fc7e |
|
BLAKE2b-256 | 6cf976c627252ccd565dabafaf16f8be64559f7a6013ee47450e0de06ea898ca |
File details
Details for the file psfmodels-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 110.5 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfd292f32844b34f1ad13ca9f61a834571b2475b71cd81c61773a2ee98bcc3c0 |
|
MD5 | d9f5398adac9035d0da3d7960eb28cac |
|
BLAKE2b-256 | 414422bd33401b9af2c70434b990655a011a42f24502c3cf45b7224c8b387ae2 |
File details
Details for the file psfmodels-0.3.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 106.5 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ec04a5a8a30f9255850b6a9604c1613873259704831cc75b0510390f49a229b |
|
MD5 | a7574bda71ec53dd18b6dd18d11aa160 |
|
BLAKE2b-256 | aca49402720f623cd8267b99e83df9e6a0ccd0a5c801cb71789ff86356b184d0 |
File details
Details for the file psfmodels-0.3.0-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 666.1 kB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1671700ebe598635bb36e4b0db7846f2bb955c153ddf295cdf8ece15f654ea7e |
|
MD5 | a492f470feb4a3a2d83ae8db14fc1a90 |
|
BLAKE2b-256 | e7e8b7b90541d6f16939d4415fd0f88d235dc64ebcfab9d4dbefc3f15bae0f3c |
File details
Details for the file psfmodels-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 150.3 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3d0581841505fa9e3888b335c4acfc8fe9198015f8f71378c5879cf733d4ed9 |
|
MD5 | 76f320bd579a79fd62d417c25b6ae4eb |
|
BLAKE2b-256 | 2cac2bad4b09a2b4f84188f8f3b312966920f554b499878ec825eeb6ccd70e44 |
File details
Details for the file psfmodels-0.3.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 101.6 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcf8e922f862a9a03d33d3d75474039106b28fce026451711717e440f9c4a5f5 |
|
MD5 | 7eaa306b88a7f1d35fafe08802fefcae |
|
BLAKE2b-256 | f5e995ba9cce01667d7f9a6ef4dffabef4c03c9ddb465c6ea6596aa74d589b36 |
File details
Details for the file psfmodels-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 110.6 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0400adb25aebbb2afbfab02cafe828cb81493d8f532b0dc9aaca317b2ac31203 |
|
MD5 | 55f831fbce15f6fe8de438b47ab0dde4 |
|
BLAKE2b-256 | 80c13b46b1164ba0b5af613696778a94a6cdfee4886b7cd91df180b0b15872e6 |
File details
Details for the file psfmodels-0.3.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 106.5 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a384678c53af9e187533e7179e0dfe9c8b295feff05d5250d6fd1e2cdac052d |
|
MD5 | 3326946357fddd06a0c092fb4e76037b |
|
BLAKE2b-256 | 7ace108cbad15b80dc3cc73d39ac59d639515c06f5c9893375d5eaffea25a40e |
File details
Details for the file psfmodels-0.3.0-cp38-cp38-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 665.0 kB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e3ea46e962a0b67a91183ae5409779e1bc793e8430f15efd72471f338023da |
|
MD5 | 164ed472b5d2f05d92b46de2480b8aa3 |
|
BLAKE2b-256 | 407ced5e12064a604b0838f04855876fee97b0db3fad241b5942c36a8249a925 |
File details
Details for the file psfmodels-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 150.0 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb19cc00adb5624c6c79467c63ecebfbd4f2d4d8b68365406b6f4a48ee6883e5 |
|
MD5 | 2f8d2070c255446618affce8fe8acce5 |
|
BLAKE2b-256 | be433871f2b428b7a0c7c8c52c77e1ef609572760c0722fc290c6ff4bd315fc7 |
File details
Details for the file psfmodels-0.3.0-cp38-cp38-macosx_11_0_arm64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 101.4 kB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 935c5abf8ae0d171359336ec7c751efe745d825e6dfd9c319755c629a506ea75 |
|
MD5 | fc4f87969e469793819b37b30b8ee538 |
|
BLAKE2b-256 | b1217f2988c12b20aea4729d71aae97229dddfaadde132978cdb41608c8942f9 |
File details
Details for the file psfmodels-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 110.3 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af174880771cd4fb3d0a7d7277f4e87bf6134336f2c7e5cc01f5f0ef9db74207 |
|
MD5 | 5e7bde438f67fa7a94a46b9e3b93b72d |
|
BLAKE2b-256 | 5cc784a96214c533b943ed7fda680bf1625da6856ecc57e6ca7456b19d2c5788 |
File details
Details for the file psfmodels-0.3.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 107.2 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ca923c7c7dc31358a00c987c383d917ac478487e77c33312717a40df4792b55 |
|
MD5 | 87b59bd1489e52521e35a43afb9ffb61 |
|
BLAKE2b-256 | 1583e293ed88f3ffa656e4a23417f2fec480e5ea8e8d034e937d579c5083554c |
File details
Details for the file psfmodels-0.3.0-cp37-cp37m-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp37-cp37m-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 666.9 kB
- Tags: CPython 3.7m, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88b081e13ae9e99f8889c39a205dbd6e536d5f0a2b309d7a5f9cc2fd21b58990 |
|
MD5 | b14a4907df99b2686052cd4d0227ab15 |
|
BLAKE2b-256 | d26980a900aa96912f8c9341ea26bb9ca29d932e2f38444354160700cd059a9e |
File details
Details for the file psfmodels-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 150.4 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 341bdceba0ab132e60ce1f436f2c99d9dfb5d82046bd26b7025ed1c0687f10ac |
|
MD5 | 5cb77a9e7b6fcfe593ff11e930c82012 |
|
BLAKE2b-256 | 5422866cdc30fa57c3600d5ff88d77601fbeed33fb179fcebb8b6d0d629f8c05 |
File details
Details for the file psfmodels-0.3.0-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: psfmodels-0.3.0-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 109.9 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7743c41106d346012365b87d5360a7520522d0dd8784f66f8a879c7b7547310d |
|
MD5 | 4cf6fedbc61b917bb60582c825aaa577 |
|
BLAKE2b-256 | cc2c9a43eddc0b1c19af892418a521b444e39878be1fbdf5af3c24ee838f2198 |