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

Patch IndexError associated with heatmaps. #6438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spacetimeengineer
Copy link

@spacetimeengineer spacetimeengineer commented Nov 4, 2024

I use this library to create a heatmaps on my acoustics application which lets me retrieve data on click. Unfortunately, I encountered an index error that caused the session to break when the x value was out of bounds. This patch makes the clicking outside of bounds a non-issue. It is just a small patch but for my applications it works great. I am just passing the fix along to you. Please feel free to do with it what you will.

I use this library to create a heatmap that lets me retrieve data on click. Unfortunately, I encountered an index error that caused the session to break when the x value was out of bounds. This patch makes the clicking outside of bounds a non-issue. It is just a small patch but for my applications it works great.
@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Nov 4, 2024
Copy link
Author

@spacetimeengineer spacetimeengineer left a comment

Choose a reason for hiding this comment

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

This code implements a patch to prevent IndexErrors that occur when clicking on heat map areas outside of the defined bounds.

@hoxbro
Copy link
Member

hoxbro commented Nov 4, 2024

Likely also needed for y.

Can you share a minimal, reproducible example (MRE)?

@spacetimeengineer
Copy link
Author

To reproduce my error, you'll need a test .nc dataset file, which I can provide. These files are approximately 100 MB, and I'm not sure how or where to send them. After obtaining the file, you'll need to open it using SoundScope and run the main script from this repository: SoundScope GitHub.

It may take me some time to isolate this issue from the application for a minimal example. Please let me know how you’d like to proceed.

@hoxbro
Copy link
Member

hoxbro commented Nov 4, 2024

I think it should be possible to reduce the files to synthetic data.

@spacetimeengineer
Copy link
Author

Regarding y, I haven't encountered that issue myself, but it might be worth exploring. You can reproduce the problem in another application by clicking the color bar on the heatmap legend and checking the logs. The x value will consistently be out of bounds. While this may not cause widespread issues, it does affect a specific data loading system I've implemented, resulting in improper loading of records associated with each cell. To observe this, click the color bar in the legend when an on-click watcher is set up like this:

watcher_heatmap = heatmap_tap.param.watch(
    callback_heatmap_selection, ["x", "y"], onlychanged=False
)  # Watcher for heatmap tap events

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.49%. Comparing base (366d932) to head (1db398e).

Files with missing lines Patch % Lines
holoviews/plotting/bokeh/callbacks.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6438      +/-   ##
==========================================
- Coverage   88.50%   88.49%   -0.01%     
==========================================
  Files         323      323              
  Lines       68627    68630       +3     
==========================================
  Hits        60737    60737              
- Misses       7890     7893       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spacetimeengineer
Copy link
Author

Ill see what I can do.

@hoxbro hoxbro added this to the 1.20.1 milestone Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants