Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Datasets
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Data-Analytics
Datasets
Commits
b5afcb7d
Commit
b5afcb7d
authored
Jul 19, 2018
by
Agnes Ansari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
6a16c2f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
download_data.py
download_data.py
+50
-0
No files found.
download_data.py
0 → 100644
View file @
b5afcb7d
# Author: Alexandre Boucaud <aboucaud@lal.in2p3.fr>
# License: BSD 3 clause
from
__future__
import
print_function
import
os
import
sys
try
:
from
urllib.request
import
urlretrieve
except
ImportError
:
from
urllib
import
urlretrieve
URLBASE
=
'https://storage.ramp.studio/astrophd_tutorial/{}'
DATA
=
[
'data_prace_train.npy'
,
'data_prace_test.npy'
,
'labels_prace_train.npy'
,
'labels_prace_test.npy'
]
def
main
(
path
=
None
,
output_dir
=
'data'
):
path
=
path
or
""
fullpath
=
os
.
path
.
join
(
path
,
output_dir
)
filenames
=
DATA
urls
=
[
URLBASE
.
format
(
filename
)
for
filename
in
filenames
]
if
not
os
.
path
.
exists
(
fullpath
):
os
.
mkdir
(
fullpath
)
for
url
,
filename
in
zip
(
urls
,
filenames
):
output_file
=
os
.
path
.
join
(
fullpath
,
filename
.
replace
(
'_prace'
,
''
))
if
os
.
path
.
exists
(
output_file
):
print
(
"{} already downloaded"
.
format
(
filename
))
continue
print
(
"Downloading from {} ..."
.
format
(
url
))
urlretrieve
(
url
,
filename
=
output_file
)
print
(
"=> File saved as {}"
.
format
(
output_file
))
if
__name__
==
'__main__'
:
try
:
path
=
sys
.
argv
[
1
]
main
(
path
=
path
)
except
IndexError
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment