Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

fpm-rs

Reconstruct and simulate image-plane Fourier ptychographic microscopy (FPM) acquisitions from Rust or Python.

fpm-rs gives microscopy researchers and algorithm developers a CPU-based core for compiling illumination geometry, simulating measurements, and recovering a complex object. It supports image-plane FPM only: diffraction-plane ptychography, multislice propagation, and GPU execution are not implemented.

What it can do for you

  • Compile an optical model. Resolve source geometry, stable calibration, and sparse acquisition structure into Fourier-space sampling and a pupil.
  • Simulate an acquisition. Generate ideal or camera-affected intensity frames from synthetic or supplied complex objects.
  • Reconstruct the object. Start with alternating projection, or use FPIE, EPRY, ADMM, or gradient descent when their calibration and regularization options fit the experiment.
  • Calibrate a planar LED array physically. Alternate analytic object or object/pupil updates with bounded pose, pitch, reference-index, selected-offset, source-power, or frame-gain updates and reuse the returned Illumination.
  • Keep a run inspectable. Record diagnostics, write checkpoints, and compare simulations with known ground truth. Optional Parquet support writes self-describing result and benchmark bundles for downstream analysis.
  • Measure at the right layer. Reusable reference/estimate metrics, optimization objectives, reconstruction evaluation, and recorder-driven diagnostics are separate APIs.

A typical workflow

  1. Compile the optics and illumination into an ImagePlaneModel.
  2. Load measured intensity frames, or simulate them from a known object.
  3. Build a ReconstructionProblem, run an algorithm, and inspect amplitude, phase, diagnostics, or checkpoints.

The same forward model is used for simulation and reconstruction, while algorithms consume the compiled model rather than experimental geometry.

Array layout contract

The Rust API uses native ndarray arrays and views. Pointwise utilities and metrics accept arbitrary logical layouts, including transposed and stepped views. Computational inputs whose kernels use flat Fourier-grid offsets—such as pupils, synthetic objects, measurement stacks, crop operations, and direct forward-model spectra—require standard C-style row-major layout. Those APIs validate the layout without copying and return a NonStandardLayout error for strided input. Owned result and diagnostic arrays are ordinary ndarray arrays. Result bundle export is a strict persistence boundary and rejects nonstandard result layouts rather than silently materializing a copy.

Python follows the same distinction. Metrics accept strided NumPy arrays. Reconstruction, simulation, pupil, and measurement inputs require C-contiguous arrays and raise an error suggesting numpy.ascontiguousarray; the caller therefore decides whether to pay for that copy. Accepted NumPy inputs are copied into Rust-owned storage at the binding boundary. Arrays opened through a result bundle are loaded on first access, cached, and exposed as immutable NumPy arrays.

Start here

Install the Python package:

python -m pip install fpm-rs

Then compile a small model, simulate it, and reconstruct it:

import numpy as np
import fpm_rs as fpm

optics = fpm.Optics(532e-9, 0.10, 4.0, 6.5e-6)
geometry = fpm.PlanarLEDArray(
    (3, 3),
    4e-3,
    (1.0, 1.0),
    fpm.ArrayPose.from_translation((0.0, 0.0, -90e-3)),
)
illumination = fpm.Illumination(geometry)
model = fpm.compile_model(optics, illumination, (32, 32))

simulation = fpm.simulate(
    model,
    np.ones(model.reconstruction_shape, dtype=np.complex128),
    seed=1234,
)
problem = fpm.ReconstructionProblem(
    simulation.measurements,
    simulation.reconstruction_model,
)
result = fpm.AlternatingProjection(iterations=20).run(problem)
print(result.amplitude.shape)

For the Rust equivalent, run:

cargo run --example simulate_and_reconstruct

Go deeper

License

fpm-rs is available under the MIT License.

Metadata

Release files for fpm-rs 0.2.0b2

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

Source distribution (sdist)

Source distribution for fpm-rs 0.2.0b2
File Size Uploaded
fpm_rs-0.2.0b2.tar.gz 320.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fpm-rs 0.2.0b2
File
fpm_rs-0.2.0b2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
fpm_rs-0.2.0b2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
fpm_rs-0.2.0b2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ ARM64 Details
fpm_rs-0.2.0b2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
fpm_rs-0.2.0b2-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details
fpm_rs-0.2.0b2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
fpm_rs-0.2.0b2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
fpm_rs-0.2.0b2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
fpm_rs-0.2.0b2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
fpm_rs-0.2.0b2-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
fpm_rs-0.2.0b2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
fpm_rs-0.2.0b2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
fpm_rs-0.2.0b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
fpm_rs-0.2.0b2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
fpm_rs-0.2.0b2-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details

Total release size: 142.9 MB

Release files / fpm_rs-0.2.0b2.tar.gz

Download URL fpm_rs-0.2.0b2.tar.gz
Size 320.8 kB
Tags Source
SHA-256 checksum
How to use checksums
adeb3eabbee383fa74aad41305841a70b69dd9ef8c1b75667517d3c752a834b4
BLAKE2b-256 checksum
How to use checksums
11e0e00722e84ecde85d970fcb2c41eccd42f1b1579b1e7f095bc2d9350e778a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp314-cp314-win_amd64.whl

Download URL fpm_rs-0.2.0b2-cp314-cp314-win_amd64.whl
Size 10.3 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
cb51f907d68ae6daf33bb275a8eaec6dbc5a59229c34616f20b792b9c614f85c
BLAKE2b-256 checksum
How to use checksums
3378e1f482161371645893481347e3763a6f65a2101564a10eed41424085fca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL fpm_rs-0.2.0b2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 10.0 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e888d5bc517ca0bca0e0031777f6f334bd8b88c46e2edead409b41174b6221ed
BLAKE2b-256 checksum
How to use checksums
90977e514703761021ade52c8168f7aacf9ac32b8af731fa6294f95e87364d29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL fpm_rs-0.2.0b2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 9.2 MB
Tags CPython 3.14 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
552efeec7fffe98ae984df3160375c61bf1154ff31ab7d1cb13e7dee3c0eff59
BLAKE2b-256 checksum
How to use checksums
bb67e87948f2b25cc1d637febc2502a3deea8c65b5814039699383a984babb4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp314-cp314-macosx_11_0_arm64.whl

Download URL fpm_rs-0.2.0b2-cp314-cp314-macosx_11_0_arm64.whl
Size 8.7 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c2d786902592a49d613b8cbb5fa46dae4da921ba557445ec293a0a82c65c71d0
BLAKE2b-256 checksum
How to use checksums
d65c73574ae526d97ebda3eb1fe6e278d722dd0cdd0b554f2ff07311d3ab05c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp314-cp314-macosx_10_12_x86_64.whl

Download URL fpm_rs-0.2.0b2-cp314-cp314-macosx_10_12_x86_64.whl
Size 9.4 MB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
493f36657baed929f5af4a513cb90782206fda8efaa8c97c05a4fb9003527424
BLAKE2b-256 checksum
How to use checksums
8cb8f0a1ef13d833a5a88429f53b1c4cef196ebcf5a4f335b056b4bbfc2faee9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp313-cp313-win_amd64.whl

Download URL fpm_rs-0.2.0b2-cp313-cp313-win_amd64.whl
Size 10.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0f48a49ffd37c9238d27b8defcf4b0cdb9a0576bd3e68a4876edd9eb3fa1d04a
BLAKE2b-256 checksum
How to use checksums
5a52b766bb80857d125973de7769740e025e5acf43fea1813ba736fe3ae58aa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL fpm_rs-0.2.0b2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 10.0 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ff39283b319539a1af21a1c4649c6292ca26ae5620979759d5ea57312a286413
BLAKE2b-256 checksum
How to use checksums
9989935c864d9e7f71252eea05af0379c95344727377a50c299ada8c8c972a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL fpm_rs-0.2.0b2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 9.2 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
28d4d53284c39da3974d26b0c877260aaa10a1d6e9cb03d4e2f8683cdd862267
BLAKE2b-256 checksum
How to use checksums
45f7bd7916e35bceba3f77be610e1c94e8b2b759cf8563c3801218c0a7726591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp313-cp313-macosx_11_0_arm64.whl

Download URL fpm_rs-0.2.0b2-cp313-cp313-macosx_11_0_arm64.whl
Size 8.7 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
857034e01360f168fa2daa352a9e8cb6259ea0b595724a9ce30cb2d10e0ef8df
BLAKE2b-256 checksum
How to use checksums
fdb9d69745e5fd45ea046d498ce9a008edbb36063553695b607d25577b635f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp313-cp313-macosx_10_12_x86_64.whl

Download URL fpm_rs-0.2.0b2-cp313-cp313-macosx_10_12_x86_64.whl
Size 9.4 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8dbd7807506bd7b2d7072654658e1ecbee3079dc3a9369a546419ea471274fa7
BLAKE2b-256 checksum
How to use checksums
abb5c7acf300e92774e7c73b53bf695a20dde815dd633183fdf2dccfeae04c71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp312-cp312-win_amd64.whl

Download URL fpm_rs-0.2.0b2-cp312-cp312-win_amd64.whl
Size 10.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
0284419ec19173bebcefeb5787cd1e07fb29b44748c959757ee81b92e6ec5bf0
BLAKE2b-256 checksum
How to use checksums
6fddecb64f5c3502169233543bc93901d986ef86519655ea2dd92e833c2cb34d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL fpm_rs-0.2.0b2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 10.0 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
28d5f0af778fdf9dd57ec58eb6b477a6f0a5d29194cca0133ba0a24999f9719a
BLAKE2b-256 checksum
How to use checksums
3d7c53567685c78b33c8bea3878c9ef5c412a6b00b4e8b2eb8aa4ad65f7ffefb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL fpm_rs-0.2.0b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 9.2 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c000b5f65a8d55367c3cd20a739641a402269248a4ec513ef9e878cba0dfcd81
BLAKE2b-256 checksum
How to use checksums
63e3a8339e0e65dd184b4b0a62094d44b5527d4c282909094f9d6ecba186074c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp312-cp312-macosx_11_0_arm64.whl

Download URL fpm_rs-0.2.0b2-cp312-cp312-macosx_11_0_arm64.whl
Size 8.7 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b8f832b83d1dee9edb55722fdf8f5a9b6792233feeaf4f4ddf09bc3f83f148ee
BLAKE2b-256 checksum
How to use checksums
c769f20683aa418ff3cb1f2804340f7356846b8a8900adfd05e1744602984902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / fpm_rs-0.2.0b2-cp312-cp312-macosx_10_12_x86_64.whl

Download URL fpm_rs-0.2.0b2-cp312-cp312-macosx_10_12_x86_64.whl
Size 9.4 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
519b9c11bc792fcc0c93929c14ee3d5858f902844c628b3852b32e42beb714ef
BLAKE2b-256 checksum
How to use checksums
0e1181d4124ff91e4e3e459bc784ed0f99d2494d1c71d5f1afb4cfef05841484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0b2 This release

16 release files

0.1.0

6 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