def interactive_responseFct(): app = interactive( plot_ResponseFct, h_boom=FloatSlider(min=h_boom, max=h_boom_max, step=0.1, value=h_boom, continuous_update=False), h_1=FloatSlider(min=0., max=zmax, value=0.1, step=0.1, continuous_update=False), sigma_1=FloatSlider(min=sigmin, max=sigmax, value=sigmin, step=sigmin, continuous_update=False), sigma_2=FloatSlider(min=sigmin, max=sigmax, value=sigmin, step=sigmin, continuous_update=False), orientation=ToggleButtons(options=['vertical', 'horizontal'])) return app
def naeem_panel(self): plott = Dropdown(description="Corr Plot", values=[ 'sync', 'async', 'phase', 'modulous', 'sync_codist', 'async_codist' ]) link((self.model, "plottype"), (plott, "value")) plot_3d = Dropdown(description="Kind", values=['corr2d', 'corr3d', 'contour3d']) link((self.model, "plot3d"), (plot_3d, "value")) scale_a = FloatSlider(description="Scale Start") scale_b = FloatSlider(description="Scale End") scalecheck = Checkbox(description="Scalling") link((self.model, "scalebox"), (scalecheck, "value")) cfill = Checkbox(description="Fill") link((self.model, "fill"), (cfill, "value")) return ControlPanel( title="NAEEM KHAN", children=[plott, plot_3d, scalecheck, scale_a, scale_b, cfill])
def interact_femPipe(): Q = interactive(fempipeWidget, alpha=FloatSlider(min=0.1, max=2., step=0.1, value=1.), pipedepth=FloatSlider(min=0.5, max=4.0, step=0.1, value=1.0)) return Q
def DC2DPseudoWidget(): # print xzlocs Q = interact(DC2DPseudoWidgetWrapper, rhohalf=FloatSlider(min=10, max=1000, step=1, value=1000), rhosph=FloatSlider(min=10, max=1000, step=1, value=50), xc=FloatSlider(min=-40, max=40, step=1, value=0), zc=FloatSlider(min=-20, max=0, step=1, value=-10), r=FloatSlider(min=0, max=15, step=0.5, value=5), surveyType=ToggleButtons( options=['DipoleDipole', 'PoleDipole', 'DipolePole'])) return Q
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 InteractNosiy(noisyDataFile, noisyTimeFile): noisy = interactive(NoisyNMOWidget, t0=FloatSlider(min=0.1, max=0.6, step=0.01, continuous_update=False), v=FloatSlider(min=800., max=2500., step=100., continuous_update=False), syndat=fixed(noisyDataFile), timdat=fixed(noisyTimeFile)) return noisy
def InteractClean(cleanDataFile, cleanTimeFile): clean = interactive(CleanNMOWidget, t0=FloatSlider(min=0.2, max=0.8, step=0.01, continuous_update=False), v=FloatSlider(min=1000., max=5000., step=100., continuous_update=False), syndat=fixed(cleanDataFile), timdat=fixed(cleanTimeFile)) return clean
def InteractLogs(d2=50, d3=100, rho1=2300, rho2=2300, rho3=2300, v1=500, v2=1000, v3=1500): logs = interactive(plotLogsInteract, d2=FloatSlider(min=0., max=100., step=5, value=d2), d3=FloatSlider(min=100., max=200., step=5, value=d3), rho1=FloatSlider(min=2000., max=5000., step=50., value=rho1), rho2=FloatSlider(min=2000., max=5000., step=50., value=rho2), rho3=FloatSlider(min=2000., max=5000., step=50., value=rho3), v1=FloatSlider(min=300., max=4000., step=50., value=v1), v2=FloatSlider(min=300., max=4000., step=50., value=v2), v3=FloatSlider(min=300., max=4000., step=50., value=v3)) return logs
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 InteractSeismogramTBL(v1=125, v2=125, v3=125): return interact(plotSeismogramInteractTBL, d2=FloatSlider(min=1., max=100., step=0.1, value=9.), d3=FloatSlider(min=2., max=100., step=0.1, value=9.5), rho1=FloatSlider(min=2000., max=5000., step=50., value=2300.), rho2=FloatSlider(min=2000., max=5000., step=50., value=2300.), rho3=FloatSlider(min=2000., max=5000., step=50., value=2300.), v1=FloatSlider(min=100., max=1200., step=5., value=v1), v2=FloatSlider(min=100., max=1200., step=5., value=v2), v3=FloatSlider(min=100., max=1200., step=5., value=v3), wavf=FloatSlider(min=5., max=100., step=1, value=67), wavA=FloatSlider(min=-0.5, max=1., step=0.25, value=1.), addNoise=False, usingT=True)
def InteractSeismogram(): return interact(plotSeismogramInteract, d2=(0., 150., 1), d3=(0., 200., 1), rho1=(2000., 5000., 50.), rho2=(2000., 5000., 50.), rho3=(2000., 5000., 50.), v1=(100., 4000., 5.), v2=(100., 4000., 5.), v3=(300., 4000., 50.), wavf=(5., 100., 2.5), wavA=FloatSlider(min=-0.5, max=1., step=0.25, value=1.), addNoise=False, usingT=True)
def InteractDtoT(Model): d20 = Model.kwargs["d2"] d30 = Model.kwargs["d3"] v10 = Model.kwargs["v1"] v20 = Model.kwargs["v2"] v30 = Model.kwargs["v3"] rho10 = Model.kwargs["rho1"] rho20 = Model.kwargs["rho2"] rho30 = Model.kwargs["rho3"] rho = np.r_[rho10, rho20, rho30] func = lambda d2, d3, v1, v2, v3: plotTimeDepthInteract( d2, d3, v1, v2, v3, rho) DtoT = interactive(func, d2=FloatSlider(min=0., max=100., step=5, value=d20), d3=FloatSlider(min=100., max=200., step=5, value=d30), v1=FloatSlider(min=500., max=3000., step=50., value=v10), v2=FloatSlider(min=500., max=3000., step=50., value=v20), v3=FloatSlider(min=500., max=3000., step=50., value=v30)) return DtoT
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 plot_svm_interactive(): from IPython.html.widgets import interactive, FloatSlider C_slider = FloatSlider(min=-3, max=3, step=.1, value=0, readout=False) gamma_slider = FloatSlider(min=-2, max=2, step=.1, value=0, readout=False) return interactive(plot_svm, log_C=C_slider, log_gamma=gamma_slider)
def slicing_panel(self): """ create spectrum controls. NOTE: should only be called once.""" model = self.model #For readability # ALL WIDGETS ARE CAPITALIZED. #AXIS = RadioButtons(values=[0,1],description="Axis") #link((model, "slice_axis"), (AXIS, "value")) SPECSTART = FloatSlider( description="Spec Start", min=model.specslice_position_start) #Will not try to update link((model, "specslice_position_start"), (SPECSTART, "value")) link((model, "specstep"), (SPECSTART, "step")) link((model, "specslider_start"), (SPECSTART, "min")) # Start end values (IE slider_min / slider_max) link((model, "specslider_end"), (SPECSTART, "max")) SPECEND = FloatSlider( description="Spec End", max=model.specslice_position_end) # Will not try to update link((model, "specslice_position_end"), (SPECEND, "value")) link((model, "specstep"), (SPECEND, "step")) link((model, "specslider_start"), (SPECEND, "min")) link((model, "specslider_end"), (SPECEND, "max")) # SPACING WIDGET SPECSPACING = IntText(description="Spec Sample by", value=1) link((model, "specspacing"), (SPECSPACING, "value")) TIMESTART = FloatSlider(description="Var Start", min=model.timeslice_position_start) link((model, "timeslice_position_start"), (TIMESTART, "value")) link((model, "timestep"), (TIMESTART, "step")) link((model, "timeslider_start"), (TIMESTART, "min")) link((model, "timeslider_end"), (TIMESTART, "max")) TIMEEND = FloatSlider(description="Var End", max=model.timeslice_position_end) link((model, "timeslice_position_end"), (TIMEEND, "value")) link((model, "timestep"), (TIMEEND, "step")) link((model, "timeslider_start"), (TIMEEND, "min")) link((model, "timeslider_end"), (TIMEEND, "max")) TIMESPACING = IntText(description="Var Sample by", value=1) link((model, "timespacing"), (TIMESPACING, "value")) speccheck = Checkbox(description="Spectral Axis") link((model, "specbox"), (speccheck, "value")) SPECRANGED = VBox([SPECSTART, SPECEND, SPECSPACING]) link((model, "specbox"), (SPECRANGED, "visible")) timecheck = Checkbox(description="Variation Axis") link((model, "timebox"), (timecheck, "value")) TIMERANGED = VBox([TIMESTART, TIMEEND, TIMESPACING]) link((model, "timebox"), (TIMERANGED, "visible")) return ControlPanel( title="Slicing/Sampling", children=[HBox([speccheck, timecheck]), SPECRANGED, TIMERANGED])
def AttenuationWidgetTBL(): i = interact(WaveVelandSkindWidgetTBL, epsr=FloatText(value=9.), sigma=FloatSlider(min=-4., max=1., step=0.5, value=-1.5)) return i