def makeinteract3diagrams(v, z): Q = interactive(lambda x0, dx: view3diagrams( x0, dx, v1=v[0], v2=v[1], v3=v[2], z1=z[0], z2=z[1]), x0=IntSlider(min=0, max=10, step=1, value=4), dx=IntSlider(min=0, max=20, step=1, value=4)) return Q
def _display_on_map_iteractive(self, index, map_name, **kwargs): view = _MapView(self.solutions, map_name, **kwargs) slider = IntSlider(min=1, max=len(self.solutions), value=index + 1) slider.on_trait_change( lambda x: view(slider.get_state("value")["value"])) display(slider) view(1)
def makeinteractTXdiagram(): Q = interactive(lambda x0, dx: viewTXdiagram( x0, dx, v1=v1, v2=v2, v3=v3, z1=z1, z2=z2), x0=IntSlider(min=1, max=10, step=1, value=4), dx=IntSlider(min=1, max=10, step=1, value=4)) return Q
def display_on_map(self, map_name=None): view = _MapView(self.solutions, map_name) slider = IntSlider(min=1, max=len(self.solutions), value=1) slider.on_trait_change( lambda x: view(slider.get_state("value")["value"])) display(slider) view(1)
def iview(self, width = 400): f = lambda rows_start, rows_end,cols: display(self[list(cols)].iloc[rows_start:rows_end]) rs = IntSlider(min=0, max=self.shape[0], width=width) re = IntSlider(min=0, max=self.shape[0], width= width) link((re, 'min'), (rs, 'value')) interact(f, cols=SelectMultiple(options=self.columns.tolist()), rows_start=rs, rows_end=re, width=width)
def makeinteractTXwigglediagram(): v1 = 600. v2 = 1200. v3 = 1700. z1, z2 = 5., 10. Q = interactive(lambda x0, dx, tI, v, Fit=False: viewWiggleTX( x0, dx, tI, v, Fit=Fit, v1=v1, v2=v2, v3=v3, z1=z1, z2=z2), x0=IntSlider(min=1, max=10, step=1, value=4), dx=IntSlider(min=1, max=10, step=1, value=4), tI=FloatSlider(min=0., max=0.25, step=0.0025, value=0.05), v=FloatSlider(min=400, max=2000, step=50, value=1000.)) return Q
def TrajectorySliderView(traj, frame=0, **kwargs): """IPython notebook widget for viewing trajectories in the browser with an interactiver slider. Parameters ---------- traj : Trajectory Trajectory for which you want the viewer. frame : int, default=0 Frame to set the slider to by default kwargs : string See TrajectoryView for all available options. See Also -------- TrajectoryView: IPython notebook widget for displaying trajectories in the browser with WebGL. """ widget = TrajectoryView(traj, frame=frame, **kwargs) def slide(frame): widget.frame = frame s = IntSlider(min=0, max=traj.n_frames - 1, value=frame) slider = interactive(slide, frame=s) container = Box() container.children = [widget, slider] return container
def makeinteractTXwigglediagram(): Q = interactive(lambda x0, dx, tI, v, Fit=False: showWiggleTX(x0, dx, v1=v1, v2=v2, v3=v3, z1=z1, z2=z2, tI=tI, v=v, Fit=Fit, noise=True), x0=IntSlider(min=1, max=10, step=1, value=4), dx=IntSlider(min=1, max=10, step=1, value=4), tI=FloatSlider(min=0., max=0.25, step=0.0025, value=0.05), v=FloatSlider(min=400, max=2000, step=50, value=1000.)) return Q
def PseudoSectionWidget(survey, flag): dx = 5 xr = np.arange(-40, 41, dx) if flag == "PoleDipole": ntx, nmax = xr.size - 2, 8 dxr = np.diff(xr) elif flag == "DipolePole": ntx, nmax = xr.size - 1, 7 dxr = xr elif flag == "DipoleDipole": ntx, nmax = xr.size - 3, 8 dxr = np.diff(xr) xzlocs = getPseudoLocs(dxr, ntx, nmax, flag) PseudoSectionPlot = lambda i, j: PseudoSectionPlotfnc(i, j, survey, flag) return interact(PseudoSectionPlot, i=IntSlider(min=0, max=ntx - 1, step=1, value=0), j=IntSlider(min=0, max=nmax - 1, step=1, value=0))
def _widget_abbrev_single_value(o): """Make widgets from single values, which can be used as parameter defaults.""" if isinstance(o, string_types): return Text(value=unicode_type(o)) elif isinstance(o, dict): return Dropdown(options=o) elif isinstance(o, bool): return Checkbox(value=o) elif isinstance(o, float): min, max, value = _get_min_max_value(None, None, o) return FloatSlider(value=o, min=min, max=max) elif isinstance(o, int): min, max, value = _get_min_max_value(None, None, o) return IntSlider(value=o, min=min, max=max) else: return None
def _display_on_map_iteractive(self, index, map_name, **kwargs): view = _MapView(self.solutions, map_name, **kwargs) slider = IntSlider(min=1, max=len(self.solutions), value=index + 1) slider.on_trait_change(lambda x: view(slider.get_state("value")["value"])) display(slider) view(1)
def plot_tree_interactive(): from IPython.html.widgets import interactive, IntSlider slider = IntSlider(min=0, max=8, step=1, value=0) return interactive(plot_tree, max_depth=slider)
plt.plot(x,data[:]) plt.xlabel("y") plt.ylabel("w") plt.figure() scalex = np.sqrt(np.abs(data[1]/x[1]) * p['viscosity']) / p['viscosity'] scaley = 1./np.sqrt(np.abs(data[1]/x[1]) * p['viscosity']) plt.plot(scalex*x[:50],scaley*data[:50], 'x-') plt.grid(True) plt.xlabel("y+") plt.ylabel("w+") plt.figure() scalex = np.sqrt(np.abs(data[-1]/(x[-1]-1)) * p['viscosity']) / p['viscosity'] scaley = 1./np.sqrt(np.abs(data[-1]/(x[-1]-1)) * p['viscosity']) plt.plot(scalex*(x[-50:]-1),scaley*data[-50:], 'x-') plt.grid(True) plt.xlabel("y+") plt.ylabel("w+") interact(plot_profile, frame=(0,64), index=IntSlider(min=0,max=sc[0.0,'w_xy'].shape[0]-1,step=8,value=int(sc[0.0,'w_xy'].shape[0]*7/9)) ) # In[8]: get_ipython().magic('install_ext http://raw.github.com/jrjohansson/version_information/master/version_information.py') get_ipython().magic('load_ext version_information') get_ipython().magic('version_information numpy, matplotlib, slict, chest, glopen, globussh')
def makeinteractSeisRefracSurvey(): Q = interactive(viewSeisRefracSurvey, x0=IntSlider(min=0, max=10, step=1, value=0), dx=IntSlider(min=1, max=10, step=1, value=8)) return Q
def MidpointPseudoSectionWidget(): ntx = 18 return interact(DipoleDipolefun, i=IntSlider(min=0, max=ntx - 1, step=1, value=0))
def display_on_map(self, map_name=None): view = _MapView(self.solutions, map_name) slider = IntSlider(min=1, max=len(self.solutions), value=1) slider.on_trait_change(lambda x: view(slider.get_state("value")["value"])) display(slider) view(1)