Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions 001828/MeletisLab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# DANDI:001828 Example Notebooks

This directory contains example notebooks demonstrating how to access and visualize
the dataset published at [DANDI:001828](https://dandiarchive.org/dandiset/001828).

The dataset comes from the Meletis Lab at Karolinska Institutet and contains fiber
photometry, optogenetics, pose estimation, and behavioral event data across multiple
experimental protocols.

## Notebooks

| Notebook | Protocol |
|---|-----------------------------------------------------------------|
| `arrow_maze_choice_task.ipynb` | Arrow Maze choice task — pose estimation |
| `open_field_test.ipynb` | Open Field Test — VAME motif sequences and fiber photometry |
| `opto_dlight.ipynb` | Optogenetics + dLight — fiber photometry aligned to opto epochs |
| `reaching_test.ipynb` | Reaching Test — reach outcome events and palm kinematics |
| `water_consumption.ipynb` | Water Consumption — fiber photometry aligned to reach outcomes |

All notebooks stream NWB files directly from the DANDI archive using the shared
`utils.py` helper.

## Installing the dependencies

```bash
git clone https://github.com/dandi/example-notebooks
cd example-notebooks/001828/MeletisLab
conda env create --file environment.yml
conda activate 001828_demo
```

## Running a notebook

```bash
jupyter notebook arrow_maze_choice_task.ipynb
```
326 changes: 326 additions & 0 deletions 001828/MeletisLab/arrow_maze_choice_task.ipynb

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions 001828/MeletisLab/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 001828_demo
channels:
- conda-forge
dependencies:
- python==3.11
- pip
- pip:
- dandi
- jupyter
- matplotlib
- numpy
- pandas
- pynwb
- remfile
- h5py
- nwb-video-widgets
584 changes: 584 additions & 0 deletions 001828/MeletisLab/open_field_test.ipynb

Large diffs are not rendered by default.

485 changes: 485 additions & 0 deletions 001828/MeletisLab/opto_dlight.ipynb

Large diffs are not rendered by default.

577 changes: 577 additions & 0 deletions 001828/MeletisLab/reaching_test.ipynb

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions 001828/MeletisLab/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os

import h5py
import remfile
from dandi.dandiapi import DandiAPIClient
from pynwb import NWBHDF5IO

DANDISET_ID = "001828"


def _client():
return DandiAPIClient(token=os.environ.get("DANDI_API_KEY"))


def get_asset(session_id: str):
"""Return the DANDI asset matching session_id (needed for video widgets)."""
with _client() as client:
dandiset = client.get_dandiset(DANDISET_ID, "draft")
return next(
a for a in dandiset.get_assets()
if session_id in a.path and a.path.endswith(".nwb")
)


def stream_nwb(session_id: str):
"""Stream an NWB file from DANDI by matching session_id against asset paths."""
asset = get_asset(session_id)
s3_url = asset.get_content_url(follow_redirects=4, strip_query=False)
rf = remfile.File(s3_url)
f = h5py.File(rf, mode="r")
io = NWBHDF5IO(file=f)
return io.read()
561 changes: 561 additions & 0 deletions 001828/MeletisLab/water_consumption.ipynb

Large diffs are not rendered by default.

Loading