7
7
"print_properties" ,
8
8
"enable_interactive_backend_switching" ,
9
9
"disable_interactive_backend_switching" ,
10
- "retrieve_example_data " ,
10
+ "download_example_data " ,
11
11
]
12
12
13
13
import functools
24
24
VERBOSE = False
25
25
INTERACTIVE_BACKEND = "QtAgg"
26
26
INTERACTIVE_BACKEND_SWITCHING = True
27
- FILE_HASHES = {
27
+
28
+ # old example file names and hashes, will be removed in the future
29
+ OLD_FILE_HASHES = {
28
30
"Example_01_Sinus_Rabbit_Basler.npy" :
29
31
"sha256:5c692cca0459c931b7f767c27162a42b31e3df90a6aeac53bb182affa2135678" ,
30
32
"Example_02_VF_Rabbit_Di-4-ANEPPS_Basler_acA720-520um.npy" :
42
44
"Example_02_VF_Rabbit_Di-4-ANEPPS_Basler_acA720-520um_warped.npy" :
43
45
"sha256:a1781582b669a69a9753b1c43d23e0acf26fb372426eeb6d880d2e66420b2107" ,
44
46
"Example_02_VF_Rabbit_Di-4-ANEPPS_Basler_acA720-520um_warped_mask.npy" :
47
+ "sha256:3f5d8402c8251f3cb8e8d235b459264ff7e7e2cf2b81f08129f0897baa262db6" ,
48
+ }
49
+
50
+ # New example file names and hashes
51
+ FILE_HASHES = {
52
+ "Example_01_Sinus.npy" :
53
+ "sha256:5c692cca0459c931b7f767c27162a42b31e3df90a6aeac53bb182affa2135678" ,
54
+ "Example_02_VF.npy" :
55
+ "sha256:6252da91db434cad95758830fdf7c13a9db6793da30dd8e85e6878736e20787e" ,
56
+ "Example_03_Pacing.npy" :
57
+ "sha256:50113334e6955f5abb3658b5027447f507fd9eef6bfef766a628c2365ff848be" ,
58
+ "Example_04_Pacing.npy" :
59
+ "sha256:674603f64ccf754f73a264986e0bf1ee93d03ce3a9ea88f248620632046e3c40" ,
60
+ "Example_05_Ratiometry.npy" :
61
+ "sha256:10a59863ee23abc689d8ee4cd27542ef1b7b8b8eb5668a7f2dc49572f18319f2" ,
62
+ # used in tests
63
+ "test-download-file.npy" :
64
+ "sha256:0d3cfca36d8e3ad935de4d0681ddd510c1590212a99dccb196353c8ce85b7491" ,
65
+ # warped version of Example_02, used to speed up documentation build
66
+ "Example_02_VF_warped.npy" :
67
+ "sha256:a1781582b669a69a9753b1c43d23e0acf26fb372426eeb6d880d2e66420b2107" ,
68
+ "Example_02_VF_warped_mask.npy" :
45
69
"sha256:3f5d8402c8251f3cb8e8d235b459264ff7e7e2cf2b81f08129f0897baa262db6"
46
70
}
47
71
@@ -175,7 +199,12 @@ def wrapper(*args, **kwargs):
175
199
176
200
return wrapper
177
201
202
+ @deprecated ("Use download_example_data instead" )
178
203
def retrieve_example_data (name , directory = "./example_data" , silent = False ):
204
+ return download_example_data (name , directory = directory , silent = silent )
205
+
206
+
207
+ def download_example_data (name , directory = "./example_data" , silent = False ):
179
208
"""Download example data if not already present.
180
209
181
210
Parameters
@@ -192,16 +221,23 @@ def retrieve_example_data(name, directory="./example_data", silent=False):
192
221
str
193
222
Path to the file.
194
223
"""
195
- known_hash = FILE_HASHES .get (name , None )
196
- if known_hash is None :
197
- warnings .warn (f"WARNING: Example file '{ name } ' is not known. Attempting to download it anyway." , UserWarning )
198
224
if silent :
199
225
silent = pooch .get_logger ().level
200
226
pooch .get_logger ().setLevel ("WARNING" )
201
227
228
+ known_hash = FILE_HASHES .get (name , None )
229
+ remote_path = urllib .parse .quote (f"optimap-{ name } " , safe = "" )
230
+
231
+ # Compatibility with old file names, will be removed in the future
232
+ if known_hash is None and name in OLD_FILE_HASHES :
233
+ known_hash = OLD_FILE_HASHES [name ]
234
+ remote_path = urllib .parse .quote (f"{ name } " , safe = "" )
235
+
236
+ if known_hash is None :
237
+ warnings .warn (f"WARNING: Example file '{ name } ' is not known. Attempting to download it anyway." , UserWarning )
238
+
202
239
# The CMS server only allows files with a certain extensions to be uploaded.
203
240
# We use .webm as dummy extension to upload the files, and rename them after download.
204
- remote_path = urllib .parse .quote (f"{ name } " , safe = "" )
205
241
url = f"https://cardiacvision.ucsf.edu/sites/g/files/tkssra6821/f/{ remote_path } _.webm"
206
242
207
243
path = pooch .retrieve (
0 commit comments