Closed abhi-glitchhg closed 1 year ago
Oh that is super simple:
import pooch
files = pooch.retrieve(
url='doi:10.5281/zenodo.4263723/tvb_data.zip',
known_hash=None,
downloader=pooch.DOIDownloader(),
processor=pooch.Unzip()
)
The download is cached, and you can also substitute the None
with actual hash which gets printed out on first download...
I will improve the docs and tests soon.
an example how user can download and fetch the data.
from tvb.datasets import TVB_Data
tvb_data = TVB_Data(version = "2.0.3")
connectivity_66_path = tvb_data.fetch_data("connectivity_66.zip")
print(connectivity_66_path, connectivity_66_path.is_file())
ql_bold_path = tvb_data.fetch_data("QL_BOLD_regiontimecourse.mat")
print(ql_bold_path, ql_bold_path.is_file())
output of the above script.
file tvb_data.zip is downloaded at /home/abhijit/.cache/pooch/df068f14e199441033182c2ea36820e8-tvb_data.zip
/home/abhijit/oss/gsoc/tvb-root/tvb_library/tvb_data/connectivity/connectivity_66.zip True
/home/abhijit/oss/gsoc/tvb-root/tvb_library/tvb_data/berlinSubjects/QL_20120814/QL_BOLD_regiontimecourse.mat True
Using Pyzenodo3 to download the repositories.
Still work in progress. Could think of using
Pooch
to handle the downloading and remove theutils.py
.