Datasets¶
The datasets
module provides two kinds of helper
functions that can be used to load datasets from the bionic vision community:
- Dataset loaders can be used to load small datasets that come
pre-packaged with the pulse2percept software.
load_horsager2009
: Load the threshold data from [Horsager2009].load_nanduri2012
: Load the brightness rating data from [Nanduri2012].load_perezfornos2012
: Load the phosphene fading data from [PerezFornos2012].
- Dataset fetchers can be used to download larger datasets from a given
URL and directly import them into pulse2percept.
fetch_beyeler2019
: Download and load the phosphene drawing dataset from [Beyeler2019].fetch_han2021
: Download and load the outdoor scenes from [Han2021].
Note
You will need Pandas (pip install pandas
) to load the data.
Some datasets also require HDF5 (pip install h5py
).
Local data directory¶
By default, all datasets are downloaded to a directory called ‘pulse2percept_data’ located in the user home directory. This directory is used as a cache so that large datasets don’t have to be downloaded repeatedly.
Alternatively, the directory can be set by a PULSE2PERCEPT_DATA
environment
variable, or passed directly to the fetcher.
You can retrieve the current data directory as follows:
import pulse2percept as p2p
p2p.datasets.get_data_dir()
You can delete the folder and all its contents as follows:
import pulse2percept as p2p
p2p.datasets.clear_data_dir()
Note
Make sure you have write access to the specified data directory.
Examples using datasets¶

Horsager et al. (2009): Predicting temporal sensitivity