nengo / nengo-gui

Nengo interactive visualizer
Other
97 stars 38 forks source link

Modifying settings for GUI embedded in Jupyter #1005

Closed bmorcos closed 5 years ago

bmorcos commented 5 years ago

I was just working on creating an MNIST example notebook for NengoFPGA that uses the embedded GUI to display the classifications. Looking at the code there is no obvious/clean way to set the backend to use nengo_fpga.

@tcstewar offered this workaround:

viz = nengo_gui.jupyter.InlineGUI(model)  # create embedded gui object
viz.server.server.page_settings.backend = 'nengo_fpga'  # update settings
viz  # launch embedded gui

Adding the backend argument to the InlineGUI constructor would be relatively straightforward, however perhaps we would like to consider a scheme that manages all of the embedded GUI settings in some way.

jgosmann commented 5 years ago

You should be able to select the backend via the configure dialog too (not sure how permanent this solution is).

manages all of the embedded GUI settings in some way

Currently the settings that in theory can be set programmatically are split into the server settings and page settings. I think the server settings should not be user settable in Jupyter as these are things that are managed internally by InlineGUI to make everything working. In the page settings, the config file can already be set, the editor class should not be set by the user, which only leaves the backend. So a general solution might not be necessary or over-engineering at the moment.

bmorcos commented 5 years ago

So perhaps it makes sense to just do a small change and add the backend to the InlineGUI constructor? I think it's worth adding instead of just editing the settings after creation like suggested above.