-
Notifications
You must be signed in to change notification settings - Fork 85
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 timeseries time query utils #1175
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1175 +/- ##
==========================================
+ Coverage 67.44% 67.57% +0.12%
==========================================
Files 37 37
Lines 2310 2319 +9
Branches 406 410 +4
==========================================
+ Hits 1558 1567 +9
Misses 683 683
Partials 69 69
Continue to review full report at Codecov.
|
@bendichter It would be nice if you could use these somehow. https://hdmf.readthedocs.io/en/latest/hdmf.array.html One option would be to construct these in the ObjectMapper, and always pass a SortedArray or LinSpace for the timestamps argument of the constructor. |
@ajtritt oh cool, I didn't know about those! It would definitely be nice to use those for timestamps in pynwb, since they should always be sorted. That should help with the methods you've implemented, <,>,<=,>=,==, and !=, and find_point (aka bisect I'm guessing). I don't see how they would help with any of the methods I have added here though. As a side note, since you are already doing these, it would be nice to also have |
LinSpace would need to be modified to have an appropriate
What do you mean by unique? |
@ajtritt ah, I see. Using Is |
I appreciate the need for being explicit, but I think making the API clean and easy to use is also important. It's a disservice to users to just pass forward the complexity of the NWB standard (this is actually something drove away early users). PyNWB is not just meant to be a fancy layer on top of h5py--it is supposed to make it easier to work with data. At the end of the day, users are storing data so they can use it to do something--not just know how it was stored. If the user can always count on time information to be in the same place i.e. If they need to know if data was regularly sampled or stored with starting_time/rate, then they can just look at those values. If |
@ajtritt I hear that you want to make this easy to use. I do too. I am pulling these functions from a pool of convenience functions I have made to deal with pynwb objects. @lvsltz told me during the hackathon that he found them helpful as well and suggested that other users might also want to access them. I think in these types of situations if we know exactly how the user is going to use this, it can be easier to use, but if they use it differently than we expect, it could be more confusing for them. Overloading On the face of it, it seems pretty easy, but actually |
I think ultimately that is the direction we should aim towards. I think the catalog of helper functions is useful as a means to figure out what the API should support and it is useful for specialized use-cases that may be out of scope, but for common things (like slicing into data), I think we want to have it under the main API. |
I don't want to go down this road unless we have very good reason to. Every function we add is something we can never get rid of and requires maintenance. I think we need to be more deliberate about what we add and how we add it. Otherwise, this thing is just going to continue to balloon into a maintenance nightmare with so many options for users that they don't know where to start. I think we need to reprioritize simplicity and elegance, rather than blindly adding things for the sake of convenience. |
Just to clarify, I didn't mean to imply a catalog of helper functions inside PyNWB, I was speaking more broadly to users with collections of helper functions. E.g, the functions that Ben is proposing are not part of NWB but come from a collection of functions he wrote outside of PyNWB. |
OK, I'll continue to maintain my own helper functions as I need them and transition to pynwb functionality as that becomes available. |
@ajtritt any progress on this front? It would be really great to have this tool as a response to the concern raised in AllenInstitute/AllenSDK#1421 (comment) |
Motivation
Efficient methods for getting time information for TimeSeries objects. This needs tests, but I wanted to check in and see what you all think.