コード例 #1
0
    def __init__(self, viewer):

        self.viewer = viewer

        self._layout_tab = Tab(
            [self.viewer.viewer_options, self.viewer.layer_options])
        self._layout_tab.set_title(0, "General")
        self._layout_tab.set_title(1, "Layers")

        self._advanced_button = Button(description='Show advanced')
        self._advanced_button.on_click(self._toggle_basic_advanced)

        self._layout_toolbar = HBox([], layout={'justify_content': 'center'})
        self._layout_top = HBox([], layout={'justify_content': 'center'})
        self._layout_middle = HBox([], layout={'justify_content': 'center'})
        self._layout_bottom = HBox([self._advanced_button],
                                   layout={'justify_content': 'center'})

        # Default to basic mode
        self.advanced = False

        super().__init__([
            self._layout_toolbar, self._layout_top, self._layout_middle,
            self._layout_bottom, self.viewer.output_widget
        ])

        self._update_layout()
コード例 #2
0
ファイル: view.py プロジェクト: pkgw/glue-jupyter
    def create_layout(self):

        self._layout_viewer_options = self._options_cls(self.state)

        # Check for a custom layout factory
        layout_factory = get_layout_factory()
        if layout_factory is not None:
            self._layout = layout_factory(self)
            return

        # Take all the different widgets and construct a standard layout
        # for the viewers, based on ipywidgets HBox and VBox. This can be
        # overriden in sub-classes to create alternate layouts.

        self._layout_toolbar = HBox([
            self.toolbar_selection_tools, self.toolbar_active_subset,
            self.toolbar_selection_mode
        ])

        self._layout_tab = Tab(
            [self._layout_viewer_options, self._layout_layer_options])
        self._layout_tab.set_title(0, "General")
        self._layout_tab.set_title(1, "Layers")

        self._layout = VBox([
            self._layout_toolbar,
            HBox([self.figure_widget, self._layout_tab]), self._output_widget
        ])
コード例 #3
0
def _make_delay_tab(box_factory, selected_index=0):
    """

    Parameters
    ----------
    box_factory : list of (func, tab_name)

    Example of box_factory: [(_make_gen_box, 'General'),
                             (_make_repr_box, 'Representation')]
    """

    tab = Tab([Box() for box, _ in box_factory])
    [tab.set_title(i, title) for i, (_, title) in enumerate(box_factory)]

    # trick
    if not tab.children[selected_index].children:
        tab.selected_index = 1

    def on_update_selected_index(change):
        index = change['new']
        if not tab.children[index].children:
            # make widget on demand
            tab.children[index].children = [
                box_factory[index][0](),
            ]

    tab.observe(on_update_selected_index, names='selected_index')

    # trigger
    tab.selected_index = selected_index

    return tab
コード例 #4
0
def direct():
    tab_box = Tab(children=[direct_conn(), direct_settings()])

    tab_box.set_title(0, 'Connection')
    tab_box.set_title(1, 'db Configuration')

    return tab_box
コード例 #5
0
 def _build_tabs(self,
                 resources: dict,
                 options_box: Box,
                 instance_creation: Optional[Box] = None) -> Tab:
     """
     Build tabs of widgets to display in Jupyter notebook
     :param resources: Dictionary description: html link from which the values are put into HTML and presented as
     description and link
     :param options_box: Box with method parameters/options (displayed under 'Method parameters' tab)
     :param instance_creation: Box with instance creation widget (displayed under 'Explained instance' tab)
     if provided. If None, no 'Explained instance' tab will be created.
     :return: Tabs to be displayed
     """
     tabs = Tab()
     if instance_creation is not None:
         tabs.children = [
             instance_creation, options_box,
             self._build_resources_widgets(resources)
         ]
         tabs.set_title(0, 'Explained instance')
         tabs.set_title(1, 'Method parameters')
         tabs.set_title(2, 'Resources')
     else:
         tabs.children = [
             options_box,
             self._build_resources_widgets(resources)
         ]
         tabs.set_title(0, 'Method parameters')
         tabs.set_title(1, 'Resources')
     return tabs
コード例 #6
0
    def _display(self):
        clear_output(wait=True)

        # Get current tab index
        tab_index = 0
        if self.tab is not None:
            tab_index = self.tab.selected_index

        # Get Wikipedia tab
        self.tab = Tab()
        self.tab.children = [
            self.wikipedia_tab.tab_child,
            self.free_text_tab.tab_child,
        ]
        self.tab.set_title(0, self.wikipedia_tab.title)
        self.tab.set_title(1, self.free_text_tab.title)

        # Select the wanted tab
        self.tab.selected_index = tab_index

        # Go button with tab
        box = VBox((HBox((self._do_embeddings_button,
                          self._document_vector_type)), self.tab))

        if self.fig is not None:
            # noinspection PyTypeChecker
            display(box, self.fig)
        else:
            # noinspection PyTypeChecker
            display(box)
コード例 #7
0
    def __init__(self, querier, citation_var, citation_file=None, debug=False, start=None, load=True):
        from .selenium_scholar import URLQuery
        reload()
        self.querier = querier
        work = work_by_varname(citation_var)
        citation_file = citation_file or getattr(work, "citation_file", citation_var)
        self.navigator = ArticleNavigator(citation_var, citation_file, backward=False, force_citation_file=False)
        self.query = URLQuery(self.navigator.work.scholar, start)
        self.next_page_widget = Button(description='Next Page', icon='fa-arrow-right')
        self.reload_widget = Button(description='Reload', icon='fa-refresh')
        self.previous_page_widget = Button(description='Previous Page', icon='fa-arrow-left')
        self.debug_widget = ToggleButton(value=debug, description="Debug")
        self.page_number_widget = Label(value="")
        self.next_page_widget.on_click(self.next_page)
        self.reload_widget.on_click(self.reload)
        self.previous_page_widget.on_click(self.previous_page)

        self.view = Tab([
            VBox([
                HBox([
                    self.previous_page_widget,
                    self.reload_widget,
                    self.next_page_widget,
                    self.debug_widget,
                    self.page_number_widget
                ]),
                self.navigator.output_widget,
            ]),
            self.navigator.view
        ])
        self.view.set_title(0, "Page")
        self.view.set_title(1, "Article")
        if load:
            self.reload(None)
コード例 #8
0
def total():
    def bar_datazoom_slider_a() -> Bar:
        c = (Bar().add_xaxis(
            ["Male", "Unknown", "Female", "Male/Female ",
             "M"]).add_yaxis("人数", [272, 21, 5, 4, 1]).set_global_opts(
                 title_opts=opts.TitleOpts(title="枪手的性别分布"), ))
        return c

    def bar_datazoom_slider_b() -> Bar:
        c = (Bar().add_xaxis([
            'White American or European American',
            'Black American or African American  ', 'Unknown  ',
            'Some other race', 'white', 'Asian American  ', 'Asian  ',
            'Native American or Alaska Native', 'black', 'White', 'Latino',
            'Two or more races', 'Asian American/Some other race ',
            'White American or European American/Some other Race',
            'Black American or African American/Unknown'
        ]).add_yaxis("人数",
                     [122, 76, 42, 20, 12, 11, 5, 3, 3, 2, 2, 2, 1, 1, 1
                      ]).set_global_opts(
                          title_opts=opts.TitleOpts(title="枪手种族"), ))
        return c

    def bar_datazoom_slider_c() -> Bar:
        c = (Bar().add_xaxis(['Unknown', 'Yes', 'No', 'Unclear']).add_yaxis(
            "人数", [111, 99, 90, 3]).set_global_opts(
                title_opts=opts.TitleOpts(title="枪手的精神状态"), ))
        return c

    tab = Tab()
    tab.add(bar_datazoom_slider_a(), "枪手的性别分布")
    tab.add(bar_datazoom_slider_b(), "枪手的种族")
    tab.add(bar_datazoom_slider_c(), "枪手的精神状态")
    return Markup(tab.render_embed())
