Skip to main content

faser

faser is a Python-based software package designed to simulate the excitation point spread function (PSF) of optical microscopes. Faser calculates PSFs for high NA focusing by using a vectorial model of the electromagnetic field, enabling exploration of the impact of geometrical and optical parameters on imaging performance in advanced applications. The software supports various beam profiles, including those used in STED microscopy, and allows for the simulation of common experimental conditions such as a cranial window and a coverslip tilt.

The simulator itself is implemented in Rust (faser._core) and uses all available CPU cores; a pure numpy reference implementation is kept alongside it for validation (faser.generators.vectorial.stephane.generate_psf_numpy).

We provide to prefered ways to use faser:

Faser as a Napari Plugin

The recommended way to install faser is as a Napari plugin, which provides a user-friendly GUI for interactively exploring the PSF simulation. This can be done via:

pip install faser napari[pyqt5]

Usage

You can run the GUI application via (or just as a Napari plugin)

qtfaser

For more information on how to use the GUI, please refer to the preprint.

Faser as a standalone application

Alternatively, you can install the package as a standalone application only, that you can run in enironments without Napari or GUI support:

pip install faser[cli]

This will install the package as a standalone application that can be run from the command line via:

faser

We generally recommend the GUI application for most users, as it provides a more user-friendly interface. However faser can also be used as a library, and the CLI application is useful for scripting and batch processing.

Usage

To simulate the PSF, with a specific numerical aperture (NA) and a beam profile, you can run the following command:

faser --na 1.4 --window=NO

For more information and options you can run:

faser --help

To display the GUI interface and the available options:

  __                     
 / _| __ _ ___  ___ _ __ 
