Skip to main content

Tests Documentation Status License: MIT

PyHoloscope Logo

PyHoloscope: Fast Holographic Microscopy for Python

PyHoloscope is a Python package for holographic microscopy, providing performant reconstruction of inline and off-axis holograms, as well as autofocus and phase visualisation.

PyHoloscope is designed to be:

  • Fast (for Python) - optimised for CPU using Numpy, Scipy and Numba, with GPU support via CuPy
  • Easy to Use - a simple object-oriented API gives high performance without low-level tweaks
  • Suitable for Live Imaging - can be used as the back-end of holographic microscopy GUIs as well as for offline processing

Full documentation is on Read the docs.

Installation

pip install pyholoscope

Minimal Example

To numerically refocus an inline hologram:

import pyholoscope as pyh
hologram = pyh.load_image(holoFile)
holo = pyh.Holo(
    mode=pyh.INLINE,  # For inline holography
    wavelength=630e-9,  # Light wavelength, m
    pixel_size=1e-6,  # Hologram physical pixel size, m
    depth=0.0130,  # Distance to refocus, m
)
recon = holo.process(hologram)

Live Demos and Examples

You can try PyHoloscope in your browser with these tutorials hosted on Binder:

  • Tutorial 01: Inline Holography Binder

  • Tutorial 02: Off-Axis Holography Binder

  • Tutorial 03: Off-Axis Holography with Refocusing Binder

  • Tutorial 04: Auto-focusing Binder

There are more example scripts in the examples folder.

Contributions

Contributions to the package (new features, tests or documentation) are very welcome, please see the roadmap below and post in the discussion if you are working on something, or get in touch.

Development is co-ordinated by Mike Hughes' lab in the Applied Optics Group, Physics & Astronomy, University of Kent.

If you are interested in academic applications we are happy to help, post in the discussion. If you would like help using PyHoloscope for commercial purposes, consultancy is available, please contact Mike Hughes in the first instance.

Features

General

  • Object-oriented interface
  • Choice of single or double precision
  • Support for CUDA compatible GPUs
  • Optional use of Numba JIT compiler
  • Supports non-square holograms

Off Axis Holography

  • Quantitative phase and amplitude recovery from off-axis hologram
  • Auto detect off-axis modulation frequency
  • Predict tilt angle from modulation frequency

Numerical Refocusing (Inline and Off-axis Holography)

  • Refocus holograms or complex fields using the angular spectrum method
  • Choice of cosine windows to reduce edge effects
  • Generate stack of images at different refocus depths
  • Apply focus metrics (Brenner, Sobel, Peak Intensity, DarkFocus, SobelVariance)
  • Auto focus whole image or ROI by optimising focus metric, through fast bounded search and (optionally) initial coarse search to narrow search range.
  • Generate LUT of propagators for faster auto-focus or repeated generation of focus stacks.

Phase Visualisation

  • Remove background phase
  • Remove phase tilt
  • Show phase relative to region of interest
  • Generate phase contrast image
  • Generate synthetic DIC image

Roadmap of Planned Developments (help welcome!)

  • Phase recovery for inline holography
  • Improved optimisation for speed/multiple back-ends
  • Support phase-shifting holography
  • Support coded aperture/multi-depth phase recovery
  • Support forward scattering and inference
  • Support particle tracking
  • Deep learning for focusing
  • Targeted support for edge computing (e.g. Raspberry Pi)

Requirements

  • Numpy
  • Scipy
  • PIL
  • OpenCV
  • Scikit-Image
  • Matplotlib
  • Numba (optional, for JIT acceleration)
  • CuPy (optional, for GPU)

Metadata

Release files for PyHoloscope 1.1.3

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

Source distribution (sdist)

Source distribution for PyHoloscope 1.1.3
File Size Uploaded
pyholoscope-1.1.3.tar.gz 37.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyHoloscope 1.1.3
File Interpreter ABI Platform
pyholoscope-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 83.3 kB

Release files / pyholoscope-1.1.3.tar.gz

Download URL pyholoscope-1.1.3.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
45b19d99da5043af6ecd8853bda0bb5c8a2f441018b65366978fd211b7c18d03
BLAKE2b-256 checksum
How to use checksums
bb11eb9479da67a118b80fa62263aa929d6b1d985024e4ed84b42bf50130b9fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release files / pyholoscope-1.1.3-py3-none-any.whl

Download URL pyholoscope-1.1.3-py3-none-any.whl
Size 45.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf52def37329d0f92dd6d8ec3d724df47cba33f198ead6cbeb3ffdb4c5f2b2e8
BLAKE2b-256 checksum
How to use checksums
e8e930b99d8b6386800bb86fb2f12f8be927f452ea23e0de6fa4fd44b853fa2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

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