Skip to content

Python API

The public package is fpm_rs. Configuration objects and arrays cross the Python boundary while model compilation, simulation, and reconstruction run in the Rust extension. The checked-in python/fpm_rs/__init__.pyi supplies the typed public surface; private _core implementation objects are intentionally not listed here.

fpm_rs

open_dataset(id: str, *, registry_url: str | None = None, cache_dir: Path | None = None) -> Dataset

suggest_reconstruction_shape(optics: Optics, illumination: Illumination, image_shape: Shape2D, reconstruction_shape: ReconstructionShapeSpec = 'smooth') -> Shape2D

compile_model(optics: Optics, illumination: Illumination, image_shape: Shape2D, reconstruction_shape: ReconstructionShapeSpec = 'smooth') -> ImagePlaneModel

compile_camera_model(model: ImagePlaneModel, camera: CameraModel) -> ImagePlaneModel

simulate(true_model: ImagePlaneModel, object: ComplexArray | SyntheticObject, *, reconstruction_model: ImagePlaneModel | None = None, camera: CameraModel | None = None, illumination_errors: IlluminationAcquisitionErrors | None = None, seed: int = 0) -> SimulationResult

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

FpmError

Bases: Exception

InvalidShapeError

Bases: FpmError

InvalidParameterError

Bases: FpmError

InvalidModelError

Bases: FpmError

InvalidMeasurementsError

Bases: FpmError

LengthMismatchError

Bases: FpmError

FrameOutOfRangeError

Bases: FpmError

NumericalError

Bases: FpmError

UnsupportedError

Bases: FpmError

DatasetError

Bases: FpmError

FpmIoError

Bases: FpmError

SerializationError

Bases: FpmError