-
Notifications
You must be signed in to change notification settings - Fork 84
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
add custom html field generation method for TimeSeries #1831
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #1831 +/- ##
==========================================
- Coverage 92.19% 91.95% -0.24%
==========================================
Files 27 27
Lines 2639 2661 +22
Branches 690 699 +9
==========================================
+ Hits 2433 2447 +14
- Misses 136 142 +6
- Partials 70 72 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@rly I tested this potential fix with a file from dandiest 000053 and on the original example. But I don't have access to dandiest 000336, so I'm not positive if it actually fixes the original issue. |
@stephprince thanks! using this branch and the corresponding one in hdmf fixes the issue for the file I have from dandiset 000336 |
src/pynwb/base.py
Outdated
if key in ['timestamp_link', 'data_link']: | ||
value = {v.name: v.neurodata_type for v in value} |
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.
Rather than link to the linked object, can we link to just the timestamps (or data) of the corresponding object?
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.
Do you mean instead of displaying the neurodata_type, show just the timestamps/data of the corresponding object? Or do you mean changing how the timestamp_link and data_link properties get set up?
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.
The former. In practice, we do not show arrays yet in this html repr, so nothing will show up, but it would be less confusing as to why timestamps = another NWB object.
It would however be nice to say that this is a linked object, so maybe we could alter the key to say something like
→ timestamps (link to <path to timestamps of other NWB object -- use container.get_ancestors() and make a nice string path out of it>)"
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.
Got it, I was just looking at the items in the 'timestamp_link' subheading and didn't realize the timestamps for the other timeseries were still showing the linked object. Yes, I can try to change that as well as alter the key to indicate it is a linked object.
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.
Ah right. Yes I was looking at the timestamps field and not the timestamps_link field.
@oruebel What do you think? What looks better here? |
Using the Python code path shown in the tooltip seems reasonable here, since this is how a user would access it in PyNWB and since we are printing the Container here (not the raw file structure). |
Good point. No, the child object does not know where in the parent object it lives, e.g., in acquisition or processing. It's ugly, but the only ways I can see determining the path to the object are:
I think option 2 might be better and could be useful in other ways. |
If the file was loaded from disk, then this should be an h5py dataset, so could also ask it for the path in the file directly in that case |
Right, but that's not the pynwb access path |
Hey all
This is how we did this recently for our backend reports of dataset IO's to be configured by the user: https://github.com/catalystneuro/neuroconv/blob/main/src/neuroconv/tools/nwb_helpers/_configuration_models/_base_dataset_io.py#L19-L35 In particular it's built for the in-memory case before anything has hit disk
This is what we do to assign 'location' in the NWB Inspector; but it may not always agree with the other method all the time; common exceptions include the |
So if this is just for user-friendly text-based display of contents for the HTML |
Thanks for the code pointer @CodyCBakerPhD ! Yeah, I think that's close enough. |
great, thanks for the help @CodyCBakerPhD! I will go ahead with the ancestral recursion method then |
@stephprince is this good to go? If so, please mark as ready for review |
Motivation
Fix #1830.
Adds a method to TimeSeries that checks for linked timestamps or linked data to avoid recursion errors when generating an html representation in Jupyter notebooks.
See also related hdmf issue (hdmf-dev/hdmf#1010) and PR (hdmf-dev/hdmf#1038)
How to test the behavior?
See below for an example from the related hdmf issue in which timestamps are linked across multiple spatial series.
Checklist
flake8
from the source directory.