plenoptic.data package
Submodules
plenoptic.data.data_utils module
- plenoptic.data.data_utils.get(*item_names, as_gray=None)[source]
Load an image based on the item name from the package’s data resources.
- Parameters:
item_names (
str
) – The names of the items to load, without specifying the file extension.as_gray (
Optional
[bool
]) – Whether to load in the image(s) as grayscale or not. If None, will make best guess based on file extension.
- Return type:
The loaded image object. The exact return type depends on the load_images function implementation.
Notes
This function first retrieves the full filename using get_filename and then loads the image using load_images from the tools.data module. It supports loading images as grayscale if they have a .pgm extension.
- plenoptic.data.data_utils.get_path(item_name)[source]
Retrieve the filename that matches the given item name with any extension.
- Parameters:
item_name (
str
) – The name of the item to find the file for, without specifying the file extension.- Return type:
Traversable
- Returns:
The filename matching the item_name with its extension.
- Raises:
AssertionError – If no files or more than one file match the item_name.
Notes
This function uses glob to search for files in the current directory matching the item_name. It is assumed that there is only one file matching the name regardless of its extension.
plenoptic.data.fetch module
Fetch data using pooch.
This is inspired by scipy’s datasets module.
- plenoptic.data.fetch.fetch_data(dataset_name)[source]
Download data, using pooch. These are largely used for testing.
To view list of downloadable files, look at DOWNLOADABLE_FILES.
This checks whether the data already exists and is unchanged and downloads again, if necessary. If dataset_name ends in .tar.gz, this also decompresses and extracts the archive, returning the Path to the resulting directory. Else, it just returns the Path to the downloaded file.
- Return type:
Path
Find directory shared by all paths.
- Return type:
Path
Module contents
- plenoptic.data.fetch_data(dataset_name)[source]
Download data, using pooch. These are largely used for testing.
To view list of downloadable files, look at DOWNLOADABLE_FILES.
This checks whether the data already exists and is unchanged and downloads again, if necessary. If dataset_name ends in .tar.gz, this also decompresses and extracts the archive, returning the Path to the resulting directory. Else, it just returns the Path to the downloaded file.
- Return type:
Path