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

core.util.validate_regular_sampling() appears to contain redundant call to np.unique() #2899

Closed
ceball opened this issue Jul 30, 2018 · 3 comments
Assignees

Comments

@ceball
Copy link
Member

ceball commented Jul 30, 2018

https://github.com/ioam/holoviews/blob/master/holoviews/core/util.py#L1653

I happened to notice that creating an Image becomes surprisingly slow as one dimension gets bigger (for a fixed overall Image size). That led me to notice that validate_regular_sampling() contains a call to np.unique() (which sorts). I'm not clear on the purpose of the call to np.unique().

I could demonstrate the problem I'm talking about, and fix it, but first I'm opening an issue in case there's something I'm missing about the need for unique().

@jbednar
Copy link
Member

jbednar commented Jul 30, 2018

I don't quite get what the unique achieves here either, but if it's just about squeezing repeats rather than true uniqueness, you could do something that doesn't sort, like:

image

@philippjfr
Copy link
Member

philippjfr commented Jul 31, 2018

I think there is indeed no need for np.unique and this could simply be:

diffs = np.diff(values)
return abs(diffs.min()-diffs.max()) < abs(diffs.min()*rtol)

@philippjfr
Copy link
Member

This was fixed in #2293

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

No branches or pull requests

4 participants