On Jan 25, 2017, at 4:56 PM, Mateusz Paprocki <mateusz.paprocki@continuum.io> wrote:
Hi,
On Wed, Jan 25, 2017 at 10:16 PM, Bryan Van de Ven <bryan@bokeh.org> wrote:
As of Bokeh 0.12.4 Bokeh serializes (some) numpy arrays using a binary array protocol. This can be vastly more efficient, especially for images. For example, a large image that could previously take 50 seconds to render, can now render in a ~2 seconds. However, this new feature requires the use of JS typed arrays. Given that the old performance could be absolutely unacceptable and unusable, going backwards on this is not really an option. If you are aware of some simple JS polyfills that might allow things to function, we'd be happy to try them. Otherwise I am not sure we can support the binary array protocol in conjunction with older browsers.
TypedArray.map() is not supported (at least according to MDN) in any version of IE, Safari (<- this may be outdated) and Opera, so we actually may want to take action, which is pretty simple, replace map() with explicit iteration. This may be a good idea anyway, because Array.map() is awfully slow for large arrays and TypedArray.map() may exhibit the same behavior. Also note that the code in question is unrelated to the binary protocol.
Mateusz
The best immediate advice I can offer you is a workaround that should circumvent using the new binary protocol: convert your numpy arrays to plain python lists before you pass them to glyph sources (only some NumPy array types are serialized using the binary protocol).
Thanks,
Bryan
> On Jan 25, 2017, at 3:02 PM, pstoeckl@u.rochester.edu wrote:
>
> Background:
> building a Bokeh server application that (among other things) displays 1-D traces on log-scale figures (i.e., y-axis logarithmic); source data is typed numpy arrays.
> We recently updated to Bokeh 0.12.4 and in testing I ran into the following error in Chrome that prevents the figure from displaying (approximate trace follows, unfortunately minified):
>
> Uncaught TypeError: t.map is not a function
> window.Bokeh.Bokeh.models/mappers/log_mapper.r.LogMapper.e.v_map_to_target
> window.Bokeh.Bokeh.models/canvas/cartesian_frame.r.CartesianFrame.e.map_to_screen
> window.Bokeh.Bokeh.models/plots/plot_canvas.r.PlotCanvasView.e.map_to_screen
> window.Bokeh.Bokeh.models/glyphs/glyph.r.GlyphView.e.map_to_screen
> window.Bokeh.Bokeh.models/glyphs/glyph.r.GlyphView.e.map_data
> window.Bokeh.Bokeh.models/renderers/glyph_renderer.r.GlyphRendererView.e.render
> window.Bokeh.Bokeh.models/plots/plot_canvas.r.PlotCanvasView.e._render_levels
> window.Bokeh.Bokeh.models/plots/plot_canvas.r.PlotCanvasView.e.render
> window.Bokeh.Bokeh.core/util/throttle.r.throttle.i
>
> After some digging, it appears that the problem is that my Chrome is fairly outdated at version 44, and therefore lacks support for the ES6 TypedArray map() function, and LogMapper.v_map_to_target is being passed a Float64Array that then attempts to call map(). By comparison, my Firefox (still old at v39, but supporting map()) displays the plot without issue. Glancing at the MDN reference's compatibility section, I suspect that Safari and IE would run into the same problem, but a more up-to-date Chrome and Firefox should be unaffected. (Possibly related: Bokeh issue #5056.)
>
> Below, a minimal server example that exhibits the error when accessed with Chrome v44:
> import numpy
>
> from bokeh.plotting import figure, curdoc
>
> x = numpy.arange(0,10,0.1,dtype='float64')
> y = numpy.arange(2,12,0.1,dtype='float64')
>
> fig = figure(y_axis_type='log')
> fig.line(x,y)
>
> curdoc().add_root(fig)
>
> Not high priority, but a compatibility hole that may be worth plugging.
>
> Peter Stoeckl
>
> --
> 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+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4dfa73a7-6f88-4c93-a4c4-95aba4ffd42a%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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/D86A649F-DBBA-4B9A-8110-A24266390B17%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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CANFzp8gorZMyGTwVCDDN80Ay9C9tMUQZ8yK7Ps-jP7y6S4_U8w%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.