Skip to content

Python API

The public package is fpm_rs. Configuration objects and NumPy arrays cross the Python boundary while model compilation, simulation, reconstruction, and bundle I/O run in Rust. Private _core implementation names are intentionally omitted.

Start with the domain that owns the concept you need:

The checked-in python/fpm_rs/__init__.pyi, metrics.pyi, and evaluation.pyi files are the authoritative signatures and API prose used by this reference.

Shared types and exceptions

All package-specific failures derive from FpmError. Shape, parameter, model, measurement, length, frame-range, numerical, unsupported-operation, dataset, I/O, and serialization failures have distinct subclasses.

fpm_rs

Python interface for the fpm-rs reconstruction and simulation core.

__version__ module-attribute

__version__: str

Installed package version.

Shape2D module-attribute

Shape2D: TypeAlias

Two-dimensional (height, width) array shape.

ReconstructionShapeSpec module-attribute

ReconstructionShapeSpec: TypeAlias

Explicit reconstruction shape or an automatic size-selection strategy.

FloatArray module-attribute

FloatArray: TypeAlias

NumPy array whose elements are double-precision real values.

ComplexArray module-attribute

ComplexArray: TypeAlias

NumPy array whose elements are double-precision complex values.

MaskArray module-attribute

MaskArray: TypeAlias

NumPy mask array with zero for excluded pixels and nonzero for valid pixels.

Path module-attribute

Path: TypeAlias

Text or path-like filesystem path accepted by the public API.

Callback module-attribute

Callback: TypeAlias

Rust-backed or Python callback accepted by reconstruction algorithms.

FpmError

Bases: Exception

Base class for errors raised by the Rust extension.

InvalidShapeError

Bases: FpmError

An array or image shape is empty, inconsistent, or unsupported.

InvalidParameterError

Bases: FpmError

A configuration parameter is non-finite or outside its valid range.

InvalidModelError

Bases: FpmError

A compiled model is internally inconsistent or unsuitable for an operation.

InvalidMeasurementsError

Bases: FpmError

A measurement stack contains invalid dimensions or intensity values.

LengthMismatchError

Bases: FpmError

Related sequences or arrays do not have the required matching lengths.

FrameOutOfRangeError

Bases: FpmError

A requested acquisition-frame index lies outside the measurement stack.

NumericalError

Bases: FpmError

A numerical operation produced an invalid or non-finite result.

UnsupportedError

Bases: FpmError

The requested feature or combination of options is not implemented.

DatasetError

Bases: FpmError

Dataset discovery, validation, download, or loading failed.

FpmIoError

Bases: FpmError

A filesystem operation failed.

SerializationError

Bases: FpmError

Structured data could not be serialized or deserialized.