Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NWB to dataframe tools #26

Merged
merged 29 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 32 additions & 0 deletions examples/make_dataframes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
This is an example script to extract dataframes
from an NWB file
"""

import glob
from aind_dynamic_foraging_data_utils import nwb_utils

# List of filepaths to NWBs
NWB_FILES = glob.glob("../tests/nwb/**.nwb")

# Load a single NWB file
nwb = nwb_utils.load_nwb_from_filename(NWB_FILES[0])

# Make dataframe of sessions, each row is a session
# Accepts: NWB objects, NWB files, list of NWB files
df_session = nwb_utils.create_df_session(NWB_FILES)

# Dataframe of trials, each row is a trial
# Accepts NWB filepath or object
df_trials = nwb_utils.create_df_trials(nwb)
df_trials = nwb_utils.create_df_trials(NWB_FILES[0])

# tidy data frame of all events in the session
# Accepts NWB filepath or object
df_events = nwb_utils.create_events_df(nwb)
df_events = nwb_utils.create_events_df(NWB_FILES[0])

# Data frame of FIB data
# Accepts NWB filepath or object
fib_df = nwb_utils.create_fib_df(nwb)
fib_df = nwb_utils.create_fib_df(NWB_FILES[0])
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ dynamic = ["version"]
dependencies = [
'pandas',
'numpy',
'pynwb'
'pynwb',
'hdmf_zarr'
]

[project.optional-dependencies]
Expand Down
Loading
Loading