Error in image plots using a custom ColumnDataSource

Hi all,

I’ve found a weird error in my Bokeh 0.12.4 installation using image plots with a user provided ColumnDataSource. When I try to use a custom name for the image data parameter different than ‘image’ I get the following Javascript error in the browser:

Uncaught TypeError: Failed to execute ‘getImageData’ on ‘CanvasRenderingContext2D’: The provided double value is non-finite.
at e.r.ImageView.e._set_data (bokeh-0.12.4.min.js:13)
at e.r.GlyphView.e.set_data (bokeh-0.12.4.min.js:13)
at e.r.GlyphRendererView.e.set_data (bokeh-0.12.4.min.js:19)
at e.r.GlyphRendererView.e.initialize (bokeh-0.12.4.min.js:19)
at e.r.View (bokeh-0.12.4.min.js:4)
at e [as constructor] (bokeh-0.12.4.min.js:4)
at e [as constructor] (bokeh-0.12.4.min.js:19)
at new e (bokeh-0.12.4.min.js:19)
at Object.r.build_views (bokeh-0.12.4.min.js:4)
at e.r.PlotCanvasView.e.build_levels (bokeh-0.12.4.min.js:18)

``

I can reproduce the error easily even with the most simple image plot. For example this slightly modified version of the image sample from the official Bokeh gallery:

import numpy as np

from bokeh.plotting import figure, show, output_file
from bokeh.models import ColumnDataSource

N = 500
x = np.linspace(0, 10, N)
y = np.linspace(0, 10, N)
xx, yy = np.meshgrid(x, y)
d = np.sin(xx)*np.cos(yy)

p = figure(x_range=(0, 10), y_range=(0, 10))

must give a vector of image data for image parameter

source = ColumnDataSource({‘myimage’: [d]})
p.image(‘myimage’, x=0, y=0, dw=10, dh=10, palette=“Spectral11”, source=source)

output_file(“image.html”, title=“image.py example”)

show§ # open a browser

``

Running exactly the same source code using ‘image’ as the datasource column name works perfectly. I’m running Bokeh on Mac and I didn’t have this error using Bokeh 0.12.3. I’ve tested on two different Mac machines and both exhibit the same behaviour.

Has anyone else found the same error or am I doing some wrong? Does anybody know what could be the cause?

Thank you in advance.

Enrique G. Paredes

This was this issue:

  https://github.com/bokeh/bokeh/issues/5706

which was fixed in master in this PR:

  https://github.com/bokeh/bokeh/pull/5794

I'm not sure if the change was part of the last dev build or not. I am hoping to have a new dev build available by tomorrow, assuming some upstream issues with out build infrastructure are resolved.

Thanks,

Bryan

···

On Feb 13, 2017, at 12:16, Enrique G. Paredes <[email protected]> wrote:

Hi all,

I've found a weird error in my Bokeh 0.12.4 installation using image plots with a user provided ColumnDataSource. When I try to use a custom name for the image data parameter different than 'image' I get the following Javascript error in the browser:

Uncaught TypeError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The provided double value is non-finite.
    at e.r.ImageView.e._set_data (bokeh-0.12.4.min.js:13)
    at e.r.GlyphView.e.set_data (bokeh-0.12.4.min.js:13)
    at e.r.GlyphRendererView.e.set_data (bokeh-0.12.4.min.js:19)
    at e.r.GlyphRendererView.e.initialize (bokeh-0.12.4.min.js:19)
    at e.r.View (bokeh-0.12.4.min.js:4)
    at e [as constructor] (bokeh-0.12.4.min.js:4)
    at e [as constructor] (bokeh-0.12.4.min.js:19)
    at new e (bokeh-0.12.4.min.js:19)
    at Object.r.build_views (bokeh-0.12.4.min.js:4)
    at e.r.PlotCanvasView.e.build_levels (bokeh-0.12.4.min.js:18)

I can reproduce the error easily even with the most simple image plot. For example this slightly modified version of the image sample from the official Bokeh gallery:

