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

Tick and tick calendar include left and right #376

Merged
merged 7 commits into from Apr 2, 2024
Merged

Conversation

javiber
Copy link
Collaborator

@javiber javiber commented Feb 21, 2024

  • Added option to include the right to both operators and made it True by default
  • Added option to include the left to both operators and made it False by default
  • Both options have no effect if the start/end is equal to the first/last tick
  • Fixed a bug in tick_calendar where it would miss the first tick under certain conditions
  • Changed the behavior of the tick operator when input has 1 item, now it always returns an empty event set (used to return one element if align=False and empty otherwise)

Calendar ops needs to be merged first

@javiber javiber changed the base branch from main to optimize-calendar-ops February 21, 2024 18:36
@javiber javiber force-pushed the optimize-calendar-ops branch 2 times, most recently from 6c72287 to 1e937ab Compare February 26, 2024 17:57
@javiber javiber force-pushed the calendar-tick-fixes branch 2 times, most recently from ba27208 to e16466c Compare February 26, 2024 18:29
@javiber javiber requested a review from achoum February 26, 2024 18:29
temporian/core/event_set_ops.py Outdated Show resolved Hide resolved
temporian/core/event_set_ops.py Show resolved Hide resolved
temporian/core/event_set_ops.py Outdated Show resolved Hide resolved
temporian/core/operators/test/test_tick.py Outdated Show resolved Hide resolved
temporian/core/operators/test/test_tick_calendar.py Outdated Show resolved Hide resolved
@@ -41,14 +41,15 @@ def __call__(self, input: EventSet) -> Dict[str, EventSet]:

# fill output EventSet data
for index_key, index_data in input.data.items():
if len(index_data.timestamps) == 0:
if len(index_data.timestamps) <= 1:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For brainstorming: Should there be cases where at least one event is returned?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this, the behavior now is similar to what we have currently on main.

Check the new test: https://github.com/google/temporian/pull/376/files#diff-22438ae7b5327b043eb72f32e896dc62eb5c44d523d3535a0f3b65c1339894a1R57

temporian/core/operators/test/test_tick.py Outdated Show resolved Hide resolved
@javiber javiber force-pushed the optimize-calendar-ops branch 5 times, most recently from ab36c41 to 9dae7ad Compare March 4, 2024 16:04
Base automatically changed from optimize-calendar-ops to main March 4, 2024 16:47
@javiber javiber force-pushed the calendar-tick-fixes branch 2 times, most recently from 1e2eb6e to d06edf4 Compare March 6, 2024 13:34
@javiber javiber requested a review from achoum March 7, 2024 12:41
@javiber javiber force-pushed the calendar-tick-fixes branch 3 times, most recently from 36818a8 to 8937bd7 Compare March 14, 2024 15:21
Copy link

Coverage report

Main: 91.32% | PR: 91.35% | Diff: 0.04 ✅

2 similar comments
Copy link

Coverage report

Main: 91.32% | PR: 91.35% | Diff: 0.04 ✅

Copy link

Coverage report

Main: 91.32% | PR: 91.35% | Diff: 0.04 ✅

Copy link

Coverage report

Main: 91.32% | PR: 91.35% | Diff: 0.04 ✅

temporian/core/event_set_ops.py Outdated Show resolved Hide resolved
Copy link

Coverage report

Main: 91.57% | PR: 91.35% | Diff: -0.21 ⚠️

- added examples using these params to docs
- updated old examples
- changed the behavior of tick when a single event is passed, the current behavior is more similar to the one before the new parameters
- fixed a bug on tick_calendar with a single element
- added tests for both operators testing the behavior for single-event inputs under different parameters
- added test for empty eventset on tick_calendar
- added changelog
@javiber javiber merged commit feadcd2 into main Apr 2, 2024
25 checks passed
@javiber javiber deleted the calendar-tick-fixes branch April 2, 2024 15:27
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.

None yet

3 participants