Is there a way to suppress 'E-1000 <COLUMN_LENGTHS>' warning?

Is there a way to suppress ‘E-1000 <COLUMN_LENGTHS>’ warning, it’s clogging my command line :slight_smile:

Hi,

···

On Sun, Jan 8, 2017 at 11:43 AM, konijn [email protected] wrote:

Is there a way to suppress ‘E-1000 <COLUMN_LENGTHS>’ warning, it’s clogging my command line :slight_smile:

you can use simplefilter() from warnings module to silence this. However, instead of silencing this warning, you should actually fix the code and create data sources containing only columns of equal lengths. Column data sources with column of varying lengths may be misinterpreted by bokehjs and/or lead to platform specific behavior (especially prior to bokehjs 0.12.4). In future versions of bokeh an exception will be thrown instead of a warning.

If you need assistance on improving your code, let us know some details on what you’re trying to achieve.

Mateusz

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/6e093b18-6256-4f4a-83b7-b5b6ce12a6d0%40continuum.io.

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

I found a simple way to deal with different length variables was to put each variable inside a list. The ColumnDataSource sees the same column length (all 1 as each list contains a single variable) so it doesn’t cause an error, then to get the data simply access the first item in each list. E.g.:

import numpy
from bokeh.models import ColumnDataSource
x = numpy.random.rand(5)
y = numpy.random.rand(10)
cds = ColumnDataSource(data={‘x’:,‘y’:[y]})
xx = cds.data[‘x’][0]
yy = cds.data[‘y’][0]

Not sure if this is the correct way of doing things but it works for me.

···

On Sunday, January 8, 2017 at 12:50:00 PM UTC, mateusz.paprocki wrote:

Hi,

On Sun, Jan 8, 2017 at 11:43 AM, konijn [email protected] wrote:

Is there a way to suppress ‘E-1000 <COLUMN_LENGTHS>’ warning, it’s clogging my command line :slight_smile:

you can use simplefilter() from warnings module to silence this. However, instead of silencing this warning, you should actually fix the code and create data sources containing only columns of equal lengths. Column data sources with column of varying lengths may be misinterpreted by bokehjs and/or lead to platform specific behavior (especially prior to bokehjs 0.12.4). In future versions of bokeh an exception will be thrown instead of a warning.

If you need assistance on improving your code, let us know some details on what you’re trying to achieve.

Mateusz

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/6e093b18-6256-4f4a-83b7-b5b6ce12a6d0%40continuum.io.

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

Trying to understand, what is the rationale for wanting columns with different lengths? This is never going to be workable, but if I understood the intention perhaps I can suggest some alternative.

Thanks,

Bryan

···

On Jan 9, 2017, at 9:36 AM, Marcus Donnelly <[email protected]> wrote:

I found a simple way to deal with different length variables was to put each variable inside a list. The ColumnDataSource sees the same column length (all 1 as each list contains a single variable) so it doesn't cause an error, then to get the data simply access the first item in each list. E.g.:

import numpy
from bokeh.models import ColumnDataSource
x = numpy.random.rand(5)
y = numpy.random.rand(10)
cds = ColumnDataSource(data={'x':,'y':[y]})
xx = cds.data['x'][0]
yy = cds.data['y'][0]

Not sure if this is the correct way of doing things but it works for me.

On Sunday, January 8, 2017 at 12:50:00 PM UTC, mateusz.paprocki wrote:
Hi,

On Sun, Jan 8, 2017 at 11:43 AM, konijn <[email protected]> wrote:
Is there a way to suppress 'E-1000 <COLUMN_LENGTHS>' warning, it's clogging my command line :slight_smile:

you can use simplefilter() from warnings module to silence this. However, instead of silencing this warning, you should actually fix the code and create data sources containing only columns of equal lengths. Column data sources with column of varying lengths may be misinterpreted by bokehjs and/or lead to platform specific behavior (especially prior to bokehjs 0.12.4). In future versions of bokeh an exception will be thrown instead of a warning.

If you need assistance on improving your code, let us know some details on what you're trying to achieve.

Mateusz

--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6e093b18-6256-4f4a-83b7-b5b6ce12a6d0%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/a2458d22-3f7c-4cb4-aa33-772377b0cd63%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

For an example see my post on 6th Dec here: Redirecting to Google Groups

The cursor readout application is admittedly at bit specialised, but having a 2D/3D NumPy array with associated 1D dimension arrays in a single data source is
something I use a lot. It seems to work fine by putting the NumPy arrays inside a 1 element list (as per the example), but perhaps I’m just lucky!

Could I also take this opportunity to say what great software bokeh is. I’ve been using it for oceanographic data viewing and analysis and it’s the first time I’ve been able to anything this sophisticated in a web browser.

Thanks,
Marcus.

Hi Marcus,

Thanks for the kind words. One of the priorities for 0.12.5 is to implement "namespace models" which is just a fancy way of saying there will be a "scratch variable space" that can be shared between BokehJS and python, where you can attach and synchronize bits of data that don't make sense to go in a CDS. Once it's available, I think that will be the better solution.

