Skip to content

Commit e95559b

Browse files
committed
recheck all the paths, fix pathing errors when deployed on codebook
1 parent 98b5512 commit e95559b

13 files changed

+128
-1321
lines changed

01-Calcium_Imaging/02-Imported Tables - Interactive.ipynb

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"source": [
5151
"import numpy as np\n",
5252
"import matplotlib.pyplot as plt\n",
53-
"\n",
5453
"%matplotlib inline"
5554
]
5655
},
@@ -67,8 +66,6 @@
6766
"metadata": {},
6867
"outputs": [],
6968
"source": [
70-
"import os\n",
71-
"if os.path.basename(os.getcwd())!='notebooks': os.chdir('/home/notebooks')\n",
7269
"from tutorial_pipeline.mouse_session import schema, Mouse, Session"
7370
]
7471
},
@@ -176,7 +173,18 @@
176173
"metadata": {},
177174
"outputs": [],
178175
"source": [
179-
"ls data"
176+
"from tutorial_pipeline import data_dir\n",
177+
"data_dir"
178+
]
179+
},
180+
{
181+
"cell_type": "code",
182+
"execution_count": null,
183+
"metadata": {},
184+
"outputs": [],
185+
"source": [
186+
"for f in data_dir.glob('*.tif'):\n",
187+
" print(f)"
180188
]
181189
},
182190
{
@@ -229,8 +237,9 @@
229237
"metadata": {},
230238
"outputs": [],
231239
"source": [
240+
"import os\n",
232241
"from skimage import io\n",
233-
"im = io.imread('data/example_scan_01.tif')\n",
242+
"im = io.imread(data_dir / 'example_scan_01.tif')\n",
234243
"print(im.shape)"
235244
]
236245
},
@@ -705,7 +714,12 @@
705714
"name": "python",
706715
"nbconvert_exporter": "python",
707716
"pygments_lexer": "ipython3",
708-
"version": "3.7.3"
717+
"version": "3.7.16"
718+
},
719+
"vscode": {
720+
"interpreter": {
721+
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1"
722+
}
709723
}
710724
},
711725
"nbformat": 4,

01-Calcium_Imaging/03-Computed Table, Lookup Table, and Part Table - Interactive.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
"metadata": {},
7070
"outputs": [],
7171
"source": [
72-
"import os\n",
73-
"if os.path.basename(os.getcwd())!='notebooks': os.chdir('/home/notebooks')\n",
7472
"from tutorial_pipeline.imaging import schema, Mouse, Session, Scan, AverageFrame"
7573
]
7674
},
@@ -1033,7 +1031,12 @@
10331031
"name": "python",
10341032
"nbconvert_exporter": "python",
10351033
"pygments_lexer": "ipython3",
1036-
"version": "3.7.3"
1034+
"version": "3.7.16"
1035+
},
1036+
"vscode": {
1037+
"interpreter": {
1038+
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1"
1039+
}
10371040
}
10381041
},
10391042
"nbformat": 4,

02-Electrophysiology/02-Imported Tables - Interactive.ipynb

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@
6666
"metadata": {},
6767
"outputs": [],
6868
"source": [
69-
"import os\n",
70-
"if os.path.basename(os.getcwd())!='notebooks': os.chdir('/home/notebooks')\n",
7169
"from tutorial_pipeline.mouse_session import schema, Mouse, Session"
7270
]
7371
},
@@ -129,6 +127,16 @@
129127
"So `data_100_2017-05-25.npy` is the data for session identified by `mouse_id = 100` and `session_date = \"2017-05-25\"`."
130128
]
131129
},
130+
{
131+
"cell_type": "code",
132+
"execution_count": null,
133+
"metadata": {},
134+
"outputs": [],
135+
"source": [
136+
"from tutorial_pipeline import data_dir\n",
137+
"data_dir"
138+
]
139+
},
132140
{
133141
"cell_type": "markdown",
134142
"metadata": {},
@@ -199,7 +207,7 @@
199207
"metadata": {},
200208
"outputs": [],
201209
"source": [
202-
"filename = 'data/data_{mouse_id}_{session_date}.npy'.format(**key)\n",
210+
"filename = '{data_dir}/data_{mouse_id}_{session_date}.npy'.format(**key, data_dir=data_dir)\n",
203211
"filename"
204212
]
205213
},
@@ -489,7 +497,7 @@
489497
" \"\"\"\n",
490498
" def make(self, key):\n",
491499
" # use key dictionary to determine the data file path\n",
492-
" data_file = \"data/data_{mouse_id}_{session_date}.npy\".format(**key)\n",
500+
" data_file = '{data_dir}/data_{mouse_id}_{session_date}.npy'.format(**key, data_dir=data_dir)\n",
493501
"\n",
494502
" # load the data\n",
495503
" data = np.load(data_file)\n",
@@ -663,7 +671,7 @@
663671
"formats": "ipynb,py:light"
664672
},
665673
"kernelspec": {
666-
"display_name": "Python 3 (ipykernel)",
674+
"display_name": "Python 3",
667675
"language": "python",
668676
"name": "python3"
669677
},
@@ -677,7 +685,12 @@
677685
"name": "python",
678686
"nbconvert_exporter": "python",
679687
"pygments_lexer": "ipython3",
680-
"version": "3.8.12"
688+
"version": "3.7.16"
689+
},
690+
"vscode": {
691+
"interpreter": {
692+
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1"
693+
}
681694
}
682695
},
683696
"nbformat": 4,

02-Electrophysiology/02-Imported Tables - Interactive.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
# Now we would like to continue working with the tables we defined in the previous notebook. To do so, we would need the classes for each table: `Mouse` and `Session`. We can either redefine it here, but for your convenience, we have included the schema and table class definitions in a package called `tutorial_pipeline.mouse_session`, from which you can import the classes as well as the schema object. We will use the schema object again to define more tables.
3636

37-
import os
38-
if os.path.basename(os.getcwd())!='notebooks': os.chdir('/home/notebooks')
3937
from tutorial_pipeline.mouse_session import schema, Mouse, Session
4038

4139
Mouse()
@@ -76,7 +74,7 @@
7674
key = keys[0]
7775
key
7876

79-
filename = 'data/data_{mouse_id}_{session_date}.npy'.format(**key)
77+
filename = '../data/data_{mouse_id}_{session_date}.npy'.format(**key)
8078
filename
8179

8280
# Here we have made use of Python's dictionary unpacking and `format` method on strings to generate the filename from the `key`.
@@ -184,7 +182,7 @@ class Neuron(dj.Imported):
184182
"""
185183
def make(self, key):
186184
# use key dictionary to determine the data file path
187-
data_file = "data/data_{mouse_id}_{session_date}.npy".format(**key)
185+
data_file = "../data/data_{mouse_id}_{session_date}.npy".format(**key)
188186

189187
# load the data
190188
data = np.load(data_file)

02-Electrophysiology/03-Computed Table, Lookup Table, and Part Table - Interactive.ipynb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
"metadata": {},
7070
"outputs": [],
7171
"source": [
72-
"import os\n",
73-
"if os.path.basename(os.getcwd())!='notebooks': os.chdir('/home/notebooks')\n",
7472
"from tutorial_pipeline.ephys_cell_activity import schema, Mouse, Session, Neuron"
7573
]
7674
},
@@ -1098,7 +1096,7 @@
10981096
"formats": "ipynb,py:light"
10991097
},
11001098
"kernelspec": {
1101-
"display_name": "Python 3 (ipykernel)",
1099+
"display_name": "Python 3",
11021100
"language": "python",
11031101
"name": "python3"
11041102
},
@@ -1112,7 +1110,12 @@
11121110
"name": "python",
11131111
"nbconvert_exporter": "python",
11141112
"pygments_lexer": "ipython3",
1115-
"version": "3.8.12"
1113+
"version": "3.7.16"
1114+
},
1115+
"vscode": {
1116+
"interpreter": {
1117+
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1"
1118+
}
11161119
}
11171120
},
11181121
"nbformat": 4,

02-Electrophysiology/03-Computed Table, Lookup Table, and Part Table - Interactive.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737

3838
# Similarly as before, to continue working with the tables we defined in the previous notebook, we can either redefine the classes for each table `Mouse`, `Session`, `Neuron` and populate them. Or, again for your convenience, we can import them from the `tutorial_pipeline.ephys_cell_activity` module.
3939

40-
import os
41-
if os.path.basename(os.getcwd())!='notebooks': os.chdir('/home/notebooks')
4240
from tutorial_pipeline.ephys_cell_activity import schema, Mouse, Session, Neuron
4341

4442
Session()

03-Completed_Exercises/02-calcium_imaging - Imported Tables - Completed.ipynb

Lines changed: 16 additions & 312 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)