-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Improve handling of zero range datashader aggregations #2842
Conversation
Looks good, thanks. |
New changes look good too. |
Ready to review. |
Looks good to me, but would be helpful if @jlstevens looks it over too. |
One arbitrary thing I've done here is set the density for zero sized dimensions to 1, technically the density should be |
holoviews/operation/datashader.py
Outdated
@@ -468,6 +458,27 @@ def _process(self, element, key=None): | |||
vdims = Dimension('Count') | |||
params['vdims'] = vdims | |||
|
|||
if x is None or y is None or width == 0 or height == 0: | |||
xarray = xr.DataArray(np.full((height, width), np.NaN, dtype=np.float32), |
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.
Why does it have to be np.float32
in these two cases?
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.
No good reason, pointless optimization. Can take it out.
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.
I wouldn't specify a precision unless there is a good reason.
Looks good to me and the tests are passing. Merging. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Ensures datashader aggregation on zero-range data is handled correctly. Previously there were some workarounds that did one of two things:
Both were only workarounds and led to unexpected behavior so the operations now return Images with zero sized arrays. This is also related to holoviz/datashader#612 but doesn't require it since the operations are doing all the guarding against the bad cases that datashader doesn't handle correctly.