コード例 #9
0
 def get_color_changer_widget(self,
                              skeletons: List[DrawableSkeleton]) -> Tab:
     skeleton_color_changer_tabs: List[VBox] = []
     pred_color_pickers: List[Tuple[ColorPicker, ColorPicker, ColorPicker,
                                    ColorPicker]] = []
     gt_color_pickers: List[Tuple[ColorPicker, ColorPicker, ColorPicker,
                                  ColorPicker]] = []
     for skeleton in skeletons:
         skeleton_color_changer_tab, color_pickers = self.__create_color_changer_tab(
             skeleton)
         skeleton_color_changer_tabs.append(skeleton_color_changer_tab)
         if skeleton.is_ground_truth:
             gt_color_pickers.append(color_pickers)
         else:
             pred_color_pickers.append(color_pickers)
     if len(pred_color_pickers) != 0 and len(gt_color_pickers) != 0:
         pred_skeleton_color_changer_tab = self.__create_color_synchronizer_tab(
             pred_color_pickers)
         gt_skeleton_color_changer_tab = self.__create_color_synchronizer_tab(
             gt_color_pickers)
         skeleton_color_changer_tabs.append(pred_skeleton_color_changer_tab)
         skeleton_color_changer_tabs.append(gt_skeleton_color_changer_tab)
     color_changer_widget: Tab = Tab(children=skeleton_color_changer_tabs)
     for i in range(len(skeletons)):
         color_changer_widget.set_title(
             i, 'Skeleton {:d} colors'.format(i + 1))
     if len(skeleton_color_changer_tabs) > len(skeletons):
         color_changer_widget.set_title(len(skeletons),
                                        'Pred skeleton colors')
         color_changer_widget.set_title(
             len(skeletons) + 1, 'GT skeleton colors')
     return color_changer_widget
コード例 #10
0
 def __init__(
     self,
     existing: Optional[Dict[str, Any]] = None,
     save_file_name: Optional[str] = "tmp.json",
 ) -> None:
     self.box_layout = Layout(
         overflow="scroll hidden",
         border="1px solid black",
         width="600px",
         height="",
         flex_flow="row",
         display="flex",
     )
     self.textbox_layout = Layout(
         overflow="scroll hidden",
         border="1px solid black",
         width="10px",
         height="",
         flex_flow="row",
         display="flex",
     )
     self.tab_layout = Layout(
         #             border="1px solid black",
         width="600px")
     self.label_layout = Layout(width="600px")
     self.textarea_layout = Layout(width="592px")
     self.smalltextarea_layout = Layout(width="570px")
     self.item_layout = Layout(height="200px", min_width="40px")
     self.cg_backend = ConfigGenerator(existing)
     self.save_file_name = save_file_name
     self.config = Textarea()
     self.tab = Tab()
     self.dict_res = {}
     self._make_grid()
コード例 #11
0
    def __init__(self):
        self.run_bt = Button(description='Demo0', button_style='info')
        self.mod_add_bt = Button(description='Add model', button_style='info')
        self.mod_remove_bt = Button(description='Remove model',
                                    button_style='warning')
        self.dts_selector = self.get_default_dts_selector()
        self.dts_selector.description = 'Dataset:'
        self.size_selector = self.get_default_size_selector()
        self.features_selector = self.get_default_features_selector()
        self.features_selector.layout = Layout(width='900px')
        self.model_name_column = VBox([Label(value='Model')])
        self.sampler_name_column = VBox([Label(value='Sampler')])
        self.box_type_column = VBox([Label(value='Box Type')])
        self.n_estim_column = VBox([Label(value='Number Estimators')])
        self.pca_column = VBox([Label(value='PCA?')])
        self.pca_order_column = VBox([Label(value='PCA Order')])

        self.models_bar = HBox([
            self.model_name_column,
            self.sampler_name_column,
            self.box_type_column,
            self.n_estim_column,
            self.pca_column,
            self.pca_order_column,
        ],
                               layout=Layout(border='3px solid black'))

        self.gui = Tab()

        self.tab0 = VBox([
            self.dts_selector,
            self.size_selector,
            self.mod_add_bt,
            self.mod_remove_bt,
            self.features_selector,
            self.models_bar,
            self.run_bt,
        ])

        self.tab1 = self.get_dt_hp_tab()
        self.tab2 = self.get_logit_hp_tab()
        self.tab3 = self.get_linearsvc_hp_tab()
        self.tab4 = self.get_samplers_params_tab()

        self.gui.children = [
            self.tab0, self.tab1, self.tab2, self.tab3, self.tab4
        ]
        tab_names = [
            'General', 'DT H-Params.', 'Logit H-Params.', 'SVC H-Params.',
            'Samplers Params'
        ]
        for i, e in enumerate(tab_names):
            self.gui.set_title(i, e)
        self.mod_add_bt.on_click(self.insert_model_bar)
        self.mod_remove_bt.on_click(self.remove_model_bar)
        self.insert_model_bar()
        # self.box_type_changed()
        self.sampler_changed()
        super().__init__()
コード例 #12
0
def main():

    tab_box = Tab(children=[data_source(), general()])

    tab_box.set_title(0, 'DataSource')
    tab_box.set_title(1, 'General')

    return tab_box
コード例 #13
0
ファイル: gammaboard.py プロジェクト: TjarkMiener/ctaplot
    def __init__(self,
                 experiments_directory,
                 bias_correction=False,
                 figsize=(12, 16)):

        self.experiments_dict = {
            exp_name: Experiment(exp_name, experiments_directory,
                                 bias_correction)
            for exp_name in os.listdir(experiments_directory)
            if os.path.isdir(experiments_directory + '/' +
                             exp_name) and exp_name +
            '.h5' in os.listdir(experiments_directory + '/' + exp_name)
        }
        self.site = 'north'
        self.ref = 'none'

        colors = np.arange(0,
                           1,
                           1 / len(self.experiments_dict.keys()),
                           dtype=np.float32)
        np.random.seed(1)
        np.random.shuffle(colors)
        cmap = plt.cm.tab20
        for (key, color) in zip(self.experiments_dict.keys(), colors):
            self.experiments_dict[key].color = cmap(color)

        visible_experiments = set()

        experiment_info_box = Tab()
        tabs = {}

        self._fig_resolution, self._axes_resolution = create_resolution_fig(
            figsize=figsize)
        ax_eff_area = self._axes_resolution[1][1]
        ax_eff_area.set_ylim(ax_eff_area.get_ylim())
        self._fig_resolution.subplots_adjust(bottom=0.2)

        carousel = make_experiments_carousel(self.experiments_dict,
                                             experiment_info_box, tabs,
                                             self._fig_resolution,
                                             visible_experiments)
        site_selector = Dropdown(options=['North', 'South'],
                                 value='North',
                                 description='Site')
        site_selector.observe(create_update_site(self), names='value')

        reference_selector = Dropdown(
            options=['None', 'performances', 'requirements'],
            value='None',
            description='Reference')
        reference_selector.observe(create_update_reference(self),
                                   names='value')

        self.exp_box = VBox([
            HBox([site_selector, reference_selector]),
            HBox([carousel, experiment_info_box])
        ])
コード例 #14
0
ファイル: full.py プロジェクト: nvictus/CoolBox
 def compose_panel(self, widgets_dict):
     # compose navigation_bar
     navigation_bar = self.navigation_bar.panel
     track_config = compose_track_config_panel(widgets_dict['track_config'])
     panel = Tab()
     panel.children = [navigation_bar, track_config]
     panel.set_title(0, "Navigation")
     panel.set_title(1, "Tracks")
     return panel
コード例 #15
0
ファイル: experiment.py プロジェクト: ocakgun/Auspex
 def get_final_plots(self, quad_funcs=[np.abs, np.angle]):
     from ipywidgets import Tab
     tab = Tab()
     plots = []
     for i, p in enumerate(self.plotters):
         tab.set_title(i, p.filter_name)
         plots.append(p.get_final_plot(quad_funcs=quad_funcs))
     tab.children = plots
     return tab
コード例 #16
0
def get_widget_box():

    try:
        tab_box = Tab(children=[get_panel.get(), help_docs.widget_box(),
                                settings.main()])

        tab_box.set_title(0, 'Get Data')
        tab_box.set_title(1, 'Help')
        tab_box.set_title(2, 'Settings')

    except Exception as err:
        tab_box = Tab(children=[help_docs.widget_box(),
                                settings.main()])

        tab_box.set_title(0, 'Help')
        tab_box.set_title(1, 'Settings')
        print("Could not show 'Get panel'.", err)

    return tab_box
コード例 #17
0
    def __init__(self):
        # self.gammas = [0.00001, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100]
        self.gammas = [10**i for i in range(-5, 3)]
        self.all_datasets_names = SUPPORTED_DATASETS
        self.run_bt = Button(description='Demo3', button_style='info')

        self.dataset_selector = self.get_default_dts_selector()
        self.size_selector = self.get_default_size_selector()
        self.dataset_selector.description = 'Dataset:'
        self.model_selector = self.get_default_model_selector()
        self.model_selector.description = 'Model'
        self.sampler_selector = Dropdown(
            options=['rbf', 'nystroem'], value='rbf', description='Sampler')
        self.features_selector = self.get_default_features_selector()
        self.features_selector.description = 'Features'
        self.features_selector.layout = Layout(width='800px')
        self.box_type_selector = self.get_default_box_type_selector()
        self.box_type_selector.description = 'Bagging'
        self.n_estimators_selector = self.get_default_n_estimators_selector()
        self.n_estimators_selector.description = 'N. estim.'
        self.pca_checkbox = self.get_default_pca_checkbox()
        self.pca_checkbox.description = 'Perform PCA?'
        self.pca_order_selector = self.get_default_pca_order_selector()
        self.g = VBox([
            self.dataset_selector,
            self.size_selector,
            self.model_selector,
            self.sampler_selector,
            self.features_selector,
            self.box_type_selector,
            self.n_estimators_selector,
            self.pca_checkbox,
            self.pca_order_selector,
        ])
        # self.gui = VBox([self.g, self.run_bt])
        self.tab0 = VBox([self.g, self.run_bt])
        self.tab1 = self.get_dt_hp_tab()
        self.tab2 = self.get_logit_hp_tab()
        self.tab3 = self.get_linearsvc_hp_tab()

        self.gui = Tab()
        self.gui.children = [self.tab0, self.tab1, self.tab2, self.tab3]
        tab_names = ['General', 'DT H-Params.', 'Logit H-Params.',
                     'SVC H-Params.']
        for i, e in enumerate(tab_names):
            self.gui.set_title(i, e)

        self.box_type_selector.observe(self.box_type_changed, 'value')
        self.pca_checkbox.observe(self.pca_checkbox_changed, 'value')
        # self.sampler_selector.observe(self.sampler_changed, 'value')
        # Solo para inhabilitar los que tocan
        self.box_type_changed()
        self.pca_checkbox_changed()
        # self.sampler_changed()
        super().__init__()
コード例 #18
0
def create_tab(do_display: bool = True) -> Tab:
    """Creates a `ipywidgets.Tab` which can display outputs in its tabs."""
    tab = Tab(children=(Output(), ))

    tab.set_title(0, "Info")
    if do_display:
        display(tab)

    with tab.children[-1]:
        print("Plots and snapshots will show up here!")
    return tab
コード例 #19
0
ファイル: get_settings.py プロジェクト: mokasini/cbm
def direct():
    #     try:
    tab_box = Tab(children=[settings.direct_conn(), direct_settings()])

    tab_box.set_title(0, 'Connection')
    tab_box.set_title(1, 'db Configuration')
    #     except:
    #         tab_box = Tab(children=[direct_conn()])
    #         tab_box.set_title(0, 'Connection')
    #         print("!WARNING! Can not load direct configuration settings.")
    return tab_box
コード例 #20
0
def foi_widget_box():

    tab_box = Tab(children=[foi_panel.foi(), foi_panel.foi_v2(), foi_help.widget_box_foi(),
                  foi_settings.widget_box()])

    tab_box.set_title(0, 'FOI Assessment V1')
    tab_box.set_title(1, 'FOI Assessment V2')
    tab_box.set_title(2, 'Help')
    tab_box.set_title(3, 'Settings')

    return tab_box
コード例 #21
0
def qa_widget_box():

    tab_box = Tab(
        children=[qa_panel.qa(),
                  help_docs.widget_box(),
                  settings.main()])

    tab_box.set_title(0, 'Quality assessment')
    tab_box.set_title(1, 'Help')
    tab_box.set_title(2, 'Settings')

    return tab_box
コード例 #22
0
 def __create_empty_loss_tabs(self) -> Tab:
     skeleton_loss_tabs: List[HBox] = [
         self.__create_loss_tab_for_skeleton(i)
         for i in range(self.number_of_skeletons)
     ]
     all_losses_tab: HBox = self.__create_all_losses_tab()
     loss_tabs: List[HBox] = [all_losses_tab] + skeleton_loss_tabs
     loss_tab: Tab = Tab(children=loss_tabs)
     loss_tab.set_title(0, "All losses")
     for i in range(len(loss_tabs) - 1):
         loss_tab.set_title(i + 1, 'Skeleton {:d} losses'.format(i + 1))
     return loss_tab
コード例 #23
0
def view_widget_box():

    try:
        tab_box = Tab(children=[
            view_panel.view(),
            help_docs.widget_box(),
            settings.main()
        ])

        tab_box.set_title(0, 'View single parcel')
        tab_box.set_title(1, 'Help')
        tab_box.set_title(2, 'Settings')

    except Exception as err:
        tab_box = Tab(children=[help_docs.widget_box(), settings.main()])

        tab_box.set_title(1, 'Help')
        tab_box.set_title(2, 'Settings')
        print("Could not show 'View panel'.", err)

    return tab_box
コード例 #24
0
def ext_widget_box():

    tab_box = Tab(children=[
        ext_panel.extract(),
        help_docs.widget_box(),
        settings.main()
    ])

    tab_box.set_title(0, 'Extract Data')
    tab_box.set_title(1, 'Help')
    tab_box.set_title(2, 'Settings')

    return tab_box
コード例 #25
0
def cbm_widget_box():

    tab_box = Tab(children=[
        cbm_panel.cbm(),
        help_docs.widget_box(),
        cbm_settings.widget_box()
    ])

    tab_box.set_title(0, 'Checks by Monitoring')
    tab_box.set_title(1, 'Help')
    tab_box.set_title(2, 'Settings')

    return tab_box
コード例 #26
0
def create_tab(do_display: bool = True) -> Tab:
    """Creates a `ipywidgets.Tab` which can display outputs in its tabs."""
    output = Output()
    tab = Tab(children=(output, ))

    tab.set_title(0, "Info")
    if do_display:
        display(tab)

    with output:
        # Prints it in the Output inside the tab.
        print("Plots and snapshots will show up here!")
    return tab
コード例 #27
0
ファイル: proc_main.py プロジェクト: mokasini/cbm
def proc_widget_box():

    tab_box = Tab(children=[
        proc_panel.proc(),
        help_docs.widget_box(),
        proc_settings.widget_box()
    ])

    tab_box.set_title(0, 'Process Data')
    tab_box.set_title(1, 'Help')
    tab_box.set_title(2, 'Settings')

    return tab_box
コード例 #28
0
def plot_iteration(line: str):
    """call a registered plotter function for the given repetition and iteration"""
    args = parse_argstring(plot_iteration, line)

    items = []

    from ipywidgets.widgets.interaction import show_inline_matplotlib_plots

    global __instances, __instantiated_experiments
    for exp_instance, exp_config in zip(__instances, __instantiated_experiments):
        out = Output()
        items.append(out)
        with out:
            # clear_output(wait=True)
            figures = __iteration_plot_functions[args.plotter_name](exp_instance, args.args)
            show_inline_matplotlib_plots()
            if args.save_figures:
                if args.format is None:
                    args.format = plt.rcParams['savefig.format']
                os.makedirs('plots/{}'.format(exp_config['name']), exist_ok=True)
                for i, f in enumerate(figures):
                    filename = 'plots/{}/{}figure_{}.{}'.format(exp_config['name'], args.prefix, i, args.format)
                    if args.format == 'tikz':
                        try:
                            from matplotlib2tikz import save as tikz_save
                            with Output():
                                tikz_save(filename, figureheight='\\figureheight', figurewidth='\\figurewidth')
                        except ModuleNotFoundError:
                            warnings.warn('Saving figure as tikz requires the module matplotlib2tikz.')
                    else:
                        f.savefig(filename, format=args.format)

    if len(items) > 1:
        tabs = Tab(children=items)
        for i, exp in enumerate(__instantiated_experiments):
            if args.tab_title:
                if (args.tab_title[0] == args.tab_title[-1]) and args.tab_title.startswith(("'", '"')):
                    selectors = args.tab_title[1:-1]
                else:
                    selectors = args.tab_title
                selectors = selectors.split(' ')
                values = [reduce(lambda a, b: a[b], [exp['params'], *selector.split('.')]) for selector in
                          selectors]
                tabs.set_title(i, ' '.join(map(str, values)))
            else:
                tabs.set_title(i, '...' + exp['name'][-15:])
        display(tabs)
    elif len(items) == 1:
        return items[0]
    else:
        warnings.warn('No plots available for {} with args {}'.format(args.plotter_name, args.args))
