-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added example notebooks w/o streaming
- Loading branch information
1 parent
10c444a
commit 0ab5241
Showing
5 changed files
with
1,394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Example Sessions for Dandiset 001259 | ||
|
||
This submission provides 2 notebooks showcasing example sessions for the Dandiset 001259. | ||
|
||
Each notebook provides an example of how to access the critical data and metadata from the 2 types of experiments in the dataset: | ||
|
||
- `ephys_example_notebook.ipynb` showcases one example session from the 001259 dataset containing operant behavior and concurrent OpenEphys recordings in primary auditory cortex (A1). | ||
- `optogenetics_example_notebook.ipynb` showcases one example session from the 001259 dataset containing operant behavior and concurrent optogenetic stimulation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# run: conda env create --file environment.yml | ||
name: schneider_notebook_env | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- python==3.12 | ||
- ipywidgets | ||
- pip | ||
- pip: | ||
- matplotlib | ||
- lerner-lab-to-nwb @ git+https://github.com/catalystneuro/lerner-lab-to-nwb.git@main |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from pynwb import NWBHDF5IO | ||
from fsspec import filesystem | ||
from h5py import File | ||
from dandi.dandiapi import DandiAPIClient | ||
|
||
def stream_nwbfile(DANDISET_ID, file_path): | ||
'''Stream NWB file from DANDI archive. | ||
Parameters | ||
---------- | ||
DANDISET_ID : str | ||
Dandiset ID | ||
file_path : str | ||
Path to NWB file in DANDI archive | ||
Returns | ||
------- | ||
nwbfile : NWBFile | ||
NWB file | ||
io : NWBHDF5IO | ||
NWB IO object (for closing) | ||
Notes | ||
----- | ||
The io object must be closed after use. | ||
''' | ||
with DandiAPIClient() as client: | ||
client.dandi_authenticate() | ||
asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path) | ||
s3_url = asset.get_content_url(follow_redirects=1, strip_query=True) | ||
fs = filesystem("http") | ||
file_system = fs.open(s3_url, "rb") | ||
file = File(file_system, mode="r") | ||
io = NWBHDF5IO(file=file, load_namespaces=True) | ||
nwbfile = io.read() | ||
return nwbfile, io |