示例#1
0
def layout(symbols):
    """Return the UI layout."""
    periods = [('1 day', 0), ('1 week', 1), ('1 month', 2), ('3 months', 3),
               ('1 year', 4), ('5 years', 5)]
    return Div([
        H3('Stock prices'),
        Div([
            Div([_symbol_selector_dropdown(symbols)],
                style={
                    'width': '45%',
                    'float': 'left',
                    'display': 'inline-block'
                }),
            Div([_period_selector_radio(periods)],
                style={
                    'width': '45%',
                    'float': 'right',
                    'display': 'inline-block'
                })
        ],
            style={
                'display': 'inline-block',
                'width': '100%'
            }),
        Graph(id='plot-stock', config={'displayModeBar': False})
    ])
示例#2
0
def _generate_body(asset_name="", files=[]):
    elements = []

    elements.append(H2(" ".join(asset_name.split("-")).title()))

    df_records = groupby(get_dataframes(files), lambda x: ".".join(x["record_path"].split(".")[:-2]))

    for k, recs in df_records.items():
        # Header
        if k == "period":
            continue
        elements.append(H3(k))
        elements.append(Div(len(recs)))
        data = None
        if len(recs) == 1:
            # Data Vis: Chart or Table
            data = recs[0]["data"]
        elif len(recs) == 2:
            df_num_idx = 0 if _is_series_numeric(recs[0]["data"]["value"]) else 1
            df_str_idx = 1 - df_num_idx

            df_num = recs[df_num_idx]["data"]
            df_str = _reshape_dataframe_narrow_to_wide(recs[df_str_idx]["data"])
            join_keys = list(df_num.columns.intersection(df_str.columns))
            data = df_str.join(df_num.set_index(join_keys), on=join_keys, how="outer")

        if data is not None:
            if "value" in data.columns and _is_series_numeric(data["value"]) and "period" in data.columns:
                elements.append(_generate_chart(data, asset_name + k))
            else:
                elements.append(_generate_table(data))

    return elements
示例#3
0
def per_machine_per_device_pie_charts(GPU_STATS, KEEP_ALIVE):
    compute_machines = []
    for machine_name, machine in GPU_STATS.items():
        machine_devices = []
        devices = machine["devices"]

        for i, d in enumerate(devices):

            used = d["used"] // MB_DIVISOR
            total = d["total"] // MB_DIVISOR

            used_ratio = used / total
            used_ratio = [used_ratio] + [1.0 - used_ratio]

            hover_text = [f"used:{used:.0f}mb", f"free:{total - used:.0f}mb"]

            machine_devices.append(
                Div(
                    [
                        Graph(
                            id=f"gpu_stats_{machine_name}{i}",
                            figure={
                                "data": [
                                    graph_objs.Pie(
                                        values=used_ratio,
                                        text=hover_text,
                                        name="used ratio",
                                        hole=0.4,
                                    )
                                ],
                                "layout":
                                graph_objs.Layout(
                                    title=f"{d['name']} cuda_idx:{d['id']}",
                                    showlegend=False,
                                    hovermode="closest",
                                ),
                            },
                            style={
                                "width": "100%",
                            },
                        )
                    ],
                    className="col",
                ))
        compute_machines.append(
            Div(
                [
                    H3(
                        f"{machine_name}: {KEEP_ALIVE[machine_name]} sec ago",
                        className="text-monospace",
                        style={"text-decoration": "underline"},
                    ),
                    Div([*machine_devices], className="row"),
                ],
                style={
                    "text-align": "center",
                    "width": "100%",
                },
            ))
    return compute_machines
示例#4
0
def logs():
    return Col([
        Row(
            Col([H3('Logs'),
                 RefreshButton(btnid='kism-refresh-logs-btn')],
                **dict(className='text-center'))),
        Row(Col(Table(className='table', id='kism-logs-table')))
    ])
示例#5
0
def lerz_helicorder():
    return Col([
        Row(
            Col([
                H3('KLUD'),
                RefreshButton(btnid='lerz-refresh-helicorder-btn')
            ], **dict(className='text-center'))),
        Row(Col(Img(id='lerz-helicorder-plot', src='', width='100%')))
    ])
示例#6
0
def summit_helicorder():
    return Col([
        Row(
            Col([
                H3('RIMD'),
                RefreshButton(btnid='kism-refresh-helicorder-btn')
            ], **dict(className='text-center'))),
        Row(Col(Img(id='kism-helicorder-plot', src='', width='100%')))
    ])
示例#7
0
def get_side_menu():
    side_menu = Tabs(Tab(label='', tab_id='pctr_text'),
                     id='side-menu-tabs',
                     active_tab='pctr_text')
    side_menu_col = Col(id='side-menu-col-2',
                        style=VISIBILITY_HIDDEN,
                        width=2,
                        children=[H3('', id='side-menu-header'), side_menu])
    return side_menu_col
示例#8
0
def summit_tiltv():
    return Col([
        Row(
            Col([
                H3('Tilt Vectors'),
                RefreshButton(btnid='kism-refresh-tiltv-btn')
            ], **dict(className='text-center'))),
        Row(Col(Img(id='kism-tiltv-plot', src='', width='100%')))
    ])
示例#9
0
def ash3d():
    return Col([
        Row(
            Col([H3('Ash3d'),
                 RefreshButton(btnid='refresh-ash3d-btn')],
                **dict(className='text-center'))),
        Row(Col(Img(id='ash3d-img', src='', width='100%')))
    ],
               size=5)
示例#10
0
def lerz_hypos():
    return Col([
        Row(Col(H3('Seismicity', style=dict(textAlign='center')))),
        Row([
            Col(dcc.RadioItems(id='lerz-hypos-radio',
                               options=[{
                                   'label': 'Time',
                                   'value': 'T'
                               }, {
                                   'label': 'Depth',
                                   'value': 'A'
                               }],
                               value='A'),
                bp='md',
                size=6,
                **dict(className='text-center')),
            Col(dcc.Dropdown(id='lerz-seismic-time-dropdown',
                             options=[{
                                 'label': i.split('_')[1],
                                 'value': PERIODS[i]
                             } for i in sorted(list(PERIODS.keys()))],
                             value=28800000,
                             searchable=False,
                             clearable=False),
                bp='md',
                size=2)
        ]),
        Row([
            Col(
                Col([
                    Iframe(id='lerz-hypos-plot',
                           srcDoc='',
                           width='100%',
                           height=400),
                    Img(id='lerz-hypos-legend', src='', width='100%')
                ],
                    bp='md',
                    size=11,
                    **dict(className='offset-md-1'))),
            Col(
                Col(DataTable(
                    rows=[{}],
                    columns=('date', 'lat', 'lon', 'depth', 'prefMag'),
                    column_widths=[None, 125, 125, 75, 75],
                    filterable=True,
                    sortable=True,
                    id='lerz-datatable-hypos'),
                    bp='md',
                    size=11))
        ])
    ],
               bp='md',
               size=12)
示例#11
0
def load_app(app):
    """
    Callback loading given app into the appropriate :class:`Div` class
    instance.

    Parameters
    ----------
    app : unicode
        App path.

    Returns
    -------
    Div
        :class:`Div` class instance of the app layout.
    """

    if app == app_1.APP_PATH:
        return app_1.LAYOUT
    elif app == app_2.APP_PATH:
        return app_2.LAYOUT
    else:
        return Div([
            P([
                'Various colour science ',
                A('Dash', href='https://dash.plot.ly/', target='_blank'),
                ' apps built on top of \n',
                A('Colour',
                  href='https://github.com/colour-science/colour',
                  target='_blank'), '.'
            ]),
            H3([
                Link(app_1.APP_NAME, href=app_1.APP_PATH, className='app-link')
            ]),
            Markdown(app_1.APP_DESCRIPTION.replace('This app c', 'C')),
            H3([
                Link(app_2.APP_NAME, href=app_2.APP_PATH, className='app-link')
            ]),
            Markdown(app_2.APP_DESCRIPTION.replace('This app c', 'C')),
        ])
示例#12
0
def lerz_gas():
    return Col([
        Row(
            Col([
                H3('LERZ SO2 Emissions'),
                RefreshButton(btnid='lerz-refresh-so2-btn')
            ], **dict(className='text-center'))),
        Row(
            Col(dcc.Graph(id='lerz-so2-graph'),
                bp='md',
                size=10,
                **dict(className='offset-md-1')))
    ])
示例#13
0
文件: gk_gui.py 项目: dhill2522/GEKKO
 def __init__(self):
     super(GK_GUI, self).__init__()
     self.app = dash.Dash()
     self.serve_static()
     print(__file__)
     self.vars = {}
     self.get_data()
     self.app.layout = Div(children=[
         H1(children='GEKKO results', style={'text-align': 'center'}),
         Div(className='col-sm-3',
             children=[
                 H3("options['INFO']"),
                 Div(children=[
                     self.make_options_table(self.options['INFO'],
                                             ["Option", "Value"])
                 ]),
                 H3("options['APM']"),
                 Div(children=[
                     self.make_options_table(self.options['APM'],
                                             ["Option", "Value"])
                 ])
             ]),
         Div(className='col-sm-9', children=[self.make_tabs()])
     ])
示例#14
0
def lerz_spectrograms():
    return Col([
        Row(
            Col([
                H3('Spectrograms'),
                RefreshButton(btnid='lerz-refresh-spectrograms-btn')
            ], **dict(className='text-center'))),
        Row([
            Col(Img(id='lerz-pensive-plot', src=''),
                size=5,
                **dict(className='offset-md-1')),
            Col(Img(id='lerz-ipensive-plot', src=''), size=5),
        ])
    ],
               bp='md',
               size=12)
示例#15
0
def section_header(section, title):
    return [
        Row(Col(H3(f'{title}', style=dict(textAlign='center')))),
        Row([
            Col(dcc.Dropdown(id=f'{section}-{title.lower()}-time-dropdown',
                             options=[{
                                 'label': i.split('_')[1],
                                 'value': PERIODS[i]
                             } for i in sorted(list(PERIODS.keys()))],
                             value=28800000,
                             searchable=False,
                             clearable=False),
                bp='md',
                size=2,
                **dict(className='offset-md-4')),
            Col(RefreshButton(btnid=f'{section}-refresh-{title.lower()}-btn'),
                **dict(className='offset-md-0.5'))
        ])
    ]
示例#16
0
from random import randint

app = Dash(__name__)

N = 20

database = {
    'index': list(range(N)),
    'maiores': [randint(1, 1000) for _ in range(N)],
    'menores': [randint(1, 1000) for _ in range(N)],
    'bebes': [randint(1, 1000) for _ in range(N)],
}

