Skip to content

Commit 6a2b1d0

Browse files
committed
Adjusted intro notebooks to run with example nwb
1 parent 529b7f7 commit 6a2b1d0

File tree

4 files changed

+130
-28
lines changed

4 files changed

+130
-28
lines changed

docs/basics/download_nwb.ipynb

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": null,
22+
"execution_count": 1,
2323
"id": "8f34eecf",
2424
"metadata": {},
2525
"outputs": [],
@@ -38,23 +38,38 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": null,
41+
"execution_count": 2,
4242
"id": "67536d37",
4343
"metadata": {},
4444
"outputs": [],
4545
"source": [
4646
"dandiset_id = \"000021\"\n",
47-
"data_loc = \"~/data\"\n",
47+
"download_loc = \".\"\n",
4848
"authenticate = False\n",
49-
"dandi_api_key = \"your_api_key_here\""
49+
"dandi_api_key = \"\""
5050
]
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": null,
54+
"execution_count": 3,
5555
"id": "a309c067",
5656
"metadata": {},
57-
"outputs": [],
57+
"outputs": [
58+
{
59+
"name": "stderr",
60+
"output_type": "stream",
61+
"text": [
62+
"A newer version (0.46.6) of dandi/dandi-cli is available. You are using 0.46.3\n"
63+
]
64+
},
65+
{
66+
"name": "stdout",
67+
"output_type": "stream",
68+
"text": [
69+
"Got dandiset DANDI:000021/draft\n"
70+
]
71+
}
72+
],
5873
"source": [
5974
"if authenticate:\n",
6075
" client = dandiapi.DandiAPIClient(token=dandi_api_key)\n",
@@ -76,7 +91,7 @@
7691
},
7792
{
7893
"cell_type": "code",
79-
"execution_count": null,
94+
"execution_count": 4,
8095
"id": "fe9aa40c",
8196
"metadata": {},
8297
"outputs": [],
@@ -86,17 +101,25 @@
86101
},
87102
{
88103
"cell_type": "code",
89-
"execution_count": null,
104+
"execution_count": 5,
90105
"id": "a110beeb",
91106
"metadata": {},
92-
"outputs": [],
107+
"outputs": [
108+
{
109+
"name": "stdout",
110+
"output_type": "stream",
111+
"text": [
112+
"Downloaded file to ./sub-699733573_ses-715093703.nwb\n"
113+
]
114+
}
115+
],
93116
"source": [
94117
"filename = filepath.split(\"/\")[-1]\n",
95118
"file = my_dandiset.get_asset_by_path(filepath)\n",
96119
"# this may take awhile, especially if the file to download is large\n",
97-
"file.download(f\"{data_loc}/{filename}\")\n",
120+
"file.download(f\"{download_loc}/{filename}\")\n",
98121
"\n",
99-
"print(f\"Downloaded file to {data_loc}/{filename}\")"
122+
"print(f\"Downloaded file to {download_loc}/{filename}\")"
100123
]
101124
},
102125
{
@@ -116,9 +139,9 @@
116139
"outputs": [],
117140
"source": [
118141
"# patience isn't just a virtue, it's a requirement\n",
119-
"my_dandiset.download_directory(\"./\", f\"{data_loc}/{dandiset_id}\")\n",
142+
"my_dandiset.download_directory(\"./\", f\"{download_loc}/{dandiset_id}\")\n",
120143
"\n",
121-
"print(f\"Downloaded directory to {data_loc}/{dandiset_id}\")"
144+
"print(f\"Downloaded directory to {download_loc}/{dandiset_id}\")"
122145
]
123146
}
124147
],

docs/basics/read_nwb.ipynb

