-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Element Tutorial fixes #517
Conversation
More tests in Elements failed than I expected but it is not too surprising. The test data is now updating and I'll trigger a website build so we can check everything is alright. |
Thanks, but because the pattern is still symmetric, it's not clear whether the problem has been addressed. E.g. I think y is still flipped. |
Yea, looks like y is still flipped, it's a bit ugly to have to flip them everywhere but I guess it's the right thing to do. |
Do you think the sine rings shouldn't be symmetric? Maybe elongated along the x or y axis? To be honest, I'm not sure how a user would notice the relationship between the x and y values and the output unless the x and y arrays are visualized as well. Unless you are very familiar, with |
Right, that's the reason it's a very bad example; anyone who uses it as a starting point (which is what I was doing when I noticed it was wrong) will be scratching their head and thinking they were doing something wrong, when instead it's the example that's the problem. Thus, as an example (rather than just a sample), it's failing; we should be helping people (i.e., ourselves in this case :-), not misleading them. To avoid this problem we should use a function that has as few symmetries as is practical, and we've got to update the test data anyway. Because we use these notebooks as tests, it would actually be good to use a rectangular shape rather than a square, to reveal any problems with switching coordinate order in our own code. At least this problem is only in the notebook! But that seems infeasible, since it would require extra code in each example, whereas just using a function that's not symmetric doesn't seem like it should make things significantly longer. |
I don't mind switching to these examples. What do you think @philippjfr? |
And I guess it should be |
@jbednar Don't worry about using x,y = np.meshgrid(np.linspace(-3,2,10), np.linspace(2,5,30)) |
Makes sense; that's the more general and more easily understandable way to do it. I'm happy once it's updated to do that! |
I've used the example you suggested though I added an offset as it was symmetric around zero in x: np.sin(xs-1)+ys This is quite a nice example! It is simple enough that I can reason about what the output should be in terms of the x and y inputs. Note that I named the variable I'll rebuild the website though now we have to check for |
I thought the Bokeh tutorial was being built from the same source now? In any case, can you post the full proposed revised code using linspace/meshgrid? When I try it myself, y is still flipped. |
Are you finding |
We have no system to build the bokeh tutorial from the same source and there are a still a few differences in plot and style options that would make that approach look pretty terrible. |
Ah, I see you reversed the order of the arguments to linspace to flip y. Ok, that works for me now; it's a little confusing because that's so hidden, but probably the best option. However, I don't see why you need the -1, as sin(x) isn't symmetric across x=0. Maybe there's some symmetry I'm not seeing? It looks symmetric across the center of the image, but it isn't quite. Maybe we should change the upper bound on X to make it not look symmetric? Also, this is more speculative, but I wonder if it would be a clearer starting point if we made the bounds be specified in a single place in the code: b=(-2,-3,4,2) # Coordinate system: (left, bottom, right, top)
xs,ys = np.meshgrid(np.linspace(b[0],b[2],50), np.linspace(b[3],b[1],30))
(hv.Image(np.sin(xs)+ys, bounds=b) +
hv.Image(np.sin(xs)+ys, bounds=b)[0:3, -2.5:2]) |
Presumably those options are only specified in a few places? If so, seems like a simple sed script could patch them in. Or we could even show how to write notebooks that work well for multiple backends, by showing how to select different options for different backends based on detecting which backend is in use... |
Ok this is a little hard to describe but I'll try! In the first screenshot you posted, I look at the dark greyish wave under the red and you see that at As I hope that makes sense! My argument here doesn't relates to the bounds at all so maybe there is another issue to address that I don't quite understand yet. |
I'm still confused; sin is cyclic, but not symmetric across the y axis. I.e., sin(x) != sin(-x), in general. That's also true of sin(x-1), but no more than of sin(x) itself. E.g. at y=0: Also note that in my code here I've fixed the comment about "Coordinate system"; it's lbrt, not lbtr as it has been claiming. |
True. I just thought an offset might be more obvious but yes, you are right that there is enough information (you just need to look at the shape around Would you still like to change the bounds? |
Thanks. Yes, I think having the different bounds helps make it more obvious what matches up to what. |
Is this almost ready to merge? Are we ready to announce? |
I've just made the last suggested change. If you are happy with it now, I'll update the test data and it can then be merged. What about updating the other tutorials where mgrid was used? |
But according to the diffs, mgrid is still in use even in this tutorial, and therefore is silently flipping y? |
Those remaining uses of |
Ok, sounds good! Please merge and when the web site is ready I'll announce. |
Presumably they should be updated as part of this PR as well, or is there a reason not to do that? |
Yes, any tutorial where mgrid is used is potentially a source of confusion, unless it eventually ends up as specific coords as Jean-Luc points out above. I don't know if I'm typical, but I tend to go to Elements for examples to use as starting points, so that's the one I most care about not being misleading, and the others seem lower in priority (i.e., not worth holding up the announcement). But if they can be fixed quickly, it would be good to get it over with in this one PR. |
I would prefer to update them as separate PRs if only because it is easier to catch problems with the tests that way. If we have too many test changes, it is hard to spot any transient errors that we don't want to slip onto master. |
Ok, sounds good to me. |
The test data is updating. Please merge once the PR build goes green. |
Sure, I don't mind but personally I'd check them thoroughly once, rather than waiting on it to rebuild it multiple times with a decent chance of a transient being introduced each time. Will merge once tests are passing. |
Looks like a test failed, but I'm not sure what? |
Failed a bunch of times because a transient error was captured, seems to be working now. The push build failing is expected since master has changed. Happy to merge now, unless you want to merge in master first. |
@philippjfr If you are happy there are no transients (shouldn't be now the pr build is passing) please go ahead and merge. |
I don't see the updated Image example on build.holoviews.org, dev.holoviews.org, or holoviews.org, but let me know once it should be done propagating to the public site and I'll announce. |
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. |
This PR addresses the issues raised in #516 regarding the Element tutorial, namely:
Image
.x
andy
generated withnp.mgrid
I've made the changes in such a way that I believe that most of the tests will continue to pass though
Image
will probably fail given the change of bounds.