Beispiel #1
0
    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 __init__(self, par):
        self.par = par

        # Define widgets.
        self.value_text = FloatText(description=par.name,
                                    min=self.par.min, max=self.par.max)
        self.min_text = FloatText(description='min', max=self.par.max)
        self.max_text = FloatText(description='max', min=self.par.min)
        self.min_checkbox = Checkbox(description='min')
        self.max_checkbox = Checkbox(description='max')
        self.vary_checkbox = Checkbox(description='vary')

        # Set widget values and visibility.
        if par.value is not None:
            self.value_text.value = self.par.value
        min_unset = self.par.min is None or self.par.min == -np.inf
        max_unset = self.par.max is None or self.par.max == np.inf
        self.min_checkbox.value = not min_unset
        self.min_text.visible = not min_unset
        self.min_text.value = self.par.min
        self.max_checkbox.value = not max_unset
        self.max_text.visible = not max_unset
        self.max_text.value = self.par.max
        self.vary_checkbox.value = self.par.vary

        # Configure widgets to sync with par attributes.
        self.value_text.on_trait_change(self._on_value_change, 'value')
        self.min_text.on_trait_change(self._on_min_value_change, 'value')
        self.max_text.on_trait_change(self._on_max_value_change, 'value')
        self.min_checkbox.on_trait_change(self._on_min_checkbox_change,
                                          'value')
        self.max_checkbox.on_trait_change(self._on_max_checkbox_change,
                                          'value')
        self.vary_checkbox.on_trait_change(self._on_vary_change, 'value')
Beispiel #3
0
 def plot_plugin_panel(self):
     plugin1 = Checkbox(description='plugin1')
     plugin2 = Checkbox(description='plugin2')
     plugin3 = Checkbox(description='plugin3')
     cp = ControlPanel(title='Choose Plot Plugins',
                       children=[plugin1, plugin2, plugin3])
     link((self.more, "value"), (cp, "visible"))
     return cp
Beispiel #4
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
Beispiel #5
0
    def INOUT_panel(self):
        # create correlation controls. NOTE: should only be called once.
        incheck = Checkbox(description='Import')
        link((self.model, "inbox"), (incheck, "value"))
        outcheck = Checkbox(description='Export')
        link((self.model, "outbox"), (outcheck, "value"))

        #loaddata = Checkbox(description="Testdata")
        #link((self.model, "load_spec"), (loaddata, "value"))
        #testdataset = Text(description = "")
        #link((self.model, "testdataset"), (testdataset, "value"))

        filename = Text(description="")
        link((self.model, "file_name"), (filename, "value"))
        loadbutton = Button(color='black',
                            background_color='AliceBlue',
                            description="Load")
        loadbutton.on_click(lambda x: self.model.load_from_ns())
        boxi = HBox([filename, loadbutton])
        #link((self.model, "load_spec"), (specbox, "visible"))

        #        loadfile = Checkbox(description="NB Variable") #Test Data
        #        link((self.model, "load_file"), (loadfile, "value"))

        #                filebox = HBox([loadbutton, filename])
        #link((self.model, "load_file"), (filebox, "visible"))

        #boxi = VBox([
        #HBox([loaddata, loadfile]),
        #loaddata,
        #             specbox,
        #filebox,
        #            ])
        link((self.model, "inbox"), (boxi, "visible"))

        saveplot = Button(color='black',
                          background_color='AliceBlue',
                          description='Save Plot')
        saveplot.on_click(lambda x: self.model.save_plot())
        savespec = Button(color='black',
                          background_color='AliceBlue',
                          description='Export Dataset')
        savespec.on_click(lambda x: self.model.save_to_ns())
        savespecas = Text(description="")
        link((self.model, "save_spec_as"), (savespecas, "value"))

        boxo = VBox([
            savespecas,
            HBox([saveplot, savespec]),
        ])
        link((self.model, "outbox"), (boxo, "visible"))

        #reset = Button(color='white',background_color='violet',description='Reset Defaults')
        #reset.on_click(lambda x: self.model.)

        #redraw = Button(description="Redraw")
        #redraw.on_click(lambda x: self.model.draw())

        return ControlPanel(
            title="Import/Export Dataset",
            children=[HBox([VBox([incheck, outcheck]),
                            VBox([boxi, boxo])])])
Beispiel #6
0
    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])
Beispiel #7
0
    def plot_panel(self):
        # create draw mode controls.  NOTE: should only be called once.
        cbar = Checkbox(description="Colorbar")
        link((self.model, "colorbar"), (cbar, "value"))

        interact = Checkbox(description="Interactive")
        link((self.model, "interactive"), (interact, "value"))

        plug_select = Checkbox(description="Line Selection")
        link((self.model, "selectlines"), (plug_select, "value"))

        autoupdate = Checkbox(description="Auto Update")
        link((self.model, "autoupdate"), (autoupdate, "value"))

        plugin2 = Checkbox(description='Cursor')
        plugin3 = Checkbox(description='plugin3')
        fwidth = FloatText(description='Plot width')
        fheight = FloatText(description='Plot height')
        link((self.model, "figwidth"), (fwidth, "value"))
        link((self.model, "figheight"), (fheight, "value"))

        f = Text(description="Function:")
        link((self.model, "user_f"), (f, "value"))
        fapp = Button(color='black',
                      background_color='AliceBlue',
                      description="Apply")
        fapp.on_click(lambda x: self.model.apply_userf(name='apply clicked'))

        #plugins = HBox([plugin1,plugin2,plugin3])
        #more = Checkbox(description="More Options")### LINK IT
        #link((self, "moreopt"), (more, "value"))
        #popmore = Popup(children=[VBox([HBox([plug_select,plugin2,plugin3]),
        #                                HBox([f,fapp]),
        #                                VBox([fwidth, fheight])
        #                              ])],
        #                description='Advanced', button_text='Advanced')

        more = Checkbox(description="Advanced")
        link((self.model, "advancedbox"), (more, "value"))

        popmore = VBox([
            HBox([
                plug_select,
                plugin2,
                #		plugin3
            ]),
            HBox([f, fapp]),
            HBox([fwidth, fheight])
        ])
        link((self.model, "advancedbox"), (popmore, "visible"))

        cmapcheck = Checkbox(description="Colormap")
        link((self.model, "cmapbox"), (cmapcheck, "value"))

        cmap = Dropdown(description="Colormap", values=self.model.COLORMAPS)
        link((self.model, "colormap"), (cmap, "value"))
        link((self.model, "cmapbox"), (cmap, "visible"))

        colorcheck = Checkbox(description="Color")
        link((self.model, "colorbox"), (colorcheck, "value"))

        color = Dropdown(description="Color", values=self.model.COLORS)
        link((self.model, "color"), (color, "value"))
        link((self.model, "colorbox"), (color, "visible"))

        kind = Dropdown(description="Plot Type", values=PLOTPARSER.keys())
        link((self.model, "kind"), (kind, "value"))

        return ControlPanel(title="Plot Settings",
                            children=[
                                VBox([autoupdate, kind]),
                                HBox([cbar, interact]),
                                HBox([colorcheck, cmapcheck]),
                                HBox([more]), cmap, color, popmore
                            ])