Lines changed: 84 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": null,
22+
"execution_count": 1,
2323
"id": "d76f08a6",
2424
"metadata": {},
2525
"outputs": [],
@@ -38,20 +38,99 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": null,
41+
"execution_count": 2,
4242
"id": "400c411d",
4343
"metadata": {},
4444
"outputs": [],
4545
"source": [
46-
"nwb_filepath = \"~/data/sub-699733573_ses-715093703.nwb\""
46+
"nwb_filepath = \"./sub-699733573_ses-715093703.nwb\""
4747
]
4848
},
4949
{
5050
"cell_type": "code",
51-
"execution_count": null,
51+
"execution_count": 3,
5252
"id": "7628e758",
5353
"metadata": {},
54-
"outputs": [],
54+
"outputs": [
55+
{
56+
"name": "stderr",
57+
"output_type": "stream",
58+
"text": [
59+
"C:\\Users\\carter.peene\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\hdmf\\spec\\namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-common' version 1.1.3 because version 1.5.1 is already loaded.\n",
60+
" warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n",
61+
"C:\\Users\\carter.peene\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\hdmf\\spec\\namespace.py:531: UserWarning: Ignoring cached namespace 'core' version 2.2.2 because version 2.5.0 is already loaded.\n",
62+
" warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n"
63+
]
64+
},
65+
{
66+
"name": "stdout",
67+
"output_type": "stream",
68+
"text": [
69+
"root pynwb.file.NWBFile at 0x2647013427664\n",
70+
"Fields:\n",
71+
" acquisition: {\n",
72+
" raw_running_wheel_rotation <class 'pynwb.base.TimeSeries'>,\n",
73+
" running_wheel_signal_voltage <class 'pynwb.base.TimeSeries'>,\n",
74+
" running_wheel_supply_voltage <class 'pynwb.base.TimeSeries'>\n",
75+
" }\n",
76+
" devices: {\n",
77+
" probeA <class 'abc.EcephysProbe'>,\n",
78+
" probeB <class 'abc.EcephysProbe'>,\n",
79+
" probeC <class 'abc.EcephysProbe'>,\n",
80+
" probeD <class 'abc.EcephysProbe'>,\n",
81+
" probeE <class 'abc.EcephysProbe'>,\n",
82+
" probeF <class 'abc.EcephysProbe'>\n",
83+
" }\n",
84+
" electrode_groups: {\n",
85+
" probeA <class 'abc.EcephysElectrodeGroup'>,\n",
86+
" probeB <class 'abc.EcephysElectrodeGroup'>,\n",
87+
" probeC <class 'abc.EcephysElectrodeGroup'>,\n",
88+
" probeD <class 'abc.EcephysElectrodeGroup'>,\n",
89+
" probeE <class 'abc.EcephysElectrodeGroup'>,\n",
90+
" probeF <class 'abc.EcephysElectrodeGroup'>\n",
91+
" }\n",
92+
" electrodes: electrodes <class 'hdmf.common.table.DynamicTable'>\n",
93+
" file_create_date: [datetime.datetime(2020, 5, 26, 0, 53, 26, 986608, tzinfo=tzoffset(None, -25200))]\n",
94+
" identifier: 715093703\n",
95+
" institution: Allen Institute for Brain Science\n",
96+
" intervals: {\n",
97+
" drifting_gratings_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
98+
" flashes_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
99+
" gabors_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
100+
" invalid_times <class 'pynwb.epoch.TimeIntervals'>,\n",
101+
" natural_movie_one_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
102+
" natural_movie_three_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
103+
" natural_scenes_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
104+
" spontaneous_presentations <class 'pynwb.epoch.TimeIntervals'>,\n",
105+
" static_gratings_presentations <class 'pynwb.epoch.TimeIntervals'>\n",
106+
" }\n",
107+
" invalid_times: invalid_times <class 'pynwb.epoch.TimeIntervals'>\n",
108+
" processing: {\n",
109+
" eye_tracking_rig_metadata <class 'pynwb.base.ProcessingModule'>,\n",
110+
" optotagging <class 'pynwb.base.ProcessingModule'>,\n",
111+
" running <class 'pynwb.base.ProcessingModule'>,\n",
112+
" stimulus <class 'pynwb.base.ProcessingModule'>\n",
113+
" }\n",
114+
" session_description: Data and metadata for an Ecephys session\n",
115+
" session_id: 715093703\n",
116+
" session_start_time: 2019-01-19 00:54:18-08:00\n",
117+
" stimulus_notes: brain_observatory_1.1\n",
118+
" subject: subject abc.EcephysSpecimen at 0x2647012943904\n",
119+
"Fields:\n",
120+
" age: P118D\n",
121+
" age_in_days: 118.0\n",
122+
" genotype: Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt\n",
123+
" sex: M\n",
124+
" species: Mus musculus\n",
125+
" specimen_name: Sst-IRES-Cre;Ai32-386129\n",
126+
" subject_id: 699733573\n",
127+
"\n",
128+
" timestamps_reference_time: 2019-01-19 00:54:18-08:00\n",
129+
" units: units <class 'pynwb.misc.Units'>\n",
130+
"\n"
131+
]
132+
}
133+
],
55134
"source": [
56135
"io = NWBHDF5IO(nwb_filepath, mode=\"r\", load_namespaces=True)\n",
57136
"nwb = io.read()\n",

docs/basics/stream_nwb.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": 3,
22+
"execution_count": 1,
2323
"id": "df1c4cce",
2424
"metadata": {},
2525
"outputs": [],
@@ -47,7 +47,7 @@
4747
},
4848
{
4949
"cell_type": "code",
50-
"execution_count": 4,
50+
"execution_count": 2,
5151
"id": "f3f97f13",
5252
"metadata": {},
5353
"outputs": [],
@@ -60,7 +60,7 @@
6060
},
6161
{
6262
"cell_type": "code",
63-
"execution_count": 5,
63+
"execution_count": 3,
6464
"id": "a51caf90",
6565
"metadata": {},
6666
"outputs": [
@@ -91,15 +91,15 @@
9191
},
9292
{
9393
"cell_type": "code",
94-
"execution_count": 6,
94+
"execution_count": 4,
9595
"id": "d131ad56",
9696
"metadata": {},
9797
"outputs": [
9898
{
9999
"name": "stdout",
100100
"output_type": "stream",
101101
"text": [
102-
"Retrieved file url https://dandiarchive.s3.amazonaws.com/blobs/f5f/175/f5f1752f-5227-47d5-8f75-cd71937878aa?response-content-disposition=attachment%3B%20filename%3D%22sub-699733573_ses-715093703.nwb%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUBRWC5GAEKH3223E%2F20221118%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20221118T201449Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=dd1f57c2d1b0a34cd5223cc0671d6a41dcea82917769a0befe6fc22de7247b3d\n"
102+
"Retrieved file url https://dandiarchive.s3.amazonaws.com/blobs/f5f/175/f5f1752f-5227-47d5-8f75-cd71937878aa?response-content-disposition=attachment%3B%20filename%3D%22sub-699733573_ses-715093703.nwb%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUBRWC5GAEKH3223E%2F20221130%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20221130T215329Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=9edb7bb8f4263cd27cdcc37b27cc23cc7e79b8dbc3a0c9d6b4ae2a74da30c63a\n"
103103
]
104104
}
105105
],
@@ -122,7 +122,7 @@
122122
},
123123
{
124124
"cell_type": "code",
125-
"execution_count": 7,
125+
"execution_count": 5,
126126
"id": "d15db3bb",
127127
"metadata": {
128128
"scrolled": true
@@ -161,7 +161,7 @@
161161
},
162162
{
163163
"cell_type": "code",
164-
"execution_count": 8,
164+
"execution_count": 6,
165165
"id": "91031da2",
166166
"metadata": {},
167167
"outputs": [],
@@ -178,14 +178,14 @@
178178
},
179179
{
180180
"cell_type": "code",
181-
"execution_count": 9,
181+
"execution_count": 7,
182182
"id": "3e06b964",
183183
"metadata": {},
184184
"outputs": [
185185
{
186186
"data": {
187187
"application/vnd.jupyter.widget-view+json": {
188-
"model_id": "ea3fdc0704e549fdb98aaf1b164c4203",
188+
"model_id": "682abdb6aeef48f4a3164f618072cbc1",
189189
"version_major": 2,
190190
"version_minor": 0
191191
},

docs/basics/use_nwbwidgets.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"metadata": {},
4545
"outputs": [],
4646
"source": [
47-
"nwb_filepath = \"~/data/your_file.nwb\""
47+
"nwb_filepath = \"./sub-699733573_ses-715093703.nwb\""
4848
]
4949
},
5050
{

0 commit comments

Comments
 (0)