Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Framework to download entities from Zenodo #675

Merged
merged 19 commits into from
Jun 29, 2023

Conversation

abhi-glitchhg
Copy link
Collaborator

@abhi-glitchhg abhi-glitchhg commented May 12, 2023

Using Pyzenodo3 to download the repositories.

Still work in progress. Could think of using Pooch to handle the downloading and remove the utils.py.

@i-Zaak
Copy link
Contributor

i-Zaak commented May 12, 2023

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...

@abhi-glitchhg
Copy link
Collaborator Author

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

@abhi-glitchhg abhi-glitchhg changed the title [WIP] Using pyzenodo3 code connect with Zenodo. [WIP] Framework to download entities from Zenodo Jun 16, 2023
@liadomide liadomide added the enhancement New feature or request label Jun 16, 2023
@abhi-glitchhg abhi-glitchhg marked this pull request as ready for review June 16, 2023 07:52
Comment on lines 37 to 38

file_path = pooch.retrieve(url= url, known_hash= known_hash, progressbar=True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as im using pooch.retrieve, the files are downloaded to ~/.cache/pooch, I plan to change this to ~/.cache/tvb.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use here the target_download param that we discussed earlier ?

tvb_library/tvb/datasets/base.py Show resolved Hide resolved
tvb_library/tvb/datasets/base.py Outdated Show resolved Hide resolved
tvb_library/tvb/datasets/tvb_data.py Outdated Show resolved Hide resolved
tvb_library/tvb/datasets/tvb_data.py Show resolved Hide resolved
tvb_library/tvb/datasets/base.py Outdated Show resolved Hide resolved
@abhi-glitchhg abhi-glitchhg changed the base branch from master to TVB-1999-deo June 23, 2023 07:28
@abhi-glitchhg abhi-glitchhg merged commit ace365f into the-virtual-brain:TVB-1999-deo Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants