Beispiel #1
0
def ecdf_widgets():
    select_con = pn.widgets.Select(name='Select Concentration',
                                   options=['7', '9', '10', '12', '14'])
    select_dist = pn.widgets.Select(name='Select Distribution',
                                    options=['Exponential', 'Gamma'])
    select_diff = pn.widgets.Select(name='Select Type of Graph',
                                    options=['Regular', 'Difference'])

    @pn.depends(con=select_con.param.value,
                dist=select_dist.param.value,
                diff=select_diff.param.value)
    def plot_interactive_overlay(con, dist, diff):
        if diff == 'Regular' and dist == 'Gamma':
            return show_ecdfs(int(con))[0]
        elif diff == 'Difference' and dist == 'Gamma':
            return show_ecdfs(int(con))[1]
        if diff == 'Regular' and dist == 'Exponential':
            return show_ecdfs(int(con))[2]
        if diff == 'Difference' and dist == 'Exponential':
            return show_ecdfs(int(con))[3]

    widgets = pn.Column(pn.Spacer(height=20), select_con, pn.Spacer(height=20),
                        select_dist, pn.Spacer(height=20), select_diff)

    row1 = pn.Row(plot_interactive_overlay, pn.Spacer(width=15), widgets)
    return row1
Beispiel #2
0
 def panel(self):
     """
     Build the GUI as a panel object
     """
     fine_tuning = pn.Column(
         pn.pane.Markdown("### Fine-tuning model\nMap feature tensor to a dense vector"),
         self._fine_tuning_chooser,
         self._fine_tuning_desc,
         self._fine_tuning_hyperparams,
         self._weight_decay
     )
     output = pn.Column(
         pn.pane.Markdown("### Output model\nMap dense vector to class probabilities"),
         self._output_chooser,
         self._output_desc,
         self._output_hyperparams
     )
     """
     semisupervised = pn.Column(
         pn.pane.Markdown("### Semi-supervised learning\nUse unlabeled images to guide decision boundaries."),
         self._entropy_reg,
         #self._mean_teacher_alpha
     )"""
     
     return pn.Column(
         pn.pane.Markdown("## Model Options"),
         pn.Row(fine_tuning, 
                pn.Spacer(background="whitesmoke", width=10), 
                output, 
                pn.Spacer(background="whitesmoke", width=10), 
                self._semisup_panel),
         pn.Row(self._build_button, self._current_model)
     )
def _create_app():
    player_select_widget = pn.widgets.Select(
        options=list(_get_epl_strikers_df()["player_name"].unique()),
        value="Bruno Fernandes",
        min_width=1600,
        max_width=1800,
    )

    # assign css class to achieve better design granularity
    player_select_row = pn.Row(
        pn.pane.Str("Choose A Player for Analysis:", sizing_mode="fixed"),
        player_select_widget,
        align="center",
        css_classes=["player_select_row"],
    )

    # Panel HTML elements can take a 'style' parameter directly.
    # You could alternatively assign a css class as above and include the css code in raw_css
    title_html_pane = pn.pane.HTML(
        """
    <h1>Panel Soccer Analytics Dashboard</h1>
    """,
        style={
            "color": "white",
            "width": "90%",
            "text-align": "center"
        },
    )

    # bind the 'player_select_widget' to our functions above
    bound_player_png_image_pane = pn.bind(_get_and_display_player_image,
                                          player=player_select_widget)
    plot_horizontal_bar_pane = pn.bind(_plot_horizontal_bar,
                                       player=player_select_widget)
    bound_plotly_line_plot_pane = pn.bind(_plot_line_plot,
                                          player=player_select_widget)
    bound_plotly_scatter_plot_pane = pn.bind(_plot_scatter_plot,
                                             player=player_select_widget)

    # create a new gridspec with 14 columns and 12 rows
    gspec = pn.GridSpec(ncols=14,
                        nrows=12,
                        sizing_mode="stretch_both",
                        css_classes=["gspec_container"])

    # place application elements in the grid, using pn.Spacer() for improved layout spacing and
    # control
    gspec[0, :14] = title_html_pane
    gspec[1, :14] = player_select_row

    gspec[3:6, 1:3] = bound_player_png_image_pane
    gspec[2:7, 3] = pn.Spacer()

    gspec[2:7, 4:14] = plot_horizontal_bar_pane
    gspec[7:10, 0:7] = bound_plotly_line_plot_pane
    gspec[7:10, 7:14] = bound_plotly_scatter_plot_pane
    gspec[11, 0:14] = pn.Row(pn.Spacer(), CSS_PANE)

    return gspec
Beispiel #4
0
    def build_loss_tab(self):
        # loss hists
        fig_loss_hists, ax_loss_hists = plt.subplots(1,
                                                     len(self.loss_keys),
                                                     figsize=(16 * 5, 9))
        unique_losses = self.dataset.base_data[
            ["filepath"] + self.loss_keys].drop_duplicates()
        for single_ax, key in zip(ax_loss_hists, self.loss_keys):
            single_ax.hist(unique_losses[key].values, bins=20)
            single_ax.set_title(" ".join(key.split("_")).title(), fontsize=40)
            for tick in single_ax.xaxis.get_major_ticks():
                tick.label.set_fontsize(34)
                tick.label.set_rotation(45)
            for tick in single_ax.yaxis.get_major_ticks():
                tick.label.set_fontsize(34)
        plt.tight_layout()
        plt.close()
        loss_hists_col = pn.pane.Matplotlib(fig_loss_hists, width=self.width)
        axis_cols = [
            'score', 'area_normalized', 'area', 'bbox_ratio', 'bbox_width',
            'bbox_height', 'num_annotations'
        ] + self.loss_keys + ['width', 'height']
        scatter_overview = scatter_plot_with_gui(
            self.dataset.base_data[self.dataset.base_data["is_prediction"] ==
                                   True],
            x_cols=axis_cols[1:] + [axis_cols[0]],
            y_cols=axis_cols,
            color_cols=["label", "num_annotations", "filename"])

        cat_2d_hist = categorical_2d_histogram_with_gui(
            self.dataset.base_data[self.dataset.base_data["is_prediction"] ==
                                   True],
            category_cols=["label", "num_annotations", "filename"],
            hist_cols=self.loss_keys + [
                'score', 'area_normalized', 'area', 'bbox_ratio', 'bbox_width',
                'bbox_height', 'num_annotations', 'width', 'height', 'label'
            ])

        try:
            gallery = ("Gallery",
                       RecordDastasetGallery(self.dataset,
                                             "base_data",
                                             "filepath",
                                             sort_cols=self.loss_keys,
                                             height=self.height).show())
        except FileNotFoundError:
            gallery = ("Gallery",
                       "Could not load images. Path might be wrong.")

        sub_tabs = pn.Tabs(("Histograms",
                            pn.Row(pn.Spacer(sizing_mode="stretch_width"),
                                   scatter_overview,
                                   pn.Spacer(sizing_mode="stretch_width"),
                                   cat_2d_hist,
                                   pn.Spacer(sizing_mode="stretch_width"),
                                   align="center")), gallery)

        return pn.Column(loss_hists_col, sub_tabs)
Beispiel #5
0
    def __init__(self, data, initial_params={}):
        super().__init__()
        if not isinstance(data, xr.core.dataarray.DataWithCoords):
            raise ValueError("Input should be an xarray data object, not %s" %
                             type(data))
        self.set_data(data)
        self.initial_params = initial_params
        self.control = Control(self.data)
        self.plot_button = pn.widgets.Button(name='Plot',
                                             width=200,
                                             disabled=True)
        self.index_selectors = []
        self.graph = pn.Spacer(name='Graph')
        self.taps_graph = hv.Points([])
        self.series_graph = pn.Row(pn.Spacer(name='Series Graph'))
        self.clear_series_button = pn.widgets.Button(name='Clear',
                                                     width=200,
                                                     disabled=True)
        self.output = pn.Row(self.graph, pn.Column(name='Index_selectors'))

        self._register(self.plot_button, 'plot_clicked', 'clicks')
        self.connect('plot_clicked', self.create_graph)

        self._register(self.control.coord_setter.coord_selector, 'set_coords')
        self.connect("set_coords", self.set_coords)

        self._register(self.clear_series_button, 'clear_series', 'clicks')
        self.connect('clear_series', self.clear_series)

        self.control.displayer.connect('variable_selected',
                                       self.check_is_plottable)
        self.control.displayer.connect('variable_selected',
                                       self._link_aggregation_selectors)
        self.control.fields.connect('x', self._link_aggregation_selectors)
        self.control.fields.connect('y', self._link_aggregation_selectors)

        self.panel = pn.Column(self.control.panel,
                               pn.Row(self.plot_button,
                                      self.clear_series_button),
                               self.output,
                               self.series_graph,
                               width_policy='max')

        # To auto-select in case of single variable
        if len(list(self.data.variables)) == 1:
            self.control.displayer.select.value = list(self.data.variables)

        self.control.setup_initial_values(self.initial_params)
        self.taps = []
        self.tap_stream = streams.Tap(transient=True)
        colors = [
            '#60fffc', '#6da252', '#ff60d4', '#ff9400', '#f4e322', '#229cf4',
            '#af9862', '#629baf', '#7eed5a', '#e29ec8', '#ff4300'
        ]
        self.color_pool = cycle(colors)
        self.clear_points = hv.streams.Stream.define(
            'Clear_points', clear=False)(transient=True)
Beispiel #6
0
    def __init__(self, classes, df, load_func, dim=3, size=800):
        """
        :classes: list of strings- name of each class
        :df: pandas DataFrame
        :load_func: function to load a file from a path to an array
        :dim: dimensions of display grid
        """
        self._index = None
        self._classes = classes
        self._df = df
        self._load_func = load_func

        self.dim = dim
        self._num_images = dim**2

        self._figpanel = pn.pane.Matplotlib(height_policy="fit",
                                            width_policy="fit",
                                            width=size,
                                            height=size)

        self._value_map = {'None': None, '0': 0, '1': 1, None: None}
        self._button_val_map = {
            None: "None",
            0: "0",
            "0": "0",
            1: "1",
            "1": "1"
        }
        self._selections = {c: _single_class_radiobuttons() for c in classes}
        self._exclude = pn.widgets.Checkbox(name="exclude", align="center")
        self._validation = pn.widgets.Checkbox(name="validation",
                                               align="center")

        self._back_button = pn.widgets.Button(name='\u25c0', width=50)
        self._back_button.on_click(self._back_button_callback)
        self._forward_button = pn.widgets.Button(name='\u25b6', width=50)
        self._forward_button.on_click(self._forward_button_callback)
        self.label_counts = pn.pane.Markdown("")

        self._button_panel = pn.Column(
            pn.Spacer(height=50), pn.pane.Markdown("## Image labels"),
            self._exclude, self._validation, *[
                pn.Row(self._selections[c],
                       pn.pane.Markdown(c, align="center"),
                       height=30) for c in classes
            ], pn.Row(self._back_button,
                      self._forward_button), self.label_counts)

        self._selected_image = 0
        self._figpanel.select(0)
        self.panel = pn.Row(self._figpanel, pn.Spacer(width=50),
                            self._button_panel)
        self._indices = None
Beispiel #7
0
def create_fast_test_app(component, parameters: List) -> pn.Column:
    parameters = [
        # Old
        "name",
        "height",
        "width",
        "sizing_mode",
        *parameters,
    ]
    parameters = list(set(parameters))
    app = pn.Column(
        pn.Spacer(height=5),
        pn.Row(
            pn.pane.SVG(
                "https://explore.fast.design/e1e15bd85334e4346744078af2f52308.svg",
                height=120,
                link_url="https://fast.design",
            ),
            pn.Spacer(width=10),
            pn.pane.PNG(
                "https://panel.holoviz.org/_static/logo_horizontal.png",
                height=120,
                link_url="https://panel.holoviz.org",
            ),
        ),
        pn.Spacer(height=5),
        pn.pane.HTML("<fast-divider></fast-divider>",
                     sizing_mode="stretch_width",
                     height=25),
        pn.Column(
            pn.pane.HTML(
                f"<fast-badge>{type(component).__name__}</fast-badge>"),
            component,
            pn.Spacer(height=10),
            pn.pane.HTML("<fast-divider></fast-divider>",
                         sizing_mode="stretch_width",
                         height=25),
            pn.pane.HTML("<fast-badge>Parameters</fast-badge>"),
            pn.Param(
                component,
                parameters=parameters,
                show_name=False,
            ),
            pn.Spacer(),
            sizing_mode="stretch_height",
            width=300,
        ),
    )

    return FastTemplate(main=[app])
Beispiel #8
0
def make_color_row(color):
    if embed_toggle.value and len(multi_select.options) > 0:
        value_str = f'<center>{color}</center>'
    else:
        value_str = ''

    if highlight_toggle.value:
        background = WHITE_SMOKE
    else:
        background = None

    swath = pn.Row(pn.pane.HTML(value_str,
                                background=background,
                                height=18,
                                sizing_mode=STR_WIDTH),
                   background=color,
                   margin=0,
                   sizing_mode=STR_WIDTH)

    if divider_toggle.value:
        divider = pn.Spacer(width=1,
                            margin=0,
                            background=WHITE_SMOKE,
                            sizing_mode=STR_HEIGHT)
        return pn.Row(swath, divider, margin=0)
    else:
        return swath
Beispiel #9
0
    def __init__(self, data):
        super().__init__()
        self.data = data
        self.x = pn.widgets.Select(name='x', width=200)
        self.y = pn.widgets.Select(name='y', width=200)
        self.agg_selectors = pn.Column()
        self.agg_opts = [
            'select', 'animate', 'mean', 'max', 'min', 'median', 'std', 'count'
        ]
        self.series_col = pn.Column()
        self.are_var_coords = False

        self._register(self.x, 'x')
        self._register(self.y, 'y')

        self.connect('x', self.change_y)
        self.connect('y', self.change_dim_selectors)

        self.panel = pn.Column(pn.Row(
            pn.Column('### Plot Dimensions',
                      self.x,
                      self.y,
                      background='rgb(175,175,175)'), pn.Spacer(),
            pn.Column('### Aggregations',
                      self.agg_selectors,
                      background='rgb(175,175,175)')),
                               self.series_col,
                               name='Axes')
Beispiel #10
0
 def clear_series(self, *args):
     if not self.clear_series_button.disabled:
         self.series_graph[0] = pn.Spacer(name='Series Graph')
         self.series = hv.Points([]).opts(height=self.kwargs['height'],
                                          width=self.kwargs['width'])
         self.taps.clear()
         self.clear_points.event(clear=True)
Beispiel #11
0
 def load_text_page(self):
     helper_text = (
         "This simple Sentiment Analysis NLP app will allow you to select a few different options " +
         "for some preprocessing steps to prepare your text for testing and training. " +
         "It will then allow you to choose a model to train, the percentage of data to " +
         "preserve for test, while the rest will be used to train the model.  Finally, " +
         "some initial metrics will be displayed to determine how well the model did to predict " +
         "the testing results." +
         " " +
         "Please choose a csv file that contains lines of text to analyze.  This text should " +
         "have a text column as well as a sentiment column.  If there is a header included in the file, " +
         "make sure to check the header checkbox."
     )
     return pn.Row(
             pn.Column(
                 pn.pane.Markdown(f'##Load Text:'),
                 pn.Column(
                     helper_text,
                      self.header_checkbox,
                      self.load_file
                     ),
             ),
             pn.Column(
                 pn.Spacer(height=52),
                 self.df_pane,
                 
             )
     
     )
Beispiel #12
0
    def __init__(self, data):
        super().__init__()
        if not isinstance(data, xr.core.dataarray.DataWithCoords):
            raise ValueError("Input should be an xarray data object, not %s" % type(data))
        self.set_data(data)
        self.control = Control(self.data)
        self.plot_button = pn.widgets.Button(name='Plot', width=200, disabled=True)
        self.index_selectors = []
        self.output = pn.Row(pn.Spacer(name='Graph'),
                             pn.Column(name='Index_selectors'))

        self._register(self.plot_button, 'plot_clicked', 'clicks')
        self.connect('plot_clicked', self.create_plot)

        self._register(self.control.coord_setter.set_coord_button, 'set_coords', 'clicks')
        self.connect("set_coords", self.set_coords)

        self.control.displayer.connect('variable_selected', self.check_is_plottable)

        self.panel = pn.Column(self.control.panel,
                               self.plot_button,
                               self.output)

        # To auto-select in case of single variable
        if len(list(self.data.variables)) == 1:
            self.control.displayer.select.value = list(self.data.variables)
Beispiel #13
0
 def build_tool_pane(self, logo=None):
     if logo:
         logo_box = pn.panel(logo, width=300)
     else:
         logo_box = pn.Spacer()
     # self.tool_pane = pn.Column(pn.Tabs(*self.tabs, *self.bc_ui.tabs), logo_box)
     self.tool_pane = pn.Column(pn.Tabs(*self.tabs), logo_box)
Beispiel #14
0
    def panel(self):
        map_panel = pn.Column(
            self.view_map,
            pn.panel(self.param, parameters=['create'], show_name=False))
        # display_tab = pn.Column(
        #                         pn.panel(self.adh_mod.wmts.param, parameters=['source'], expand_button=False),
        #                         pn.pane.Markdown('Visibility', style={'font-family':'Arial'}),
        #                         pn.panel(self.adh_mod.param, parameters=['viewable_points'], show_name=False),
        #                         self.adh_mod.param.viewable_polys
        #                         )

        display_tab = pn.Column(
            pn.panel(self.adh_mod.wmts.param,
                     parameters=['source'],
                     expand_button=False,
                     show_name=False))

        # data_tab = pn.Tabs(('Polygons', self.adh_mod.poly_table), ('Points', self.adh_mod.point_table), name='View Data')

        import_tab = pn.Column(
            pn.panel(self.param,
                     parameters=['point_file', 'poly_file'],
                     show_name=False),
            pn.panel(self.import_projection, show_name=False),
            pn.panel(self.param, parameters=['load_data'], show_name=False))

        logo_box = pn.Spacer()

        tool_panel = pn.Column(
            pn.Tabs(('Conceptual Model', self._data_tab),
                    ('Display', display_tab)), logo_box)

        main = pn.Column(pn.Row(map_panel, tool_panel), self.status_bar.panel)

        return main
Beispiel #15
0
    def panel(self):
        """Render the current view.

        Returns
        -------
        row : Panel Row
            The panel is housed in a row which can then be rendered by the
            parent Dashboard.

        """

        self.row[0] = pn.Card(
            pn.Row(self.plot, sizing_mode="stretch_both"),
            header=pn.Row(
                pn.Spacer(width=25, sizing_mode="fixed"),
                self.close_button,
                pn.Row(self.param.X_variable, max_width=100),
                pn.Row(self.param.Y_variable, max_width=100),
                max_width=400,
                sizing_mode="fixed",
            ),
            collapsible=False,
            sizing_mode="stretch_both",
        )

        return self.row
Beispiel #16
0
    def time_series_table(self):
        """update the selected time series based on the dropdown menus"""
        if self.bound_cond.time_series:
            # set the current selected material
            self.selected_time_series = self.bound_cond.time_series[
                self.time_series_select]
            # convert dataframe to a bokeh table
            table = dataframe_to_bokeh_table(
                self.selected_time_series.time_series)

            # from holoviews.plotting.links import DataLink
            # table_link = DataLink(source=self.selected_time_series.time_series, target=table)

            # create base parameter list for time series objects
            parameter_list = ['series_type', 'units', 'output_units']

            # add xy locations for wind and wave series
            if self.selected_time_series.series_type == 'SERIES WIND' or \
                    self.selected_time_series.series_type == 'SERIES WAVE':
                parameter_list.append('x_location')
                parameter_list.append('y_location')

            # construct the time options panel
            time_options = pn.panel(self.selected_time_series.param,
                                    parameters=parameter_list)
            return pn.Row(table, time_options)

        else:
            return pn.Spacer(width=0)
Beispiel #17
0
 def render(self):
     return pn.Column(
         pn.pane.Markdown(
             '### Start annotating by double clicking into the plot. This will mark the start of a range. Double click again to mark the end of the range.',
             style={
                 'font-family': "serif",
                 'color': "#ff0000"
             }),
         pn.Row(
             pn.pane.Markdown('### Classification for next annotation:',
                              style={'font-family': "serif"}),
             pn.Param(
                 self.param.next_classification,
                 widgets={
                     "next_classification":
                     pn.widgets.RadioButtonGroup(
                         options=CLASSIFICATIONS,
                     )  #style={'font-size':'10pt'},css_classes=["widget-button"])
                 }),
             pn.Spacer(background='white', width=100, height=10),
             #self.param.remove_last_annotation,
             self.param.save_annotations,
         ),
         *(self.plot()),
         pn.pane.Markdown(
             f"### List of annotations for mission {self.mission_id}",
             style={'font-family': "serif"}),
         self.plot_annotation_details,
     )
def view() -> pn.Column:
    """Wraps all tests in a Column that can be included in the Gallery or served independently

    Returns:
        pn.Column -- A Column containing all the tests
    """
    pn.config.sizing_mode = "stretch_width"
    main = [
        APPLICATION.intro_section(),
        pn.pane.Alert(
            """**You can also use the Social Sharing Buttons** in your site via the
[`awesome_panel_extensions`](https://pypi.org/project/awesome-panel-extensions/) package.

Please click and share if you like awesome-panel.org or the `awesome-panel-extensions`. Thanks.""",
            margin=0,
        ),
        pn.Row(
            pn.Spacer(),
            ShareOnTwitter(url="https://awesome-panel.org", size=6),
            ShareOnLinkedIn(url="https://awesome-panel.org", size=6),
            ShareOnReddit(url="https://awesome-panel.org", size=6),
            ShareOnFacebook(url="https://awesome-panel.org", size=6),
            ShareOnMail(url="https://awesome-panel.org", size=6),
        ),
    ]
    return pn.template.FastListTemplate(title="Share Links", main=main)
Beispiel #19
0
    def __init__(self, data):
        super().__init__()
        self.data = data

        dim_header = pn.pane.Markdown('### Plot Dimensions',
                                      margin=(0, 20, 0, 20))
        self.x = pn.widgets.Select(name='x', width=240, margin=(0, 20, 5, 20))
        self.y = pn.widgets.Select(name='y', width=240, margin=(0, 20, 20, 20))

        agg_header = pn.pane.Markdown('### Aggregations',
                                      margin=(0, 20, 0, 20))
        self.agg_selectors = pn.Column()
        self.agg_opts = [
            'select', 'animate', 'mean', 'max', 'min', 'median', 'std', 'count'
        ]
        self.series_col = pn.Column()
        self.are_var_coords = False

        self._register(self.x, 'x')
        self._register(self.y, 'y')

        self.connect('x', self.change_y)
        self.connect('y', self.change_dim_selectors)

        self.panel = pn.Column(pn.Row(
            pn.WidgetBox(dim_header,
                         self.x,
                         self.y,
                         background=(240, 240, 240)), pn.Spacer(),
            pn.WidgetBox(agg_header,
                         self.agg_selectors,
                         background=(240, 240, 240))),
                               self.series_col,
                               name='Axes')
Beispiel #20
0
def make_header_html(header_html_path=None):
    logo = "https://www.kyushu-u.ac.jp/img/common_en/logo.png"
    title = '<p style="font-size:30px">Passive Seismic Monitoring System</p>'
    #     creator = 'Created by: Fernando Lawrens Hutapea, Takeshi Tsuji, and Tatsunori Ikeda <br>'
    info = "(Ambient noise data is provided by National Research Institute for Earth Science and Disaster Prevention (NIED) Japan)"
    creator = 'Presently the monitoring result is updated weekly (Saturday) <br> Please use Firefox or Google Chrome or Microsoft Edge <br>'
    current = np.datetime64(datetime.datetime.now(), "s").astype(str)
    last_update = "Last update: {} <br>".format(current)  # today's date
    header = pn.Row(
        logo, pn.Spacer(width=30),
        pn.Column(pn.Spacer(height=0), pn.Pane(title, height=16, width=900),
                  pn.Spacer(height=18), pn.Pane(info, height=20, width=900),
                  pn.Spacer(height=8), pn.Pane(creator, height=20, width=900),
                  last_update))
    print("Finish Create Header {}".format(current))
    return (header)
def panel_wrapper():
    """
    Wrapper for generating a complete panel layout
    """
    panel_width = 450
    spacer_one_width = 5
    spacer_two_width = 5

    # Instantiate panels class
    gm = HeatmapPlot()

    # Widgets
    primary_type = pn.widgets.Select(
        name="Select a category of Crime", options=gm.primary_types
    )
    widgets_dict = {"primary_type": primary_type}

    # Panel 1
    dash_title = "<h1>VISUALIZING CHICAGO CRIME</h1>"  # type: str
    desc = pn.pane.HTML(
        """
        View distribution of crime across the city of Chicago, IL (left) and
        across the winter months (right). Geographic zones show the police
        district,  subdivided by the beat, which is the smallest possible
        geographical area as divided by the local police.
        """,
        width=panel_width,
        style={
            "background-color": "#F6F6F6",  # text background color
            "border": "2px solid black",  # border thickness
            "border-radius": "5px",  # >0px produces curved corners
            "padding": "5px",  # text-to-border whitespace
        },
    )
    panel_one = pn.Column(
        pn.Row(
            pn.Column(
                dash_title, desc, pn.panel(gm.param, widgets=widgets_dict)
            ),
            pn.Spacer(width=spacer_one_width),
            pn.Column(pn.Row(gm.altair_choro_view)),
            pn.Spacer(width=spacer_two_width),
            pn.Column(pn.Row(gm.altair_heatmap_view)),
        )
    )
    return panel_one
Beispiel #22
0
 def __init__(self, **params):
     super().__init__(**params)
     self.advanced_pn = None
     self.system_pn = pn.Column(
         pn.panel(self, parameters=['system'], show_name=False),
         pn.Spacer(),
         name='HPC System',
     )
Beispiel #23
0
 def file_browser_panel(self):
     viewer = self.file_viewer.panel if self.file_viewer else pn.Spacer()
     self.file_viewer.file_path = str(self.selected_job.working_dir)
     return pn.Column(
         viewer,
         name='Files',
         width_policy='max',
     )
def main():
    # For this demo, we generate synthetic data:
    d = utils.generate_synth_actual_and_predicted(N=200,
                                                  mu=50,
                                                  sigma=15,
                                                  err_mu=0.5,
                                                  err_sigma=1,
                                                  err_scaling_factor=0.2)
    df_error = utils.make_error_df(actual=d['actual'],
                                   predicted=d['predicted'])
    #input dataframe to the dashboard:
    df_dashboard = df_error.copy()

    dash = BasicDashboardComponents(df_dashboard)

    # putting together all dashboard components
    # 1. wrapping dashboard components in Panel Layout objects (pn.Row or pn.Column):
    widgets_panel = pn.Column(dash.param['X'],
                              dash.param['Y'],
                              dash.param['cutoff_by_column'],
                              dash.param['cutoff_value'],
                              width=200)

    scatter_panel = pn.Column(pn.Spacer(height=50), dash.scatter_view)
    boxplot_panel = pn.Column(dash.wrap_param_var_to_inspect,
                              dash.error_boxplot_view)

    plots_panel = pn.Row(scatter_panel, boxplot_panel, width=1000,
                         height=400)  #width_policy='max',

    tables_panel = pn.Column(
        pn.pane.Markdown('## Model Performance Metrics',
                         style={'font-family':
                                "serif"}), dash.metrics_table_view,
        pn.pane.Markdown('## Descriptive Stats Table',
                         style={'font-family': "serif"}),
        dash.error_summary_stats_table)
    # 2. assembling all layout components into one:
    dashboard = pn.Column(
        pn.pane.Markdown('# Error Analysis Dashboard',
                         style={'font-family': "serif"}),
        pn.Row(widgets_panel, pn.Spacer(width=20), plots_panel),
        pn.Spacer(height=50), tables_panel)

    dashboard.show()
Beispiel #25
0
 def clear_series(self, *args):
     """
     Clears the markers on the image, and the extracted series.
     """
     if not self.clear_series_button.disabled:
         self.series_graph[0] = pn.Spacer(name='Series Graph')
         self.series = hv.Points([]).opts(height=self.kwargs['height'],
                                          width=self.kwargs['width'])
         self.taps.clear()
         self.clear_points.event(clear=True)
Beispiel #26
0
    def panel(self):
        "view the app"

        return pn.Column(
            pn.Row(
                pn.Spacer(width=30),
                pn.Column(self.view_left_plot, ),
                pn.Column(self.view_right_plot, ),
            ),
            self.date_slider,
        )
    def __init__(self, component=None, **params):
        self._rename["component"] = None

        if "sizing_mode" not in params:
            params["sizing_mode"] = "stretch_both"

        super().__init__(**params)
        self.component = component

        self._spacer = pn.Spacer()
        self._vspacer = pn.layout.HSpacer(height=20)
        self._update()
Beispiel #28
0
 def _transport_properties(self):
     """update the selected constituent based on the dropdown menus"""
     if self.bound_cond.operation_parameters.transport > 0:
         # set the current selected transport
         self.selected_constituent = self.bound_cond.material_properties[
             self.material_select].transport_properties[
                 self.transport_select]
         return pn.panel(self.selected_material.transport_properties[
             self.transport_select],
                         show_name=False)
     else:
         return pn.Spacer(width=0)
Beispiel #29
0
 def display_info_for_file(self, *events):
     self.update_table()
     for event in events:
         filename = event.obj.name.split('|')
         mkdn = pn.pane.Markdown(f'''
         ###{filename[0]}  
         ``{filename[1]} to`` **{self.FILE_TO_READ_TITLE}**  
         <{self.extract_json_info('title', self.FILE_TO_READ_TITLE, 'link')[0]['url']}>  
         ''')
         self.result_display.append(pn.Spacer())
         self.result_display.append(mkdn)
         display(self.result_display)
    def panel(self):

        return pn.Row(
            pn.Column(
                pn.pane.Markdown(f'##{self.param.name_of_page.default}'),
                self.options_page,
            ),
            pn.Column(
                pn.Spacer(height=52),
                self.df_pane,
                self.continue_button_pane,
            ))