-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor: slicing mixin class #132
refactor: slicing mixin class #132
Conversation
also use absolute imports
- Replace `if not any((start, end))` by `if start is None and end is None`, becase it was picking up 0s as well as `None`s. - Remove `_check_time_sorted` method, as it was only used once. - Move its functionality to `select_by_time`, as slicing by index should be ok for unsorted time stamps. - Some style changes (white lines, order of lines, eror message phrasing, ...). - Do labeling in parent method
c0308cf
to
68750f6
Compare
@DaniBodor I added some comments. (I see that they're not all aligned with the proper lines, VSCode's comment feature has some bugs, I see). When I wrote this code I was assuming you'd always need an start and end point, but You moved the generation of the label to the abstract method. This value is never returns or saves anywhere. Maybe consider writing a new function for label generation? Removing You removed As for testing: does it make sense to create a class specific for testing that is purpose built to test slicing? That makes it easier to rule out bugs. Using a complicated class like DraegerEITData which is not finished yet makes debugging harder. I did the same for testing Variants (see VariantSubA and VariantSubB). |
68750f6
to
0842d22
Compare
65d8f3f
to
ca4f005
Compare
Thanks for the quick review!
It does, but then the way I now implemented labeling become more complex, so I made it explicit.
this should be resolved now
Agreed. I changed it back so that index slicing does not have the option, but time slicing does. The end behavior used to be modified by
fixed
For now I added the notebook that I was using myself for checking that things are correct. This will be removed when proper tests are implemented. In think that at least temporarily solves the problem as well, until everything works properly. Not as fancy, but given that this is a temporary problem (or do you mean as a permanent thing?), this quick solution I think should be ok. |
By the way, while reviewing, if you do your comments as "start a review"/"add review comment" rather than "add single comment", then I only get notified when your review is done. This way, I don't get pinged for each comment individually :) |
Yes, sorry. I added the comments from VS Code, but didn't figure it would ping you for every single one. |
@DaniBodor The current implementation does not coincide with the discussion we had on slicing by time. As I understood it, we agreed that when slicing by time, the start and end of the time axis should be present inside the time range that is selected if E.g. if we slice from It could be I'm misunderstanding what we agreed on previously when it comes to slicing time. |
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.
This code seems to largely function as expected. I'm not quite sure all expectations align, though. Maybe we should re-discuss how time slicing should work, and what it means exactly, and write down some test cases and expected results.
Now that the slicing functions are "hidden", it doesn't make sense to have `start_inclusive` and `end_inclusive` as options: `start_inclusive` is is forced `True` and `end_inclusive` is forced `False`, which aligns with the behavior of slicing lists, etc.
testing still does not work well, because `__eq__` and `__len__` have not been implemented (properly). a temporary notebook has been added for visual testing. this will be deleted when proper testing works.
ca4f005
to
3dd8f7b
Compare
What you say makes sense. I think it was me who misunderstood the usage of |
81ab152
to
a4515dd
Compare
I think I was thinking about it in an illogical way previously. Please see if now it makes sense to you and our expectations are aligned. If still no, then we can maybe discuss it on Friday. I anyway wanted to ask you then what the |
- add docstring - rename attributes - rearrange methods so that code follows order of implementation
e216214
to
6dc006b
Compare
This is the first step of #129. I decided to make separate PRs for each of those so that each can stay small and comprehensible
This PR refactors the current slicing mixin by (in order of commits):
start_inclusive
andend_inclusive
inslice_by_index
__eq__
and__len__
are not yet correctly implemented)slice_by_time
result in expected behaviorTO DO: