Skip to content

title: API — the catalog description: pardesline.catalog: Catalog, Module, Method, Parameter with validation, rationale and validated_on.


Catalog

pardesline.catalog

The typed catalog of modules, methods and parameters.

The catalog is generated from the same manifests that drive the PardesLine platform (catalog/data/<module>.json). It is the single source of truth for what an algorithm is called, which file types it accepts, which flags it takes, their defaults and their ranges. Nothing here imports a native library.

>>> import pardesline as pl
>>> cat = pl.catalog()
>>> m = cat.method("point_cloud_processing", "voxel_downsample")
>>> m.validate({"voxel_size": 0.05})
{'voxel_size': '0.05'}

Catalog

Catalog(modules: list[Module])

All modules, ordered as on the platform.

method

method(module_id: str, method_id: str | None = None) -> Method

method("mod", "meth") or method("mod.meth").

find

find(method_id: str, extension: str | None = None) -> Method

Resolve a bare method id ("voxel_downsample") to its method. When several modules define the id, extension picks the one that accepts the file; an ambiguous lookup raises :class:CatalogError.

methods_for

methods_for(extension: str | None) -> list[Method]

Every method whose module accepts files with this extension.

Module dataclass

Module(id: str, name: str, description: str, category: str, order: int, input_formats: tuple[str, ...], methods: dict[str, Method] = dict(), dual_input: bool = False, dual_input_label: str = '', theory: dict[str, Any] = dict(), videos: tuple[dict[str, str], ...] = ())

A family of methods sharing input formats.

accepts

accepts(extension: str | None) -> bool

True when the module reads files with this suffix. .nii.gz is accepted wherever .nii is: the readers (SimpleITK, VTK) handle the compression themselves.

Method dataclass

Method(id: str, name: str, module_id: str, script: str, output_extension: str, dual_input: bool = False, parameters: tuple[Parameter, ...] = (), validated_on: str = '')

One algorithm: a script with a typed parameter list.

python_module property

python_module: str

Importable module name, runnable with python -m.

validate

validate(params: dict[str, Any] | None) -> dict[str, str]

Check every supplied parameter and return the command-line strings. Unknown names, wrong types and out-of-range values raise :class:ParameterError with the accepted list.

Parameter dataclass

Parameter(name: str, type: str, default: Any, description: str = '', min: float | None = None, max: float | None = None, options: tuple[str, ...] = (), advanced: bool = False, rationale: str = '', validated_on: str = '')

One tunable flag of a method, as declared in the catalog.

coerce

coerce(value: Any, *, where: str = '') -> str

Validate value against this parameter and return the string the script receives on its command line. Raises :class:ParameterError.

load_catalog cached

load_catalog() -> Catalog

Load the bundled catalog once per process.