Thanks,

Bryan

···

On Jan 9, 2017, at 10:28 AM, Marcus Donnelly <[email protected]> wrote:

Hi Bryan,

For an example see my post on 6th Dec here: Redirecting to Google Groups

The cursor readout application is admittedly at bit specialised, but having a 2D/3D NumPy array with associated 1D dimension arrays in a single data source is
something I use a lot. It seems to work fine by putting the NumPy arrays inside a 1 element list (as per the example), but perhaps I'm just lucky!

Could I also take this opportunity to say what great software bokeh is. I've been using it for oceanographic data viewing and analysis and it's the first time I've been able to anything this sophisticated in a web browser.

Thanks,
Marcus.

--
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/5c86e33b-b7fd-45ce-b156-2bc64fea56df%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks for the update Bryan, I’ll have a look at that when it arrives.
Best Regards, Marcus.

Hi Bryan (and all),

Just updated to 0.12.4 and I can’t store images for display in a ColumnDataSource any more (see example below). I get the following error in the browser (Firefox):

Argument 3 of CanvasRenderingContext2D.getImageData is not a finite floating-point value.

I also tried defining the CDS with: zsrc = ColumnDataSource(data={‘z’:z}), i.e. without z in a single item list. This doesn’t work either and gives the error:

this._image[i][0] is undefined

For my applications I need to store one or more NumPy ndarrays in a ColumnDataSource so they can be accessed/manipulated using JS and used in image plots (as per previous posts in this thread).

I’d greatly appreciate any assistance!

Thanks,
Marcus.

Example code

···

import numpy

from bokeh.charts import output_file
from bokeh.plotting import Figure, show
from bokeh.models import ColumnDataSource

z = numpy.random.randn(10,10)
zsrc = ColumnDataSource(data={‘z’:[z]})

p = Figure(x_range=(-5,5),y_range=(-5,5))

i = p.image(‘z’,source=zsrc,x=-5,y=-5,dw=10,dh=10,palette=“Spectral11”) # This doesn’t work
#i = p.image([z],x=-5,y=-5,dw=10,dh=10,palette=“Spectral11”) # This does

output_file(‘CDSTest.html’)
show(p)

Hi Marcus,

As a gentle suggestion, for searchability reasons, new messages are preferable for new questions / issues.

Hrm, it works in this following modified form:

  import numpy

  from bokeh.charts import output_file
  from bokeh.plotting import Figure, show
  from bokeh.models import ColumnDataSource

  z = numpy.random.randn(10,10)
  zsrc = ColumnDataSource(data={'image':[z]}) # CHANGE COLUMN NAME TO "image"

  p = Figure(x_range=(-5,5),y_range=(-5,5))

        # USE NEW COLUMN NAME
  i = p.image('image',source=zsrc,x=-5,y=-5,dw=10,dh=10,palette="Spectral11") # This doesn't work

  output_file('CDSTest.html')
  show(p)

So I'm not sure what would cause it to only accept the "standard" column name, but it's definitely a bug. Can you file a GH issue?

Hopefully you can tolerate using the column name "image" as workaround. If not, another alternative might be to use the "second" version, but pull the data source off afterwards:

  i = p.image([z],x=-5,y=-5,dw=10,dh=10,palette="Spectral11") # This does

  source = i.data_source

Thanks,

Bryan

···

On Jan 10, 2017, at 11:40 AM, Marcus Donnelly <[email protected]> wrote:

Hi Bryan (and all),

Just updated to 0.12.4 and I can't store images for display in a ColumnDataSource any more (see example below). I get the following error in the browser (Firefox):
Argument 3 of CanvasRenderingContext2D.getImageData is not a finite floating-point value.

I also tried defining the CDS with: zsrc = ColumnDataSource(data={'z':z}), i.e. without z in a single item list. This doesn't work either and gives the error:
this._image[i][0] is undefined

For my applications I need to store one or more NumPy ndarrays in a ColumnDataSource so they can be accessed/manipulated using JS and used in image plots (as per previous posts in this thread).

I'd greatly appreciate any assistance!

Thanks,
Marcus.

Example code
---------------------

import numpy

from bokeh.charts import output_file
from bokeh.plotting import Figure, show
from bokeh.models import ColumnDataSource

z = numpy.random.randn(10,10)
zsrc = ColumnDataSource(data={'z':[z]})

p = Figure(x_range=(-5,5),y_range=(-5,5))

i = p.image('z',source=zsrc,x=-5,y=-5,dw=10,dh=10,palette="Spectral11") # This doesn't work
#i = p.image([z],x=-5,y=-5,dw=10,dh=10,palette="Spectral11") # This does

output_file('CDSTest.html')
show(p)

--
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/b1c914df-d101-46b9-b6a1-86be29efb88f%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Many thanks Bryan! I’ll file a GH issue. Point taken re. new vs existing questions; I thought this might be related to the column lengths constraint but obviously not.

Best Regards,
Marcus.