libertem-parallax
Streaming parallax imaging UDFs for 4D-STEM, built on top of LiberTEM.
This package provides two streaming-capable user-defined functions (UDFs) for parallax imaging. While applicable to offline analysis, the UDFs are primarily designed for live processing during acquisition using LiberTEM-live.
Installation
The package is available on the Python Package Index (PyPI) as
libertem-parallax.
Install using pip:
pip install libertem-parallax
For a developer installation, please refer to CONTRIBUTORS.md.
Usage example
The UDFs are not meant to be instantiated directly via ParallaxUDF(...).
Instead, use the provided classmethod constructor to specify the acquisition and reconstruction parameters:
import libertem.api
import libertem_parallax as prlx
import numpy as np
ctx = libertem.api.Context()
# dataset available at https://doi.org/10.5281/zenodo.18346853
ds = ctx.load("auto", path="../data/apoF_4mrad_1.5um-df_3A-step_30eA2_binary_uint8.npy")
udf = prlx.ParallaxUDF.from_parameters(
shape=ds.shape,
scan_sampling=(256/72,256/72),
angular_sampling=(0.307617,0.307617),
energy=300e3,
semiangle_cutoff=4.0,
aberration_coefs={"C10":-1.5e4},
rotation_angle=np.deg2rad(-15),
upsampling_factor=2,
)
udf_flip = prlx.ParallaxPhaseFlipUDF.from_parallax_udf(
udf
)
result, result_flip = ctx.run_udf(
dataset=ds, udf=[udf, udf_flip],
progress=True, plots=True
)
Parallax imaging background
Parallax imaging1, also known as tilt-corrected bright-field (tcBF) STEM2, is a STEM phase contrast technique which can be understood as a quadratic approximation3 to direct ptychography techniques such as phase-compensated single-sideband4.
In direct ptychography methods, phase contrast is recovered by applying a frequency-dependent deconvolution kernel to each diffraction pattern. Parallax imaging replaces this with a simple yet remarkably robust bright-field–frequency-dependent phase ramp. This leads to an important practical consequence:
Parallax imaging replaces expensive Fourier-domain operations with simple, real-space updates.
Each bright-field pixel is associated with a real-space parallax shift, determined by the gradient of the aberration phase surface. During acquisition, each diffraction frame contributes locally to the reconstruction at the shifted position.
Two closely related variants are implemented:
- Parallax imaging (
ParallaxUDF)
Each BF pixel contributes a delta-like update at its shifted location, correcting for the parallax effect. - Phase-flipped parallax imaging (
ParallaxPhaseFlipUDF)
Each BF pixel contributes a shifted fixed real-space kernel, correcting for both the parallax effect and contrast reversals, enabling dark-field-like contrast.
License
LiberTEM-parallax is licensed under the MIT license.
The project includes code adapted from existing quantEM utilities where noted, under a compatible license. See individual source files for attribution details.
Metadata
Release files for libertem-parallax 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| libertem_parallax-0.1.2.tar.gz | 223.6 kB | Without provenance | Details for libertem_parallax-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| libertem_parallax-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for libertem_parallax-0.1.2-py3-none-any.whl |
Total release size: 240.8 kB
Release files / libertem_parallax-0.1.2.tar.gz
| Download URL | libertem_parallax-0.1.2.tar.gz |
|---|---|
| Size | 223.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fd6c8d7074da75df06519a9cb86649c92ae79da697fb315b503877c7d9c6c32
|
|
BLAKE2b-256 checksum How to use checksums |
f5d3ca357859e9b09a98eb0e2b0b48b00460fb8a5aa538406f63662929b4d607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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 / libertem_parallax-0.1.2-py3-none-any.whl
| Download URL | libertem_parallax-0.1.2-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a554d6abdabed4d62d983391e2ca87be28a34ee7f7897f86d571e1cfec096cb1
|
|
BLAKE2b-256 checksum How to use checksums |
2163fbe9a894e4e79c8b6893534f18f931f75fccff3e8cff85cf5b64fe440b6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
|
Security for libertem-parallax 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.