-
Notifications
You must be signed in to change notification settings - Fork 62
I/O support for the ndx-pose NWB extension: take 2 #360
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #360 +/- ##
==========================================
- Coverage 99.87% 99.14% -0.73%
==========================================
Files 28 29 +1
Lines 1559 1641 +82
==========================================
+ Hits 1557 1627 +70
- Misses 2 14 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1371fde
to
cfeaca8
Compare
|
movement/io/load_poses.py
Outdated
) | ||
|
||
# Compute fps from the time differences between timestamps | ||
fps = np.nanmedian(1 / np.diff(pse.timestamps)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is actually quite common to use the rate
parameter instead of timestamps, but of course both situations could happen. I'd suggest this:
fps = np.nanmedian(1 / np.diff(pse.timestamps)) | |
if pse.rate: | |
fps = pse.rate | |
else: | |
fps = np.nanmedian(1 / np.diff(pse.timestamps)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't know this!
hi @niksirbi , thanks for working on this! |
movement/io/load_poses.py
Outdated
""" | ||
pose_estimation = nwb_file.processing["behavior"][key_name] | ||
source_software = pose_estimation.fields["source_software"] | ||
pose_estimation_series = pose_estimation.fields["pose_estimation_series"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could get source videos like this:
pose_estimation_series = pose_estimation.fields["pose_estimation_series"] | |
pose_estimation_series = pose_estimation.fields["pose_estimation_series"] | |
source_videos_paths = list(pose_estimation.original_videos[:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For our other formats (e.g. SLEAP) we don't normally keep track of this information, as in we don't store it in the dataset's metadata. That said, since NWB makes the information so readily available, perhaps we can consider adding this as a metadata field (in the .attrs
dict)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, for some reason I thought that info was present in the datasets metadata. Yeah, it sounds like it would be a good addition, at least for full provenance!
movement/io/load_poses.py
Outdated
|
||
""" | ||
pose_estimation = nwb_file.processing["behavior"][key_name] | ||
source_software = pose_estimation.fields["source_software"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in these NWB objects, we can use dot notation like this:
source_software = pose_estimation.fields["source_software"] | |
source_software = pose_estimation.source_software |
Thanks for reviewing this @luiztauffer. The activity in the repo ticked up by a lot so I didn't get a chance to finalise this. What you propose here makes sense to me. It will be easier to split the load/save bits and focus on merging the loading functions first. We'd only have to improve the relevant tests a bit, but I think that won't be hard. If I don't manage to bring this to a conclusion this week I will bring it up at out community call this Friday, to see if anyone else has capacity.
Does the NWB spec explicitly support derived variables or do you mean that it can be co-opted to do so? |
@niksirbi ok, cool! Let me know how it goes and maybe I can help you out =)
Yes, we could add them for example as BehavioralTimeSeries objects, inside the same |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Niko Sirmpilatze <[email protected]>
for more information, see https://pre-commit.ci
|
Hey @luiztauffer, just letting you know that we've discussed this internally, and decided that @lochhh will take over the remainder of the work, along the lines of what we've agreed above:
I'm confident that she will be much more effective than me in wrapping this up. |
Description
What is this PR
Why is this PR needed?
This PR is the continuation of #166, building on @edeno's hard work over there. See that PR for more information.
What does this PR do?
Adds a new I/O module, that handles conversions between
ndx-pose
andmovement
poses datasets.References
Closes #23
How has this PR been tested?
TBD...
Is this a breaking change?
Probably not...
Does this PR require an update to the documentation?
Yes, supported formats need to be updated.
Checklist: