Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default values for IPython widgets?

I am using IPython widgets to create an interactive plot that will help students understand the determinants of accuracy of various ODE solvers available in scipy.integrate.ode. However, I can't seem to find much in the way of documentation on the various types of widgets and their keyword args.

from IPython.html.widgets import *    

@interact(h=FloatTextWidget(), atol=FloatTextWidget(), rtol=FloatTextWidget(),
          k=IndexSliderWidget(), integrator=TextWidget()))
def plot_lotka_volterra_residuals(h=1e-1, atol=1e-3, rtol=1e-3, k=3, integrator='dopri5'):
    """Plots residuals of the Lotka-Volterra system."""
    # make a pretty plot!

In particular, I would like to know how to set a default value for each widget.

like image 315
davidrpugh Avatar asked Nov 11 '22 02:11

davidrpugh


1 Answers

The declaration of the widgets takes a value keyword argument; you may be able to adapt examples such as this, or try Rossant's detailed Europy tutorial.

like image 64
Ian Avatar answered Nov 15 '22 13:11

Ian