Skip to content

Commit 6519d21

Browse files
committed
update download uitls for using path
1 parent 5c421b6 commit 6519d21

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fooof/utils/download.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
"""Functions and utilities for downloading example data for fooof."""
22

33
import os
4+
from pathlib import Path
45
from urllib.request import urlretrieve
56

67
import numpy as np
78

9+
from fooof.core.io import fpath
10+
811
###################################################################################################
912
###################################################################################################
1013

@@ -15,7 +18,7 @@ def check_data_folder(folder):
1518
1619
Parameters
1720
----------
18-
folder : str
21+
folder : Path or str
1922
Name of the folder to check and create if missing.
2023
"""
2124

@@ -30,11 +33,13 @@ def check_data_file(filename, folder, url=DATA_URL):
3033
----------
3134
filename : str
3235
Name of the data file to check and download if missing.
33-
folder : str
36+
folder : Path or str
3437
Name of the folder to save the datafile to.
38+
url : str, optional
39+
The URL to download the data file from.
3540
"""
3641

37-
filepath = os.path.join(folder, filename)
42+
filepath = fpath(folder, filename)
3843

3944
if not os.path.isfile(filepath):
4045
urlretrieve(url + filename, filename=filepath)
@@ -47,7 +52,7 @@ def fetch_fooof_data(filename, folder='data', url=DATA_URL):
4752
----------
4853
filename : str
4954
Name of the data file to download.
50-
folder : str, optional
55+
folder : Path or str, optional
5156
Name of the folder to save the datafile to.
5257
url : str, optional
5358
The URL to download the data file from.
@@ -69,7 +74,7 @@ def load_fooof_data(filename, folder='data', url=DATA_URL):
6974
----------
7075
filename : str
7176
Name of the data file to download.
72-
folder : str, optional
77+
folder : Path or str, optional
7378
Name of the folder to save the datafile to.
7479
url : str, optional
7580
The URL to download the data file from.

0 commit comments

Comments
 (0)