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

bounds values set wrongly after calling .select on Image object #702

Closed
RafalSkolasinski opened this issue Jun 2, 2016 · 5 comments
Closed
Assignees
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@RafalSkolasinski
Copy link

RafalSkolasinski commented Jun 2, 2016

When .select method is called on Image object it looks like bounds of newly created image are set to the input of .select method. I found that in following case:

import numpy as np
import holoviews
from holoviews import Image, Points
holoviews.notebook_extension()
side = 5
region=(-side,-side,side,side)

def coords(bounds,samples):
    l,b,r,t=bounds
    hc=side/samples
    return np.meshgrid(np.linspace(l+hc,r-hc,samples),
                       np.linspace(b+hc,t-hc,samples))

x,y = coords(region, 5)
z = np.sin(x**2+y**2)

img1 = Image(z, group="Function", label="Sine", bounds=region) 
img2 = img1.clone(extents=(-2, -2, 2, 2))
img3 = img1.select(x=(-2,2), y=(-2,2))
>>> print(img1[0.95, 0], img2[0.95, 0], img3[0.95, 0])
0.0 0.0 -0.756802495308
%%opts Image [situate_axes=True] {+axiswise}
img1*Points([(0.9,0)]) + img2*Points([(0.9,0)]) + img3*Points([(0.9,0)])

2016_06_02_15 01 09

it leads to confusion when accessing value at the same coordinates of the initial and new object.
Maybe bounds of a new object should be selected to the edge of edge pixels that got selected?

@philippjfr
Copy link
Member

Thanks @RafalSkolasinski. This a pretty major and annoying bug and will have to be addressed.

@jlstevens jlstevens added this to the v1.6.0 milestone Jun 13, 2016
@jlstevens
Copy link
Contributor

I've assigned the milestone to 1.6.0 as I agree this is an important bug to address. I would consider moving it to a minor, post 1.5 release if we decide we are going to have one of those (seems likely!).

@RafalSkolasinski
Copy link
Author

Hmm... maybe it would be good idea to make

[situate_axes=True]

a default setting?

@philippjfr
Copy link
Member

This turned out to be a pretty important bug which actually caused some distortions in a plot in my thesis. I've finally figured it out in #994, which will hopefully make it into the 1.7 release.

@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Mar 2, 2017
@philippjfr philippjfr self-assigned this Mar 4, 2017
@philippjfr philippjfr modified the milestones: v2.0, v1.7.0 Mar 15, 2017
@philippjfr philippjfr modified the milestones: v1.7.0, v2.0 Apr 8, 2017
@philippjfr
Copy link
Member

This has now finally been finally been fixed in #994, which was just merged.

>>> print(img1[0.95, 0], img2[0.95, 0], img3[0.95, 0])
(0.0, 0.0, 0.0)
%%opts Image [situate_axes=True] {+axiswise}
img1*Points([(0.9,0)]) + img2*Points([(0.9,0)]) + img3*Points([(0.9,0)])

image

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

No branches or pull requests

3 participants