app.layout = Div(children=[
    H1('Evento X'),
    H3('idade das pessoas que foram ao evento'),
    Checklist(id='meu_check_list',
              options=[{
                  'label': 'Menores de Idade',
                  'value': 'menores'
              }, {
                  'label': 'Bebes',
                  'value': 'bebes'
              }, {
                  'label': 'Maiores de idade',
                  'value': 'maiores'
              }],
              value=['bebes']),
    Dropdown(id='meu_dropdown',
             options=[
                 {
示例#17
0
# layout
app.layout = html.Div(children=[
    H1(
        children=" Hivatkozási hálózat ",
        style={
            "color": "black",
            "backgroundColor": "ffffff",
            "text-align": "center",
        },
    ),
    html.Div(
        children=[
            html.P(
                children=[
                    H3(children="Miről szól a projekt?"),
                    html.Element(dcc.Markdown(children=markdown_text), ),
                ],
                className="six columns",
            ),
            html.Div(
                html.Iframe(
                    srcDoc=open("citation_net_VL_AAA_final.html").read(),
                    style={
                        "height": "100%",
                        "width": "100%"
                    },
                ),
                style={"height": "400px"},
                className="six columns",
            ),
示例#18
0
    env.process(warehouse_run(env,cutoff,target))
    env.process(observe(env,observation_time,inventory_level_list))
    env.run(until=days)
    inventory_DF = pd.DataFrame({
                            'Time':observation_time,
                            'Inventory_Level':inventory_level_list
    })
    return inventory_DF



# UI layout - DASH app

app.layout = Div([
        
        H3('Inventory Management using Discrete Event Simulation created by Karthik Anumalasetty'),
        Div([A([Img(
                src='data:image/png;base64,{}'.format(linkedin_image.decode()),
                style={
                    'height' : '4%',
                    'width' : '4%',
                    'float' : 'right',
                    'position' : 'relative',
                    'padding-top' : 0,
                    'padding-right' : 0
                })], href="https://www.linkedin.com/in/karthikanumalasetty/", target="_blank", 
               )]),
        Div([A([Img(
                src='data:image/jpg;base64,{}'.format(github_image.decode()),
                style={
                    'height' : '8%',
示例#19
0
                   ' using the given *Chromatic Adaptation Transform*.')
"""
App description.

APP_DESCRIPTION : unicode
"""

APP_UID = hash(APP_NAME)
"""
App unique id.

APP_UID : unicode
"""

LAYOUT = Div([
    H3([Link(APP_NAME, href=APP_PATH)], className='text-center'),
    Div([
        Markdown(APP_DESCRIPTION),
        H5(children='Colourspace'),
        Dropdown(id='colourspace-{0}'.format(APP_UID),
                 options=RGB_COLOURSPACES_OPTIONS,
                 value=RGB_COLOURSPACES_OPTIONS[0]['value'],
                 clearable=False,
                 className='app-widget'),
        H5(children='Illuminant'),
        Dropdown(id='illuminant-{0}'.format(APP_UID),
                 options=ILLUMINANTS_OPTIONS,
                 value=ILLUMINANTS_OPTIONS[0]['value'],
                 clearable=False,
                 className='app-widget'),
        H5(children='Chromatic Adaptation Transform'),
示例#20
0
#layout
app.layout = html.Div(children=[
    H1(
        children=f"{match_title} pass network",
        style={
            "color": "black",
            "backgroundColor": "ffffff",
            "text-align": "center",
        },
    ),
    html.Div(
        children=[
            html.Div(
                children=[
                    H3(children="mi ez a cucc?"),
                    html.Element(
                        children="babababababababababbabaaabababababababababab",
                    ),
                ],
                className="six columns",
            ),
            html.Div(
                html.Iframe(
                    srcDoc=open("pass_network_team1.html").read(),
                    style={
                        "height": "100%",
                        "width": "100%"
                    },
                ),
                style={"height": "400px"},
示例#21
0
# layout
app.layout = html.Div(
    children=[
        H1(
            children=f"{match_title} pass network",
            style={
                "color": "black",
                "backgroundColor": "ffffff",
                "text-align": "center",
            },
        ),
        html.Div(
            children=[
                html.P(
                    children=[
                        H3(children="What is this all about?"),
                        html.Element(dcc.Markdown(children=markdown_text),),
                    ],
                    className="six columns",
                ),
                html.Div(
                    html.Iframe(
                        srcDoc=open("pass_network_team1.html").read(),
                        style={"height": "100%", "width": "100%"},
                    ),
                    style={"height": "400px"},
                    className="six columns",
                ),
            ],
            className="row",
        ),
示例#22
0
df_download = create_df_download(df_base)

minmax = get_minmax_from_df(df_download)


layout = Div([
    # a storage to save the signal to update the tables and graphs
    Store(id='download--store--signal'),

    # title and subtitle
    Div([
        # title
        H1(children='catalog-dash'),
        # subtitle
        H3(children='Download table analysis')
    ], style={'textAlign': 'center', 'color': colors['text']}),

    # top tables - information table, date picker range and limit
    Div([
        # left table - information table
        Div([
            # title
            P(
                children='Table: Information',
                style={'color': colors['text']}
            ),
            # table information
            DataTable(
                id='download--table--information',
                columns=[{'name': i, 'id': i} for i in df_information.columns],
示例#23
0
from dash_core_components import Link
from dash_html_components import Br, Div, H1, H3

from app import url_base_pathname
from modules.utils import colors


layout = Div([
    # title
    H1(
        children='publisher-dash',
        style={
            'textAlign': 'center',
            'color': colors['text']
        }
    ),
    # subtitle
    H3(
        children='Index',
        style={
            'textAlign': 'center',
            'color': colors['text']
        }
    ),
    # Link('Scene', href=f'{url_base_pathname}/scene'),
    Br(),
    Link('Publisher', href=f'{url_base_pathname}/publisher')
])
示例#24
0
df_sd_ds_ym_long_lat = create_df_sd_ds_ym_long_lat(df_base)


minmax = get_minmax_from_df(df_sd_ds_ym_long_lat)


layout = Div([
    # a storage to save the signal to update the tables and graphs
    Store(id='scene--store--signal'),

    # title and subtitle
    Div([
        # title
        H1(children='catalog-dash'),
        # subtitle
        H3(children='Scene table analysis'),
    ], style={'textAlign': 'center', 'color': colors['text']}),

    # number of scenes and information tables
    Div([
        # left div - number of scenes table
        Div([
            # title
            P(
                children='Table: Number of Scenes by Dataset and Year-Month',
                style={'color': colors['text']}
            ),
            # number of scenes table
            DataTable(
                id='scene--table--number-of-scenes',
                columns=[{'name': i, 'id': i} for i in df_sd_dataset_year_month.columns],