fetch#

ktch.datasets.fetch(name: str, *, data_home: str | Path | None = None, version: str | None = None) str[source]#

Fetch an example data file and return its local path.

Example data are individual sample files used in tutorials and demonstrations. Unlike load_landmark_mosquito_wings() and other load_* functions that return loaded data, this function returns a file path so that tutorials can demonstrate I/O operations.

Available example files:

Name

Type

Size

landmarks_triangle.tps

bundled

6.5 KB

danshaku_08_allSegments_SPHARM.coef

bundled

22 KB

danshaku_08_allSegments_para.vtp

remote

danshaku_08_allSegments_surf.vtp

remote

Parameters:
namestr

Filename of the example data (e.g., "landmarks_triangle.tps").

data_homestr, Path, or None

Directory to store the file. For remote files, this is the download cache directory; defaults to pooch.os_cache("ktch-examples"). For bundled files, if specified the file is copied to this directory; if None the in-package path is returned directly.

versionstr or None

Version string for remote files (e.g., "1"). Ignored for bundled files. If None, uses the default version for the current ktch release.

Returns:
str

Absolute path to the local file.

Raises:
ValueError

If name is not a known example file.

ImportError

If the file is remote and pooch is not installed.

Examples

>>> from ktch.datasets import fetch
>>> path = fetch("landmarks_triangle.tps")
>>> path.endswith("landmarks_triangle.tps")
True