From 2082f683c3e03ba38e47061a29cf96b937a4cd20 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 12:52:42 -0500 Subject: [PATCH 1/7] add env var to 02 io --- doc/user_guide/02_input_output.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/user_guide/02_input_output.md b/doc/user_guide/02_input_output.md index 9588ff9b..b44abe18 100644 --- a/doc/user_guide/02_input_output.md +++ b/doc/user_guide/02_input_output.md @@ -43,9 +43,10 @@ import os import requests, math import tqdm -nwb_path = 'A2929-200711.nwb' +data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") +nwb_path = os.path.join(data_dir, "A2929-200711.nwb") -if nwb_path not in os.listdir("."): +if os.path.exists(nwb_path): r = requests.get(f"https://osf.io/fqht6/download", stream=True) block_size = 1024*1024 with open(nwb_path, 'wb') as f: @@ -266,10 +267,11 @@ print(sta) import zipfile -project_path = "MyProject" +data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") +project_path = os.path.join(data_dir, "MyProject") -if project_path not in os.listdir("."): +if not os.path.exists(project_path+".zip"): r = requests.get(f"https://osf.io/a9n6r/download", stream=True) block_size = 1024*1024 with open(project_path+".zip", 'wb') as f: From 4c9a2f22ba1bf9210c4b0b274a338d16ab5b5f34 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 12:53:33 -0500 Subject: [PATCH 2/7] added env var to calcium img --- doc/examples/tutorial_calcium_imaging.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/examples/tutorial_calcium_imaging.md b/doc/examples/tutorial_calcium_imaging.md index 396a8bcf..4f7b41bb 100644 --- a/doc/examples/tutorial_calcium_imaging.md +++ b/doc/examples/tutorial_calcium_imaging.md @@ -42,8 +42,9 @@ Downloading the data First things first: let's find our file. ```{code-cell} ipython3 -path = "A0670-221213.nwb" -if path not in os.listdir("."): +data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") +path = os.path.join(data_dir, "A0670-221213.nwb") +if not os.path.exists(path): r = requests.get(f"https://osf.io/sbnaw/download", stream=True) block_size = 1024*1024 with open(path, 'wb') as f: From af86fa23b00abe0ba90fa70f5743a49d9ccd0e62 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 12:53:46 -0500 Subject: [PATCH 3/7] add to hd cells --- doc/examples/tutorial_HD_dataset.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/examples/tutorial_HD_dataset.md b/doc/examples/tutorial_HD_dataset.md index f39572bc..0e60d3f2 100644 --- a/doc/examples/tutorial_HD_dataset.md +++ b/doc/examples/tutorial_HD_dataset.md @@ -41,8 +41,9 @@ Downloading the data It's a small NWB file. ```{code-cell} ipython3 -path = "Mouse32-140822.nwb" -if path not in os.listdir("."): +data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") +path = os.path.join(data_dir, "Mouse32-140822.nwb") +if not os.path.exists(path): r = requests.get(f"https://osf.io/jb2gd/download", stream=True) block_size = 1024*1024 with open(path, 'wb') as f: From 011e6cea1b28221e3e5b350685fdc792551b8e8f Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 12:53:55 -0500 Subject: [PATCH 4/7] add to phase prec --- doc/examples/tutorial_phase_preferences.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/examples/tutorial_phase_preferences.md b/doc/examples/tutorial_phase_preferences.md index 40f3c98e..757aa5f5 100644 --- a/doc/examples/tutorial_phase_preferences.md +++ b/doc/examples/tutorial_phase_preferences.md @@ -42,8 +42,9 @@ Downloading the data Let's download the data and save it locally. ```{code-cell} ipython3 -path = "Achilles_10252013_EEG.nwb" -if path not in os.listdir("."): +data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") +path = os.path.join(data_dir, "Achilles_10252013_EEG.nwb") +if not os.path.exists(path): r = requests.get(f"https://osf.io/2dfvp/download", stream=True) block_size = 1024 * 1024 with open(path, "wb") as f: From 61a77ea52e912eb4726daf8bfdcccc17a293b346 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 12:54:06 -0500 Subject: [PATCH 5/7] add to wavelet --- doc/examples/tutorial_wavelet_decomposition.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/examples/tutorial_wavelet_decomposition.md b/doc/examples/tutorial_wavelet_decomposition.md index 46791298..e7d9d9e1 100644 --- a/doc/examples/tutorial_wavelet_decomposition.md +++ b/doc/examples/tutorial_wavelet_decomposition.md @@ -51,8 +51,9 @@ Let's download the data and save it locally jupyter: outputs_hidden: false --- -path = "Achilles_10252013_EEG.nwb" -if path not in os.listdir("."): +data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") +path = os.path.join(data_dir, "Achilles_10252013_EEG.nwb") +if not os.path.exists(path): r = requests.get(f"https://osf.io/2dfvp/download", stream=True) block_size = 1024 * 1024 with open(path, "wb") as f: From 332cfe16317a5b973ed0c461748999e78084212d Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 14:25:01 -0500 Subject: [PATCH 6/7] fix 02 --- doc/user_guide/02_input_output.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user_guide/02_input_output.md b/doc/user_guide/02_input_output.md index b44abe18..fe7bdc5b 100644 --- a/doc/user_guide/02_input_output.md +++ b/doc/user_guide/02_input_output.md @@ -271,7 +271,7 @@ data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") project_path = os.path.join(data_dir, "MyProject") -if not os.path.exists(project_path+".zip"): +if not os.path.exists(project_path): r = requests.get(f"https://osf.io/a9n6r/download", stream=True) block_size = 1024*1024 with open(project_path+".zip", 'wb') as f: @@ -280,7 +280,7 @@ if not os.path.exists(project_path+".zip"): f.write(data) with zipfile.ZipFile(project_path+".zip", 'r') as zip_ref: - zip_ref.extractall(".") + zip_ref.extractall(data_dir) ``` From ef73b59eb09220f6ad7712f4b708a5094a7fc7f4 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Mon, 10 Nov 2025 14:28:50 -0500 Subject: [PATCH 7/7] fix 02 bis --- doc/user_guide/02_input_output.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user_guide/02_input_output.md b/doc/user_guide/02_input_output.md index fe7bdc5b..c9b584bf 100644 --- a/doc/user_guide/02_input_output.md +++ b/doc/user_guide/02_input_output.md @@ -46,7 +46,7 @@ import tqdm data_dir = os.environ.get("PYNAPPLE_DATA_DIR", ".") nwb_path = os.path.join(data_dir, "A2929-200711.nwb") -if os.path.exists(nwb_path): +if not os.path.exists(nwb_path): r = requests.get(f"https://osf.io/fqht6/download", stream=True) block_size = 1024*1024 with open(nwb_path, 'wb') as f: