pulse2percept.datasets.base¶
get_data_dir
, clear_data_dir
, fetch_url
Functions
clear_data_dir ([data_dir]) |
Delete all content in the data directory |
fetch_url (url, file_path[, progress_bar, …]) |
Download a remote file |
get_data_dir ([data_dir]) |
Return the path of the pulse2percept data directory |
-
pulse2percept.datasets.base.
clear_data_dir
(data_dir=None)[source]¶ Delete all content in the data directory
By default, this is set to a directory called ‘pulse2percept_data’ in the user home directory. Alternatively, it can be set by a
PULSE2PERCEPT_DATA
environment variable or set programmatically by specifying a path.New in version 0.6.
Parameters: data_dir (str or None) – The path to the pulse2percept data directory.
-
pulse2percept.datasets.base.
fetch_url
(url, file_path, progress_bar=<function _report_hook>, remote_checksum=None)[source]¶ Download a remote file
Fetch a dataset pointed to by
url
, check its SHA-256 checksum for integrity, and save it tofile_path
.New in version 0.6.
Parameters: - url (string) – URL of file to download
- file_path (string) – Path to the local file that will be created
- progress_bar (func callback, optional) – A callback to a function
func(count, block_size, total_size)
that will display a progress bar. - remote_checksum (str, optional) – The expected SHA-256 checksum of the file.
-
pulse2percept.datasets.base.
get_data_dir
(data_dir=None)[source]¶ Return the path of the pulse2percept data directory
This directory is used to store the datasets retrieved by the data fetch utility functions to avoid downloading the data several times.
By default, this is set to a directory called ‘pulse2percept_data’ in the user home directory. Alternatively, it can be set by a
PULSE2PERCEPT_DATA
environment variable or set programmatically by specifying a path.If the directory does not already exist, it is automatically created.
New in version 0.6.
Parameters: data_dir (str or None) – The path to the pulse2percept data directory.