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

Issue #356: Show first and last events instead of only first ones when displaying an EventSet #362

Merged
merged 17 commits into from
Feb 26, 2024

Conversation

jtaylor205
Copy link
Contributor

Adjusted displays_util.py to display 7 at a time until more than 7 timestamps are created, in which the ellipses row is implemented after the first three rows, with the last 3 rows following that row.

Copy link

google-cla bot commented Jan 31, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@ianspektor ianspektor left a comment

Choose a reason for hiding this comment

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

Hey @jtaylor205! Great work so far :) A couple of comments:

  • The elipsis row should be shown in the middle of the first 3 and last 3 rows, not at the end. See how pandas does it:
image
  • You'll need to accept the Google CLA for the contribution to be merged, see the comment in this PR from the google-cla bot for instructions.
  • There's tests checking the eventset is displayed as expected that you'll need to modify: see the test_html_repr_no_limits and test_html_repr_limits in temporian/implementation/numpy/data/test/event_set_test.py
  • Please post a screenshot of the displayed eventset in the PRs description to see what it looks like.

Thanks in advance!

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Adjusted files based on feedback from ian

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Adjusted based on comments and below are requested test cases
Screenshot 2024-02-01 at 4 10 37 PM
Screenshot 2024-02-01 at 4 11 09 PM

Screenshot 2024-02-01 at 4 09 04 PM Screenshot 2024-02-01 at 4 09 30 PM

Copy link
Collaborator

@ianspektor ianspektor left a comment

Choose a reason for hiding this comment

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

Screenshots looking perfect!

My comments above about removing [:num_timestamps] and not reconstructing the list still hold.

Same for the tests: you can run them with bazel test --config=macos //temporian/implementation/numpy/data/test:event_set_test --test_output=errors. You'll see that both test_html_repr_no_limits and test_html_repr_limits fail, because the display changed - you need to update the html in the files test_html_repr_no_limits_golden and test_html_repr_limits_golden - you can do this manually, or by copying the output of your new code.

temporian/implementation/numpy/data/display_utils.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

HTML adjusted to represent changes made throughout pull request, removed [:max_timestamps] as it was unnecessary, and changed comment to reference 'max_timestamps' instead of '7'

@ianspektor
Copy link
Collaborator

Formatting check is failing - ensure you have black is correctly configured (should be running on save by default if no user VSCode setting is overriding the workspace's ones)

@ianspektor
Copy link
Collaborator

Please merge main branch into your PR's branch so that tests are ran on it (fixed in #363)

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Adjusted lines with further comments

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Formatted file to not fail check

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Should have finished working golden files

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Fixed golden files

Copy link
Collaborator

@ianspektor ianspektor left a comment

Choose a reason for hiding this comment

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

LGTM after my last comment is addressed. Great work @jtaylor205 and congrats on your first open source contribution! 🎉

Will wait for a review from @javiber before merging.

Edit: found some breaking behavior that needs to be addressed.

if num_timestamps > max_timestamps:
# Timestamp + features + <... column if was added>
row = [ELLIPSIS] * (1 + len(visible_feats) + int(has_hidden_feats))
# Create ellipsis row between first half and last half if more than man_timestamps entries
Copy link
Collaborator

Choose a reason for hiding this comment

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

correct typo, max_timestamps

Copy link
Collaborator

@ianspektor ianspektor left a comment

Choose a reason for hiding this comment

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

Testing the display manually it seems to break when setting tp.config.display_max_events = None (which should have the same behavior as setting it to 0). Please write a test that does the same thing as test_html_repr_no_limits but sets all variables to None instead of 0, and checks the result against the same golden file, and fix the code to make it work.

Thanks!

@javiber
Copy link
Collaborator

javiber commented Feb 19, 2024

Hi @jtaylor205 thanks for the contribution!

Testing this locally I found that setting tp.config.display_max_events = 1 shows all events

Screenshot 2024-02-19 at 15 41 13

@jtaylor205
Copy link
Contributor Author

Hi @javiber , I have fixed that problem. Below is what it now shows. I will upload my changes now
Screenshot 2024-02-19 at 2 56 48 PM

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Made change to error when max_event were set to 1

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Made changes based on "None" conditions

Copy link
Contributor Author

@jtaylor205 jtaylor205 left a comment

Choose a reason for hiding this comment

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

Changes made due to requested implementation and bugs

@javiber javiber merged commit a287f72 into google:main Feb 26, 2024
1 of 2 checks passed
@ianspektor
Copy link
Collaborator

Congrats on your first open-source contribution @jtaylor205! Good job 💪🏼

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.

Show first and last events instead of only first ones when displaying an EventSet
3 participants