Adapt crossfilter application to perform action on selection

Hi,

I’ll start by stating my objective, in case I’m going about it the wrong way. The crossfilter application in the bokeh examples is almost perfect for my needs, but I want to see (for instance in a table) which points are selected with the box select tool, and export that information to a file, ideally by clicking a button. I thought I could do it by attaching a callback to the application data, and I tried a couple of approaches. Everything I did was on bokeh 0.10.0, installed from pip, and running "bokeh-server --script crossfilter_app.py. I just altered the setup_events method of the CrossFilter class and added the following code:

    if self.data:
        print "THERE IS DATA!"
        self.data.on_change('selected', 'on_selection_change')
    if self.data:
        print "THERE IS DATA!"
        self.on_change('selected', self.data, 'on_selection_change')
  1. Based on Making Interactions — Bokeh 2.4.2 Documentation

     if self.data:
         print "THERE IS DATA!"
         self.data.callback = CustomJS(args=dict(d=self), code="""
             var inds = cb_obj.get('selected')['1d'].indices;
             var d1 = cb_obj.get('data');
             console.log(d1)
             """
         )
    

I added the “THERE IS DATA!” print just to see if that code was being reached, and it was. However, in attempts 1 and 2 the on_selection_change method (which was simply writing a string to a file, as a test) was not called after a selection was made. Attempt 3 produced no output in the javascript console. I have seen the examples for selection actions, which is where my code comes from, but I didn’t find any that involved applications, such as crossfilter, so I’m guessing it may have to be done in a different way. Any help would be appreciated.

Thank you very much,
Paulo Almeida

Hi Paulo,

The crossfilter example application is a very powerful but, unfortunately, very customized that had limitations for what concerns extending its functionality. Part of this is because it has been implemented on a very old bokeh version that didn’t have yet many of the features we currently have (so we had to write very custom code). Also, it is based on the old bokeh-server that has been completely rewritten with countless improvements. This means it’s broken with the new bokeh 0.11 version that is arriving soon the example will not work anymore. Moreover, it’s basically a black box that is fully custom and is very hard to customize or extend.

The good news is that there is an active effort to port the crossfilter example to the new server shipping with 0.11. This example will be self contained and should much more easy and clear about hot it can be customized or extended.

I hope this could be landing in a branch soon so you can keep track of the progress or, even better, check if you can/want to contribute to the implementation.

Thank you

Fabio

···

On Sat, Dec 12, 2015 at 12:29 AM, [email protected] wrote:

Hi,

I’ll start by stating my objective, in case I’m going about it the wrong way. The crossfilter application in the bokeh examples is almost perfect for my needs, but I want to see (for instance in a table) which points are selected with the box select tool, and export that information to a file, ideally by clicking a button. I thought I could do it by attaching a callback to the application data, and I tried a couple of approaches. Everything I did was on bokeh 0.10.0, installed from pip, and running "bokeh-server --script crossfilter_app.py. I just altered the setup_events method of the CrossFilter class and added the following code:

    if self.data:
        print "THERE IS DATA!"
        self.data.on_change('selected', 'on_selection_change')
    if self.data:
        print "THERE IS DATA!"
        self.on_change('selected', self.data, 'on_selection_change')
  1. Based on http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-selections

     if self.data:
         print "THERE IS DATA!"
         self.data.callback = CustomJS(args=dict(d=self), code="""
             var inds = cb_obj.get('selected')['1d'].indices;
             var d1 = cb_obj.get('data');
             console.log(d1)
             """
         )
    

I added the “THERE IS DATA!” print just to see if that code was being reached, and it was. However, in attempts 1 and 2 the on_selection_change method (which was simply writing a string to a file, as a test) was not called after a selection was made. Attempt 3 produced no output in the javascript console. I have seen the examples for selection actions, which is where my code comes from, but I didn’t find any that involved applications, such as crossfilter, so I’m guessing it may have to be done in a different way. Any help would be appreciated.

Thank you very much,
Paulo Almeida

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/b92ccecd-8be4-4edd-9521-72001a50ebff%40continuum.io.

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

Fabio Pliger

Senior Software Engineer, Bokeh

Hi Fabio,

Thanks for the reply and sorry for the delay, Christmas happened. I’ll definitely check the new version. Regarding the crossfilter example, I saw there’s a task/crossfilter-example-refactor branch in the repository. I’d be glad to contribute, if I’m technically able to do it, but since I’ve had very little contact with the code (and none with the new server), I’m not sure. I’ll take a look.

Cheers,
Paulo

sábado, 12 de Dezembro de 2015 às 17:42:01 UTC, Fabio Pliger escreveu:

···

Hi Paulo,

The crossfilter example application is a very powerful but, unfortunately, very customized that had limitations for what concerns extending its functionality. Part of this is because it has been implemented on a very old bokeh version that didn’t have yet many of the features we currently have (so we had to write very custom code). Also, it is based on the old bokeh-server that has been completely rewritten with countless improvements. This means it’s broken with the new bokeh 0.11 version that is arriving soon the example will not work anymore. Moreover, it’s basically a black box that is fully custom and is very hard to customize or extend.

The good news is that there is an active effort to port the crossfilter example to the new server shipping with 0.11. This example will be self contained and should much more easy and clear about hot it can be customized or extended.

I hope this could be landing in a branch soon so you can keep track of the progress or, even better, check if you can/want to contribute to the implementation.

Thank you

Fabio

On Sat, Dec 12, 2015 at 12:29 AM, [email protected] wrote:

Hi,

I’ll start by stating my objective, in case I’m going about it the wrong way. The crossfilter application in the bokeh examples is almost perfect for my needs, but I want to see (for instance in a table) which points are selected with the box select tool, and export that information to a file, ideally by clicking a button. I thought I could do it by attaching a callback to the application data, and I tried a couple of approaches. Everything I did was on bokeh 0.10.0, installed from pip, and running "bokeh-server --script crossfilter_app.py. I just altered the setup_events method of the CrossFilter class and added the following code:

    if self.data:
        print "THERE IS DATA!"
        self.data.on_change('selected', 'on_selection_change')
    if self.data:
        print "THERE IS DATA!"
        self.on_change('selected', self.data, 'on_selection_change')
  1. Based on http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-selections

     if self.data:
         print "THERE IS DATA!"
         self.data.callback = CustomJS(args=dict(d=self), code="""
             var inds = cb_obj.get('selected')['1d'].indices;
             var d1 = cb_obj.get('data');
             console.log(d1)
             """
         )
    

I added the “THERE IS DATA!” print just to see if that code was being reached, and it was. However, in attempts 1 and 2 the on_selection_change method (which was simply writing a string to a file, as a test) was not called after a selection was made. Attempt 3 produced no output in the javascript console. I have seen the examples for selection actions, which is where my code comes from, but I didn’t find any that involved applications, such as crossfilter, so I’m guessing it may have to be done in a different way. Any help would be appreciated.

Thank you very much,
Paulo Almeida

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/b92ccecd-8be4-4edd-9521-72001a50ebff%40continuum.io.

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


Fabio Pliger

Senior Software Engineer, Bokeh

Is there documentation how to program and use the bokeh server? There is a nice interactive web plot of 4gb of ocean data on youTube, https://www.youtube.com/watch?v=B-P3yA-P-sY

but I can not find any description how it was done. I have ~10Tbytes of data from the Greenbank radio telescope, and I would like to write something similar for exploring it.

The server documentation seems broken for this, if I look at
http://bokeh.pydata.org/en/0.10.0/docs/user_guide/server.html#downsampling-with-server

it just goes in circles, there isn’t anything there.

Can someone help with big data downsizing with bokeh server?

Perhaps let me know where the code for the 4gb of ocean data example is.

···

On Tue, Dec 29, 2015 at 7:44 PM, Paulo Almeida [email protected] wrote:

Hi Fabio,

Thanks for the reply and sorry for the delay, Christmas happened. I’ll definitely check the new version. Regarding the crossfilter example, I saw there’s a task/crossfilter-example-refactor branch in the repository. I’d be glad to contribute, if I’m technically able to do it, but since I’ve had very little contact with the code (and none with the new server), I’m not sure. I’ll take a look.

Cheers,
Paulo

sábado, 12 de Dezembro de 2015 às 17:42:01 UTC, Fabio Pliger escreveu:

Hi Paulo,

The crossfilter example application is a very powerful but, unfortunately, very customized that had limitations for what concerns extending its functionality. Part of this is because it has been implemented on a very old bokeh version that didn’t have yet many of the features we currently have (so we had to write very custom code). Also, it is based on the old bokeh-server that has been completely rewritten with countless improvements. This means it’s broken with the new bokeh 0.11 version that is arriving soon the example will not work anymore. Moreover, it’s basically a black box that is fully custom and is very hard to customize or extend.

The good news is that there is an active effort to port the crossfilter example to the new server shipping with 0.11. This example will be self contained and should much more easy and clear about hot it can be customized or extended.

I hope this could be landing in a branch soon so you can keep track of the progress or, even better, check if you can/want to contribute to the implementation.

Thank you

Fabio

On Sat, Dec 12, 2015 at 12:29 AM, [email protected] wrote:

Hi,

I’ll start by stating my objective, in case I’m going about it the wrong way. The crossfilter application in the bokeh examples is almost perfect for my needs, but I want to see (for instance in a table) which points are selected with the box select tool, and export that information to a file, ideally by clicking a button. I thought I could do it by attaching a callback to the application data, and I tried a couple of approaches. Everything I did was on bokeh 0.10.0, installed from pip, and running "bokeh-server --script crossfilter_app.py. I just altered the setup_events method of the CrossFilter class and added the following code:

    if self.data:
        print "THERE IS DATA!"
        self.data.on_change('selected', 'on_selection_change')
    if self.data:
        print "THERE IS DATA!"
        self.on_change('selected', self.data, 'on_selection_change')
  1. Based on http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-selections

     if self.data:
         print "THERE IS DATA!"
         self.data.callback = CustomJS(args=dict(d=self), code="""
             var inds = cb_obj.get('selected')['1d'].indices;
             var d1 = cb_obj.get('data');
             console.log(d1)
             """
         )
    

I added the “THERE IS DATA!” print just to see if that code was being reached, and it was. However, in attempts 1 and 2 the on_selection_change method (which was simply writing a string to a file, as a test) was not called after a selection was made. Attempt 3 produced no output in the javascript console. I have seen the examples for selection actions, which is where my code comes from, but I didn’t find any that involved applications, such as crossfilter, so I’m guessing it may have to be done in a different way. Any help would be appreciated.

Thank you very much,
Paulo Almeida

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/b92ccecd-8be4-4edd-9521-72001a50ebff%40continuum.io.

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

Fabio Pliger

Senior Software Engineer, Bokeh

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/fc4a8f91-fa50-4269-8dc1-2424d0a209f6%40continuum.io.

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

David P. Saroff
Rochester Institute of Technology
54 Lomb Memorial Dr, Rochester, NY 14623
[email protected] | (434) 227-6242

Hi David, we are just upon the code freeze for the 0.11 release, which includes a new, much better, much faster, much simpler to use server. Our docs sprint starts after the freeze, so expect full docs, examples, youtube tutorials, etc. ready for the actual release. In the mean time you can check out some of the examples I listed in the dev build announcement earlier today on this list.

Regarding the demo you mention, it actually does not use the Bokeh server although it could be written that way). That demo uses the AjaxDataSource. Unfortunately I have not had a chance to write it up in a way that I would like, but you can find the code in these gists for now:

  https://gist.github.com/bryevdv/aeec7a86827c13bf8e1f
  https://gist.github.com/bryevdv/c794c8b2d376b3d2cb7d
  https://gist.github.com/bryevdv/873d88c9dc7a66af4057

The last two are all for the data downsampling, which presumably you would have your own code for.

Additionally I should mention we will be making another library available as a public GitHub repo in the first few months of 2016. It is for the DataShader library which is specifically targeted at perceptually accurate interactive downsampling. It was a big hit when it was shown recently at Strata, where we used it to interactively explore the full 350 million point US census data set across any scales of interest on just a macbook.

Bryan

···

On Dec 29, 2015, at 7:28 PM, DAVID SAROFF (RIT Student) <[email protected]> wrote:

Is there documentation how to program and use the bokeh server? There is a nice interactive web plot of 4gb of ocean data on youTube, https://www.youtube.com/watch?v=B-P3yA-P-sY

but I can not find any description how it was done. I have ~10Tbytes of data from the Greenbank radio telescope, and I would like to write something similar for exploring it.

The server documentation seems broken for this, if I look at
Deploying the Bokeh Server — Bokeh 0.10.0 documentation

it just goes in circles, there isn't anything there.

Can someone help with big data downsizing with bokeh server?
Perhaps let me know where the code for the 4gb of ocean data example is.

On Tue, Dec 29, 2015 at 7:44 PM, Paulo Almeida <[email protected]> wrote:
Hi Fabio,

Thanks for the reply and sorry for the delay, Christmas happened. I'll definitely check the new version. Regarding the crossfilter example, I saw there's a task/crossfilter-example-refactor branch in the repository. I'd be glad to contribute, if I'm technically able to do it, but since I've had very little contact with the code (and none with the new server), I'm not sure. I'll take a look.

Cheers,
Paulo

sábado, 12 de Dezembro de 2015 às 17:42:01 UTC, Fabio Pliger escreveu:
Hi Paulo,

The crossfilter example application is a very powerful but, unfortunately, very customized that had limitations for what concerns extending its functionality. Part of this is because it has been implemented on a very old bokeh version that didn't have yet many of the features we currently have (so we had to write very custom code). Also, it is based on the old bokeh-server that has been completely rewritten with countless improvements. This means it's broken with the new bokeh 0.11 version that is arriving soon the example will not work anymore. Moreover, it's basically a black box that is fully custom and is very hard to customize or extend.

The good news is that there is an active effort to port the crossfilter example to the new server shipping with 0.11. This example will be self contained and should much more easy and clear about hot it can be customized or extended.

I hope this could be landing in a branch soon so you can keep track of the progress or, even better, check if you can/want to contribute to the implementation.

Thank you

Fabio

On Sat, Dec 12, 2015 at 12:29 AM, <[email protected]> wrote:
Hi,

I'll start by stating my objective, in case I'm going about it the wrong way. The crossfilter application in the bokeh examples is almost perfect for my needs, but I want to see (for instance in a table) which points are selected with the box select tool, and export that information to a file, ideally by clicking a button. I thought I could do it by attaching a callback to the application data, and I tried a couple of approaches. Everything I did was on bokeh 0.10.0, installed from pip, and running "bokeh-server --script crossfilter_app.py. I just altered the setup_events method of the CrossFilter class and added the following code:

1)

        if self.data:
            print "THERE IS DATA!"
            self.data.on_change('selected', 'on_selection_change')

2)

        if self.data:
            print "THERE IS DATA!"
            self.on_change('selected', self.data, 'on_selection_change')

3) Based on Interaction — Bokeh 3.3.2 Documentation

        if self.data:
            print "THERE IS DATA!"
            self.data.callback = CustomJS(args=dict(d=self), code="""
                var inds = cb_obj.get('selected')['1d'].indices;
                var d1 = cb_obj.get('data');
                console.log(d1)
                """
            )
            
I added the "THERE IS DATA!" print just to see if that code was being reached, and it was. However, in attempts 1 and 2 the on_selection_change method (which was simply writing a string to a file, as a test) was not called after a selection was made. Attempt 3 produced no output in the javascript console. I have seen the examples for selection actions, which is where my code comes from, but I didn't find any that involved applications, such as crossfilter, so I'm guessing it may have to be done in a different way. Any help would be appreciated.

Thank you very much,
Paulo Almeida

--
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/b92ccecd-8be4-4edd-9521-72001a50ebff%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
Fabio Pliger
Senior Software Engineer, Bokeh

--
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/fc4a8f91-fa50-4269-8dc1-2424d0a209f6%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
David P. Saroff
Rochester Institute of Technology
54 Lomb Memorial Dr, Rochester, NY 14623
[email protected] | (434) 227-6242

--
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/CABMftcRxW_0gfskaGP2p4-ncVUXqr5MYPjQeYKzLouStBSiJLQ%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.