コード例 #29
0
    def build_widget(self):
        widget = []
        
        # dropdown for system selection
        # checkbox for showing/hiding unmodified data
        self.select = Dropdown(options=self.df_all.index.values,description='System:')
        
        # slider array for trimming datapoints
        vbox1 = [HBox([Label('Trim-Lo')],layout={'justify_content':'center'}) ]
        vbox2 = [HBox([Label('Trim-Hi')],layout={'justify_content':'center'}) ]
        self.apply_bg = Checkbox(value=False,description='Subtract BG?')
        vbox3 = [HBox([self.apply_bg],layout={'justify_content':'center'}) ]
        for config in self.df_all.columns:
            sl1 = IntSlider(min=0,max=25,value=7,description='{}'.format(config))
            sl1.style.handle_color = self.df_colors.loc[config]
            vbox1.append(sl1)
            
            sl2 = IntSlider(min=0,max=100,value=15,description='{}'.format(config))
            sl2.style.handle_color = self.df_colors.loc[config]
            vbox2.append(sl2)

            # sl3 = FloatSlider(min=0.001,max=1,value=0.5,description='{}'.format(config))
            sl3 = FloatLogSlider(min=-3,max=0,value=0.5,description='{}'.format(config))
            sl3.style.handle_color = self.df_colors.loc[config]
            vbox3.append(sl3)
        widget.append(HBox([VBox(vbox1), VBox(vbox2)]))
        
        ## store slider objects in dataframe
        self.df_slider = pd.DataFrame(np.transpose([vbox1[1:],vbox2[1:],vbox3[1:]]),index=self.df_all.columns,columns=['Lo','Hi','bgLoc'])
        # self.df_bgslider = pd.DataFrame(np.transpose(vbox3[1:]),index=self.df_all.columns,columns=['Lo','Hi'])
        
        # dropdown for shift-configuration selection
        ops = ['None']
        ops += [str(i) for i in self.df_all.columns.values]
        self.shift_config = Dropdown(options=ops,description='Shift-To:')
        self.shift_factors_out = Output()
        self.show_original = Checkbox(value=True,description='Show Original Data')
        vbox4 = [VBox([self.shift_config,self.show_original]),self.shift_factors_out]

        # widget.append(HBox([VBox(vbox3),VBox(vbox4)]))
        self.bg_out = Output()
        widget.append(HBox([VBox(vbox3),self.bg_out]))
        widget.append(HBox(vbox4))
        
        tabs = Tab(widget)
        tabs.set_title(0,'Data Trimming')
        tabs.set_title(1,'Subtract BG')
        tabs.set_title(2,'Curve Shift')

        self.debug_out = Output()
        return VBox([self.select,tabs,self.debug_out])
コード例 #30
0
    def __init__(self, session, state=None):
        IPyWidgetView.__init__(self, session, state=state)
        WWTDataViewerBase.__init__(self)

        # In Glue+Jupyter Notebook, we need to explicitly specify this to get
        # the widget to fill up the horizontal space.
        self._wwt.layout.width = '100%'

        self._layout_viewer_options = JupterViewerOptions(
            self.state, self.state.imagery_layers)
        self._layout_tab = Tab(
            [self._layout_viewer_options, self._layout_layer_options])
        self._layout_tab.set_title(0, "General")
        self._layout_tab.set_title(1, "Layers")
        self._layout = HBox([self.figure_widget, self._layout_tab])