import numpy as np

from bokeh.plotting import figure, show, output_file
from bokeh.models import ColumnDataSource

N = 500
x = np.linspace(0, 10, N)
y = np.linspace(0, 10, N)
xx, yy = np.meshgrid(x, y)
d = np.sin(xx)*np.cos(yy)

p = figure(x_range=(0, 10), y_range=(0, 10))

# must give a vector of image data for image parameter
source = ColumnDataSource({'myimage': [d]})
p.image('myimage', x=0, y=0, dw=10, dh=10, palette="Spectral11", source=source)

output_file("image.html", title="image.py example")

show(p) # open a browser

Running exactly the same source code using 'image' as the datasource column name works perfectly. I'm running Bokeh on Mac and I didn't have this error using Bokeh 0.12.3. I've tested on two different Mac machines and both exhibit the same behaviour.

Has anyone else found the same error or am I doing some wrong? Does anybody know what could be the cause?

Thank you in advance.

        Enrique G. Paredes

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f4a34ae1-c28f-4c36-babd-713a096178c1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Ok, great, thanks. And sorry for the duplicated posting. I actually did a quick search for the same issue in the list before posting, but it looks like it was too quick :frowning:

Regards,

Enrique G. Paredes

···

El lunes, 13 de febrero de 2017, 21:22:22 (UTC+1), Bryan Van de ven escribió:

This was this issue:

    [https://github.com/bokeh/bokeh/issues/5706](https://github.com/bokeh/bokeh/issues/5706)

which was fixed in master in this PR:

    [https://github.com/bokeh/bokeh/pull/5794](https://github.com/bokeh/bokeh/pull/5794)

I’m not sure if the change was part of the last dev build or not. I am hoping to have a new dev build available by tomorrow, assuming some upstream issues with out build infrastructure are resolved.

Thanks,

Bryan

On Feb 13, 2017, at 12:16, Enrique G. Paredes [email protected] wrote:

Hi all,

I’ve found a weird error in my Bokeh 0.12.4 installation using image plots with a user provided ColumnDataSource. When I try to use a custom name for the image data parameter different than ‘image’ I get the following Javascript error in the browser:

Uncaught TypeError: Failed to execute ‘getImageData’ on ‘CanvasRenderingContext2D’: The provided double value is non-finite.

at e.r.ImageView.e._set_data (bokeh-0.12.4.min.js:13)
at e.r.GlyphView.e.set_data (bokeh-0.12.4.min.js:13)
at e.r.GlyphRendererView.e.set_data (bokeh-0.12.4.min.js:19)
at e.r.GlyphRendererView.e.initialize (bokeh-0.12.4.min.js:19)
at e.r.View (bokeh-0.12.4.min.js:4)
at e [as constructor] (bokeh-0.12.4.min.js:4)
at e [as constructor] (bokeh-0.12.4.min.js:19)
at new e (bokeh-0.12.4.min.js:19)
at Object.r.build_views (bokeh-0.12.4.min.js:4)
at e.r.PlotCanvasView.e.build_levels (bokeh-0.12.4.min.js:18)

I can reproduce the error easily even with the most simple image plot. For example this slightly modified version of the image sample from the official Bokeh gallery:

import numpy as np

from bokeh.plotting import figure, show, output_file

from bokeh.models import ColumnDataSource

N = 500

x = np.linspace(0, 10, N)

y = np.linspace(0, 10, N)

xx, yy = np.meshgrid(x, y)

d = np.sin(xx)*np.cos(yy)

p = figure(x_range=(0, 10), y_range=(0, 10))

must give a vector of image data for image parameter

source = ColumnDataSource({‘myimage’: [d]})

p.image(‘myimage’, x=0, y=0, dw=10, dh=10, palette=“Spectral11”, source=source)

output_file(“image.html”, title=“image.py example”)

show§ # open a browser

Running exactly the same source code using ‘image’ as the datasource column name works perfectly. I’m running Bokeh on Mac and I didn’t have this error using Bokeh 0.12.3. I’ve tested on two different Mac machines and both exhibit the same behaviour.

Has anyone else found the same error or am I doing some wrong? Does anybody know what could be the cause?

Thank you in advance.

    Enrique G. Paredes


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f4a34ae1-c28f-4c36-babd-713a096178c1%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

No worries, GH's fairly simplistic issue tracker means it's not always easy to search for issues. FWIW there is now a dev build out that definitely has this change but please be advised it had some experimental work on the bokeh server which turned out not to be fully functional, so if you are using the bokeh server this ev build may not be useful for you.

Thanks,

Bryan

···

On Feb 14, 2017, at 04:11, Enrique G. Paredes <[email protected]> wrote:

Ok, great, thanks. And sorry for the duplicated posting. I actually did a quick search for the same issue in the list before posting, but it looks like it was too quick :frowning:

Regards,

         Enrique G. Paredes

El lunes, 13 de febrero de 2017, 21:22:22 (UTC+1), Bryan Van de ven escribió:
This was this issue:

        https://github.com/bokeh/bokeh/issues/5706

which was fixed in master in this PR:

        https://github.com/bokeh/bokeh/pull/5794

I'm not sure if the change was part of the last dev build or not. I am hoping to have a new dev build available by tomorrow, assuming some upstream issues with out build infrastructure are resolved.

Thanks,

Bryan

> On Feb 13, 2017, at 12:16, Enrique G. Paredes <[email protected]> wrote:
>
>
>
> Hi all,
>
> I've found a weird error in my Bokeh 0.12.4 installation using image plots with a user provided ColumnDataSource. When I try to use a custom name for the image data parameter different than 'image' I get the following Javascript error in the browser:
>
> Uncaught TypeError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The provided double value is non-finite.
> at e.r.ImageView.e._set_data (bokeh-0.12.4.min.js:13)
> at e.r.GlyphView.e.set_data (bokeh-0.12.4.min.js:13)
> at e.r.GlyphRendererView.e.set_data (bokeh-0.12.4.min.js:19)
> at e.r.GlyphRendererView.e.initialize (bokeh-0.12.4.min.js:19)
> at e.r.View (bokeh-0.12.4.min.js:4)
> at e [as constructor] (bokeh-0.12.4.min.js:4)
> at e [as constructor] (bokeh-0.12.4.min.js:19)
> at new e (bokeh-0.12.4.min.js:19)
> at Object.r.build_views (bokeh-0.12.4.min.js:4)
> at e.r.PlotCanvasView.e.build_levels (bokeh-0.12.4.min.js:18)
>
> I can reproduce the error easily even with the most simple image plot. For example this slightly modified version of the image sample from the official Bokeh gallery:
>
> import numpy as np
>
> from bokeh.plotting import figure, show, output_file
> from bokeh.models import ColumnDataSource
>
> N = 500
> x = np.linspace(0, 10, N)
> y = np.linspace(0, 10, N)
> xx, yy = np.meshgrid(x, y)
> d = np.sin(xx)*np.cos(yy)
>
> p = figure(x_range=(0, 10), y_range=(0, 10))
>
> # must give a vector of image data for image parameter
> source = ColumnDataSource({'myimage': [d]})
> p.image('myimage', x=0, y=0, dw=10, dh=10, palette="Spectral11", source=source)
>
> output_file("image.html", title="image.py example")
>
> show(p) # open a browser
>
> Running exactly the same source code using 'image' as the datasource column name works perfectly. I'm running Bokeh on Mac and I didn't have this error using Bokeh 0.12.3. I've tested on two different Mac machines and both exhibit the same behaviour.
>
> Has anyone else found the same error or am I doing some wrong? Does anybody know what could be the cause?
>
> Thank you in advance.
>
> Enrique G. Paredes
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f4a34ae1-c28f-4c36-babd-713a096178c1%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fec3f69b-8502-40d8-8d84-f591a922d4ed%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.