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

Fix rasterizing a Path with categorical values including empty strings #6429

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Oct 30, 2024

Fixes #6326

@@ -448,6 +448,12 @@ def _apply_datashader(self, dfdata, cvs_fn, agg_fn, agg_kwargs, x, y):
val = val.astype(np.float64)
val[neg1] = np.nan
agg[col] = ((y.name, x.name), val)

if isinstance(agg_fn, ds.count_cat):
Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully a good place to add this.

Copy link
Member

@hoxbro hoxbro Oct 30, 2024

Choose a reason for hiding this comment

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

Placement looks fine to me. We need to generalize this to ds.by:

Suggested change
if isinstance(agg_fn, ds.count_cat):
if isinstance(agg_fn, ds.by):

We could parameterize the test.

# [0, 1]],
# ])
# expected = ImageStack((x, y, array), vdims=['a', 'b'])
# self.assertEqual(rasterized, expected)
Copy link
Member Author

Choose a reason for hiding this comment

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

@hoxbro I commented out this code for now as I realized that compare.py has not been updated to compare ImageStack objects part of the test suite. Is this intentional? Not that this part of the test is not strictly required, I worked on this fix together with @Azaya89 and ended up showing him that self.assertEqual is extended by HoloViews. Ultimately, the real check is that there's no error raised and no empty string in the vdims.

Copy link
Member

Choose a reason for hiding this comment

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

It was not intentional. At some point, I want to transition away from using the stdlib unittest framework.

Can you uncomment this and do some simple assert instead?

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.51%. Comparing base (c0bbdd7) to head (01ed576).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6429      +/-   ##
==========================================
- Coverage   88.51%   88.51%   -0.01%     
==========================================
  Files         323      323              
  Lines       68597    68612      +15     
==========================================
+ Hits        60722    60733      +11     
- Misses       7875     7879       +4     

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

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Oct 31, 2024
@hoxbro hoxbro enabled auto-merge (squash) November 1, 2024 08:58
@hoxbro hoxbro force-pushed the fix_rasterize_path_sep_empty_string branch from e219e4f to 01ed576 Compare November 1, 2024 09:00
@hoxbro hoxbro merged commit 1d4bdee into main Nov 1, 2024
14 checks passed
@hoxbro hoxbro deleted the fix_rasterize_path_sep_empty_string branch November 1, 2024 09:30
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.

Categorical datashaded paths can raise an error
2 participants