Skip to content

porestore

Images and remote calculations through the public PoreStore API.

Client

A service/team connection. Storage transfers use a separate, uncredentialed client.

Missing values are read from PORESTORE_API_KEY, PORESTORE_TEAM_ID and PORESTORE_URL in the environment, then .env in the current working directory. Explicit arguments take precedence. No request is made until an operation is called, and .env values do not modify the environment.

base_url = base_url instance-attribute

team_id = team_id instance-attribute

cache_dir = Path(cache_dir or Path.home() / '.cache' / 'porestore').expanduser() instance-attribute

close()

get_image(image_id)

get_job(job_id)

analysis_types()

Return available analyses and their current parameter schemas.

APIError

Bases: PoreStoreError

A public API or storage request was rejected.

status_code = status_code instance-attribute

code = code instance-attribute

details = details instance-attribute

ImageNotReadyError

Bases: PoreStoreError

The image has not finished ingestion.

ImageProcessingError

Bases: PoreStoreError

Remote image ingestion failed.

JobCancelledError

Bases: JobFailedError

A remote calculation was cancelled.

JobFailedError

Bases: PoreStoreError

A remote calculation failed.

NetworkDataError

Bases: PoreStoreError, ValueError

A network artifact is unavailable to this Result or cannot be decoded safely.

PoreStoreError

Bases: Exception

Base class for SDK errors.

ResultNotReadyError

Bases: PoreStoreError

The remote calculation has not completed.

TransportError

Bases: PoreStoreError

A request failed; reuse idempotency_key when retrying a submission.

idempotency_key = idempotency_key instance-attribute

WaitTimeoutError

Bases: PoreStoreError, TimeoutError

An explicitly requested wait exceeded its time limit.

Image

A local array, a remote image, or both. Properties never fetch data implicitly.

array = array instance-attribute

client property

id property

status property

metadata property

metrics: Solution property

Already-returned image metrics as a table; refresh metadata explicitly.

Reading this property never starts a job, downloads an array, or fetches metadata. Values and units are exactly those returned by the API.

from_numpy(array, **kwargs) classmethod

from_id(image_id, *, client=None) classmethod

Recover metadata for an existing image, without downloading its array.

upload(*, client=None) -> Image

Serialize a local array as NPY, upload directly, and start ingestion.

Returns this Image immediately after registration; call wait_until_ready explicitly before submitting calculations. Repeated uploads of the same Image reuse its existing remote record. Construct a new Image to upload edits.

refresh() -> Image

wait_until_ready(*, timeout: float = 300.0, poll_interval: float = 2.0) -> Image

download(*, refresh: bool = False) -> np.ndarray

Download the stored sample as NumPy; retain an in-memory copy until refresh=True.

This retrieves the current ingested image, which may differ from the original upload. Zarr decompression runs in the notebook process.

Job

An accepted remote job. Reading properties performs no network requests.

client = client instance-attribute

idempotency_key = idempotency_key instance-attribute

reused = reused instance-attribute

id property

status property

image_id property

analysis_type property

metadata property

from_id(job_id, *, client=None) classmethod

refresh() -> Job

wait(*, timeout: float = 600.0, poll_interval: float = 2.0) -> Job

get_result(*, wait: bool = False, timeout: float = 600.0, poll_interval: float = 2.0, refresh: bool = False) -> Result

Retrieve outputs, using persistent cache unless refresh=True; waiting is opt-in.

Result dataclass

Outputs and metadata exactly as returned by the public API, including units.

job_id: str instance-attribute

metrics: dict instance-attribute

network property

The last explicitly downloaded network, or None; reading performs no I/O.

network_metadata property

Stored units and artifact version from the last explicit network download.

solution property

download_network(*, refresh: bool = False)

Download a NumPy network dictionary in its stored units; OpenPNM is optional.

Solution

Bases: dict

A dictionary with compact plain-text and notebook table representations.

The API's curated summary tables are displayed first when available. Full raw outputs appear in a collapsed notebook section or through .details. Raw floating-point display uses six significant figures and collections are summarized. Dictionary operations retain the original data and precision.

details property

Return a table-formatted dictionary copy of every raw field, including provenance.

get(key, default=None)

configure(**kwargs)

Configure the default connection from arguments, the environment, and cwd/.env.

upload(data: np.ndarray | str | PathLike, *, name: str | None = None, description: str = '', voxel_size: float | None = None, client=None, wait: bool = False, timeout: float = 300.0, poll_interval: float = 2.0, raw_metadata: dict | None = None) -> Image

Upload a NumPy array or local file and return its remote Image.

Uses the configured connection unless client is supplied. Arrays are sent as NPY; the API selects a file decoder from the filename's extension. RAW files also need raw_metadata containing their dimensions and dtype. voxel_size is in micrometres. With wait=True, wait for ingestion to finish before returning; by default, return immediately after registration.

get_image(image_id, *, client=None)

get_job(job_id, *, client=None)