phasorpy.datasets#

Manage sample data files for testing and tutorials.

The phasorpy.datasets module provides a fetch() function to download data files from remote repositories and cache them in a local directory.

Datasets from the following repositories are available:

The implementation is based on the Pooch library.

The default cache location is determined by the Pooch library, but can be overridden by setting the PHASORPY_DATA_DIR environment variable to a custom directory path.

phasorpy.datasets.fetch(*args, extract_dir='.', return_scalar=True, **kwargs)[source]#

Return absolute path(s) to sample file(s) in local storage.

The files are downloaded from a remote repository if not present in local storage.

Parameters:
  • *args (str, iterable of str, or pooch.Pooch) –

    Name(s) of file(s) or repositories to fetch from local storage. Can be:

    • File names (for example, ‘simfcs.r64’)

    • Repository names (for example, ‘tests’, ‘flute’)

    • Pooch repository objects

    • Iterables of the above

    If omitted, return files in all repositories.

  • extract_dir (str or None, optional) – Path, relative to cache location, where ZIP files will be unpacked.

  • return_scalar (bool, optional) – If true (default), return single path as string, else tuple of string.

  • **kwargs – Additional arguments passed to pooch.fetch(). For example, progressbar=True.

Returns:

Absolute path(s) of file(s) in local storage. Returns a single string if only one file and return_scalar=True, otherwise returns a tuple of strings.

Return type:

str or tuple of str

Raises:

ValueError – If specified file is not found in any repository.

Examples

>>> fetch('simfcs.r64')
'...simfcs.r64'
>>> fetch('simfcs.r64', 'simfcs.ref')
('...simfcs.r64', '...simfcs.ref')
phasorpy.datasets.REPOSITORIES#

Dictionary mapping repository names to Pooch repository objects.

Each repository provides access to a specific collection of sample data files that can be fetched using the fetch() function.