| |_ / _` / __|/ _ \ '__|
|  _| (_| \__ \  __/ |   
|_|  \__,_|___/\___|_|   

Generating PSF with config
faser➜  faser git:(master) ✗ uv run faser --help
                                                                                                                                                                                                                                                   
 Usage: faser [OPTIONS]                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                   
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --config                     FILENAME         Path to a JSON file                                                                                                                                                                               │
│ --detector_gaussian_noise    FLOAT            Detector Gaussian noise                                                                                                                                                                           │
│ --gaussian_beam_noise        FLOAT            Gaussian_beam noise                                                                                                                                                                               │
│ --add_noise                  NOISE                                                                                                                                                                                                              │
│ --loaded_phase_mask          OPTIONAL         Loaded Phasemak                                                                                                                                                                                   │
│ --p                          FLOAT            Ratio between Donut (p) and Bottle (1-p) intensity                                                                                                                                                │
│ --mask_offset_y              FLOAT            Y offset of the phase mask in regard to pupil center                                                                                                                                              │
│ --mask_offset_x              FLOAT            X offset of the phase mask in regard to pupil center                                                                                                                                              │
│ --ring_radius                FLOAT            Radius of the ring phase mask (on unit pupil)                                                                                                                                                     │
│ --rc                         FLOAT            Ring charge (should be odd to produce bottle)                                                                                                                                                     │
│ --vc                         FLOAT            Vortex charge (should be integer to produce donut)                                                                                                                                                │
│ --epsilon                    FLOAT            Ellipticity of the polarization (in °)                                                                                                                                                            │
│ --psi                        FLOAT            Direction of the polarization (in °)                                                                                                                                                              │
│ --ampl_offset_y              FLOAT            Y offset of the amplitude profile in regard to pupil center                                                                                                                                       │
│ --ampl_offset_x              FLOAT            X offset of the amplitude profile in regard to pupil center                                                                                                                                       │
│ --waist                      FLOAT            Diameter of the input beam on the objective pupil (in µm)                                                                                                                                         │
│ --wavelength                 FLOAT            Wavelength of light (in µm)                                                                                                                                                                       │
│ --polarization               POLARIZATION                                                                                                                                                                                                       │
│ --mode                       MODE                                                                                                                                                                                                               │
│ --aberration_offset_y        FLOAT            Y offset of the aberration function in regard to pupil center                                                                                                                                     │
│ --aberration_offset_x        FLOAT            X offset of the aberration function in regard to pupil center                                                                                                                                     │
│ --a24                        ABERRATIONFLOAT  Secondary spherical                                                                                                                                                                               │
│ --a12                        ABERRATIONFLOAT  Primary spherical                                                                                                                                                                                 │
│ --a9                         ABERRATIONFLOAT  Oblique Trefoil                                                                                                                                                                                   │
│ --a8                         ABERRATIONFLOAT  Horizontal Coma                                                                                                                                                                                   │
│ --a7                         ABERRATIONFLOAT  Vertical Coma                                                                                                                                                                                     │
│ --a6                         ABERRATIONFLOAT  Vertical Trefoil                                                                                                                                                                                  │
│ --a5                         ABERRATIONFLOAT  Vertical Astigmatism                                                                                                                                                                              │
│ --a4                         ABERRATIONFLOAT  Defocus                                                                                                                                                                                           │
│ --a3                         ABERRATIONFLOAT  Oblique Astigmatism                                                                                                                                                                               │
│ --a2                         ABERRATIONFLOAT  Horizontal Tilt                                                                                                                                                                                   │
│ --a1                         ABERRATIONFLOAT  Vertical Tilt                                                                                                                                                                                     │
│ --a0                         ABERRATIONFLOAT  Piston                                                                                                                                                                                            │
│ --wind_offset_y              FLOAT            Y offset of the cranial window in regard to pupil center                                                                                                                                          │
│ --wind_offset_x              FLOAT            X offset of the cranial window in regard to pupil center                                                                                                                                          │
│ --wind_depth                 FLOAT            Depth of the cranial window (in mm)                                                                                                                                                               │
│ --wind_radius                FLOAT            Diameter of the cranial window (in mm)                                                                                                                                                            │
│ --window                     WINDOW                                                                                                                                                                                                             │
│ --tilt                       FLOAT            Tilt angle of the coverslip (in °)                                                                                                                                                                │
│ --depth                      FLOAT            Imaging depth in the sample (in µm)                                                                                                                                                               │
│ --collar                     FLOAT            Correction collar setting to compensate coverslip thickness                                                                                                                                       │
│ --thickness                  FLOAT            Thickness of the coverslip (in µm)                                                                                                                                                                │
│ --n3                         FLOAT            Refractive index of the sample                                                                                                                                                                    │
│ --n2                         FLOAT            Refractive index of the coverslip                                                                                                                                                                 │
│ --n1                         FLOAT            Refractive index of the immersion medium                                                                                                                                                          │
│ --wd                         FLOAT            Working Distance of the objective lens (in µm)                                                                                                                                                    │
│ --na                         FLOAT            Numerical Aperture of Objective Lens                                                                                                                                                              │
│ --normalize                  NORMALIZE                                                                                                                                                                                                          │
│ --nphi                       INTEGER          Integration sted of the aximutal angle on the pupil                                                                                                                                               │
│ --ntheta                     INTEGER          Integration sted of the focalization angle                                                                                                                                                        │
│ --nz                         INTEGER          Discretization of Z axis - better be odd number for perfect 0                                                                                                                                     │
│ --nxy                        INTEGER          Discretization of image plane - better be odd number for perfect 0                                                                                                                                │
│ --l_obs_z                    FLOAT            Observation scale in Z (in µm)                                                                                                                                                                    │
│ --l_obs_xy                   FLOAT            Observation scale in XY (in µm)                                                                                                                                                                   │
│ --help                                        Show this message and exit.                                                                                                                                                                       │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Building from source

Binary wheels are published for Linux, macOS and Windows. Installing from a source checkout compiles the native backend, which needs a Rust toolchain (https://rustup.rs):

uv sync            # or: pip install -e .

The Rust code is a small workspace in rust/: rust/core is the simulator itself (pure Rust, no Python dependency), rust/src/lib.rs is the thin pyo3 wrapper that becomes faser._core, and rust/wasm compiles the same core to WebAssembly for the website playground. For local development after editing the Rust code:

uvx maturin develop --release
cargo test --manifest-path rust/Cargo.toml -p faser-core --features serde

Website and playground

The documentation site at https://jhnnsrs.github.io/faser lives in website/ (Next.js + Fumadocs, static export). Its playground runs the simulator in the browser: rust/wasm is built with wasm-pack into website/public/wasm, driven from a Web Worker, and the result is rendered with a three.js volume ray-marcher next to an idealized 3D microscope model that follows the parameters. See website/README.md for the local setup; the site is deployed by .github/workflows/deploy.yml on every push to main.

Release files for faser 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faser 2.2.0
File Size Uploaded
faser-2.2.0.tar.gz 3.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for faser 2.2.0
File
faser-2.2.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
faser-2.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
faser-2.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
faser-2.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details

Total release size: 20.1 MB

Release files / faser-2.2.0.tar.gz

Download URL faser-2.2.0.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
5f052606cbc1ccda171e5af612b1e9c5366ae01179b4d8d129cd2c2274900e64
BLAKE2b-256 checksum
How to use checksums
eebe485120ad4e27b8523417f12aaba855948784221a83fdaf2018e044e66e95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / faser-2.2.0-cp39-abi3-win_amd64.whl

Download URL faser-2.2.0-cp39-abi3-win_amd64.whl
Size 3.9 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9a5b05d28bee23cd4137236f9ad34b91d8027776dde006cb10a5e21cdd5454b8
BLAKE2b-256 checksum
How to use checksums
6f17f4c8993b1f5734d6f5fc2b048e827cca56a389a2eb6d2e07c0785236efb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / faser-2.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL faser-2.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
e995d73ee59f871dace8dfa15c57cfe9ddffd1c8cafe455c7d131a1f1b5fd4e6
BLAKE2b-256 checksum
How to use checksums
a3827f5a3382c92b34f4915d3a32eb15a35b495fb0087086bbfae84b9fcfb19c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / faser-2.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL faser-2.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.1 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
370b149de3b08c30b8a624f12f79d668db8fbb649df1838b16ce290175e7f189
BLAKE2b-256 checksum
How to use checksums
884d0fc17d0c14b7fe28f4c634161355e7ee0d93ecbe777eb508d1b8938ac47f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / faser-2.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL faser-2.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 4.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4952b5aec7e69db07883ec6c00d1c74a9ac8d58a2ef3ecd460d3d7dc7591e1f8
BLAKE2b-256 checksum
How to use checksums
3735c8a2098297ee9e731d8f5000d587ad0c9b7a2bfaf0ca1b852723bd7473a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page