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

Fix loading and IntervalSet from NWB file with metadata #386

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

sjvenditto
Copy link
Collaborator

There was an issue with creating IntervalSets from loaded NWB files, where the IntervalSet object was being created first, thus sorting start and end times, and afterwards adding metadata that is now misaligned. This fix changes the load so that metadata is passed at creation in a dataframe with the start and end times, preserving the alignment.

An initial sort of an input dataframe start times, which preserves their relationship to each end time, is also done in an attempt to preserve the metadata. This is because when start and end times are sorted separately, as they are later in the constructor, metadata is dropped since it is unclear whether to pair metadata with the start or end time. However, if end times need to be sorted later in the constructor, metadata will still be dropped.

…an nwb file to ensure it is aligned correctly. also try an initial sort of an input dataframe to preserve metadata
@sjvenditto sjvenditto requested a review from gviejo as a code owner January 7, 2025 16:56
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
pynapple/core/interval_set.py 94.34% <100.00%> (+0.04%) ⬆️
pynapple/io/interface_nwb.py 79.09% <100.00%> (-0.24%) ⬇️

... and 1 file with indirect coverage changes

@gviejo gviejo merged commit 0688345 into dev Jan 8, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants