def led_displays(cur_input, cur_tab): return html.Div( [ daq.LEDDisplay( id="frequency-display", size=10, value=cur_input[cur_tab]["frequency_input"], label="Frequency (Hz)", labelPosition="bottom", color=theme["primary"], className="four columns", ), daq.LEDDisplay( id="amplitude-display", size=10, value=cur_input[cur_tab]["amplitude_input"], label="Amplitude (mV)", labelPosition="bottom", color=theme["primary"], className="four columns", ), daq.LEDDisplay( id="offset-display", size=10, value=cur_input[cur_tab]["amplitude_input"], label="Offset (mV)", labelPosition="bottom", color=theme["primary"], className="four columns", ), ], className="led-displays", )
def model_perf(value): datasets = json.loads(value) df = pd.read_json(datasets['df_model_performance'], orient='split') df['Value'] = round(df['Value'], 3) return html.Div([ html.H1('Model Performance'), dbc.Row([ dbc.Col(daq.LEDDisplay( label='AUC', color="#FF5E5E", value=str(df['Value'][0])), md=2), dbc.Col(daq.LEDDisplay( label='GINI', color="#FF5E5E", value=str(df['Value'][1])), md=2), dbc.Col(daq.LEDDisplay(label='Kolmogorov-Smirnov', color="#FF5E5E", value=str(df['Value'][2])), md=2), dbc.Col(daq.Gauge(color={ "gradient": True, "ranges": { "red": [0, 40], "yellow": [40, 70], "green": [70, 100] } }, value=df['Value'][0] * 100, label='Overall Model Quality', max=100, min=0), md=4), ], align="center"), ]),
def build_quick_stats_panel(): return html.Div( id="quick-stats", className="row", children=[ html.Div( id="card-1", children=[ html.P("Total Games Sampled"), daq.LEDDisplay( id="operator-led", value=game_count, color="#92e0d3", backgroundColor="#1e2130", size=50, ), ], ), html.Div( id="card-2", children=[ html.P("Patch Version"), daq.LEDDisplay( id="operator-led", value=game_version[0][:4], color="#92e0d3", backgroundColor="#1e2130", size=50, ), ], ), ], )
def build_quick_stats_panel(): return html.Div(id="quick-stats", className="row", children=[ html.Div(id="card-1", children=[ daq.LEDDisplay(label="Movie", id="digital1", value='0', color="#92e0d3", backgroundColor="#1e2130", size=50) ]), html.Div(id="card-2", children=[ daq.LEDDisplay(label="Audio", id="digital2", value='0', color="#92e0d3", backgroundColor="#1e2130", size=50) ]), html.Div(id="card-3", children=[ daq.LEDDisplay( label="Time of the file (min)", id="digital", value="00:00", color="#92e0d3", backgroundColor="#1e2130", size=50) ]), ])
def led_displays(cur_input, cur_tab): return html.Div([ daq.LEDDisplay(id='frequency-display', size=10, value=cur_input[cur_tab]['frequency_input'], label="Frequency (Hz)", labelPosition="bottom", color=theme['primary'], style={'marginBottom': '30px'}, className='four columns'), daq.LEDDisplay(id='amplitude-display', size=10, value=cur_input[cur_tab]['amplitude_input'], label="Amplitude (mV)", labelPosition="bottom", color=theme['primary'], className='four columns'), daq.LEDDisplay(id='offset-display', size=10, value=cur_input[cur_tab]['amplitude_input'], label="Offset (mV)", labelPosition="bottom", color=theme['primary'], className='four columns'), ], style={ 'marginLeft': '20%', 'textAlign': 'center' })
def wheel_led_card(): return html.Div( id='wheel-led-card', children=[ daq.LEDDisplay( id="size-display", color='#4A9DFF', size=25, value=0.66, className="threep columns", ), daq.LEDDisplay( id="hole-display", color='#FF4A4C', size=25, value=0.66, className="threep columns", ), daq.LEDDisplay( id="angle-display", color='#C068FA', size=25, value=0.0, className="threep columns", ), ], className='led-displays', )
def countDiv(data): return html.Div( id='countDiv', className='countDiv', children=[ html.Div( id='countList', className='countList', children=[ html.Div( id='innerCountDiv', className='innerCountDiv', children=[ html.Div( id='firstTextCountDiv', className='firstTextCountDiv', children=['Number of Leaves with Bacterial Spots'] ), daq.LEDDisplay( id="countDisplay", className='countDisplay', value=data[['isInfectedFlag']].sum(), color='#FFFFFF', backgroundColor="#0069A9", size=50, label={ "label": "Number", "style":{ "font-size":"16px", "color": "#373936", "font-weight": "bold" } }, ), daq.LEDDisplay( id="countDisplayPercentage", className='countDisplayPercentage', value=round(data[['isInfectedFlag']].sum() / len(data), 2), color='#FFFFFF', backgroundColor="#0069A9", size=50, label={ "label": "Probability", "style":{ "font-size":"16px", "color": "#373936", "font-weight": "bold" } } ) ] ) ] ) ] )
def generate_section_future(): return html.Div( id="future-stats", className="row", children=[ html.Div( id="future_card-1", children=[ html.P("Активность"), daq.LEDDisplay( id="future_activity-led", value=pred_activity, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.P("Атактика 1"), daq.LEDDisplay( id="future_atactic-led", value=pred_atac1, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.P("Атактика 2"), daq.LEDDisplay( id="future_atactic-led", value=pred_atac2, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.P("Атактика 3"), daq.LEDDisplay( id="future_atactic-led", value=pred_atac3, color="#92e0d3", backgroundColor="#1e2130", size=50, ), ], ), html.Div( id="future_utility-card", children=[ daq.StopButton(id="stop-button", size=160, n_clicks=0) ], ), ], )
def update_leds(current_temp, n): ct = current_temp print(ct) print(n) return daq.LEDDisplay(label='Current Temp', value='{:,.2f}'.format(ct), color='red'),
def update_max_left_timer(on_time): ont = on_time # print(ont) t = datetime.now() # print(t.minute) sec_left = 86400 - ((t.hour * 3600) + (t.minute * 60) + t.second) # print(sec_left) poss_sec_left = sec_left + ont # print(poss_sec_left) max_minutes = poss_sec_left // 60 max_seconds = poss_sec_left % 60 max_hours = max_minutes // 60 max_minutes = max_minutes % 60 # poss_sec_left = sec_left + ot # print(poss_sec_left) # max_minutes = sec_left // 60 # max_seconds = sec_left % 60 # max_hours = max_minutes // 60 # max_minutes = max_minutes % 60 return daq.LEDDisplay(label='Max Time', value='{:02d}:{:02d}:{:02d}'.format( max_hours, max_minutes, max_seconds), color='black')
def get_layout(UPDATE_INT, config=None): app_layout = html.Div([ html.Div([ dcc.Interval(id='interval_component', interval=UPDATE_INT * 1000, n_intervals=0), dcc.Interval( id='psutil_component', interval=2 * 1000, n_intervals=0) ], style=dict(textAlign='center')), html.Div([ daq.Gauge(id='virtual_memory', min=0, value=0, size=150, className="leftbox", style=dict(textAlign="center")), daq.Gauge(id='swap_memory', min=0, value=0, size=150, className="rightbox", style=dict(textAlign="center")), ]), daq.LEDDisplay(id='train-id', value=1000, color="#FF5E5E", style=dict(textAlign="center")), html.Br(), html.Div(children=[ dcc.Tabs( parent_className='custom-tabs', className='custom-tabs-container', id='view-tabs', value='plot', children=[ dcc.Tab(className="custom-tab", selected_className='custom-tab--selected', label='Stream/Load data', value='stream-data', children=get_stream_tab(config)), # dcc.Tab( # className="custom-tab", # selected_className='custom-tab--selected', # label='Experimental parameters', # value='exp-param', # children=get_exp_tab() # ), dcc.Tab(className="custom-tab", selected_className='custom-tab--selected', label='Plots', value='plot', children=get_plot_tab(config)) ]) ]) ]) return app_layout
def build_quick_stats_panel(): return html.Div( id="quick-stats", className="row", children=[ html.Div( id="card-1", children=[ html.P("Elevator ID"), daq.LEDDisplay( id="elevator-id", value="001", color="#92e0d3", backgroundColor="#1e2130", size=50, ), ], ), html.Div( id="power_button", children=[ daq.StopButton(id="stop-button", size=160, n_clicks=0, buttonText="START") ], ), ], )
def build_quick_stats_panel(): return html.Div( id="quick-stats", # id="card-1", className="four columns", children=[ generate_section_banner("Текущие показатели"), html.P("Aктивность"), daq.LEDDisplay( id="operator-led", value=current_activity, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.P("Атактика 1"), daq.LEDDisplay( id="atactica-led", value=current_atac1, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.P("Атактика 2"), daq.LEDDisplay( id="atactica-led", value=current_atac2, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.P("Атактика 3"), daq.LEDDisplay( id="atactica-led", value=current_atac3, color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.Div( id="utility-card", children=[ daq.StopButton(id="stop-button", size=160, n_clicks=0) ], ), ], )
def build_quick_stats_panel(): return html.Div( id="quick-stats", className="row", children=[ html.Div( id="card-1", children=[ html.P("Driver ID"), daq.LEDDisplay( id="operator-led", value="1704", color="#92e0d3", backgroundColor="#1e2130", size=50, ), html.H6("Mr. John Hancock"), ], ), html.Div( id="card-2", children=[ html.P("Time to complete Trip"), daq.LEDDisplay( id="time-id", value="5:10:45", #color="#FF5E5E", backgroundColor="#FF5E5E" ), html.H6("TN to WA"), ], ), html.Div( id="card-2", children=[ html.P("Next Location ZIP Code"), daq.LEDDisplay( id="location-id", value="98004", color="#FF5E5E", #backgroundColor="#FF5E5E" ), html.H6("Bellevue"), ], ), ], )
def outside_temp(n): res = requests.get(url) data = res.json() f = ((9.0 / 5.0) * data) + 32 return daq.LEDDisplay(label='Outside T', value='{:,.2f}'.format(f), color='red'),
def led_display(value, label): # returns a component with a Led Display return html.Div([ daq.LEDDisplay( value=value, color="#1F77B4", label=label, backgroundColor="#F8F9FA" ), ], style=LED_DISPLAY_STYLE)
def get_page_view(): return html.Div([ html.Div(id='dummy-page-div'), daq.LEDDisplay(id='access_count', value=666), html.Div('Total Page Views', style={'font-weight': 'bold'}) ], style={ 'text-align': 'center', 'margin': '10px' })
def update_output(value): return html.Div( daq.LEDDisplay( id="operator-led", label='Time(s)', value=value, color="#92e0d3", backgroundColor="#110e2c", size=20, ))
def pct_off_timer(run_count, off_count): rt = int(run_count) ot = int(off_count) pct_off = ot / (rt + ot) * 100 return daq.LEDDisplay(label='Pct Off', value='{:.2f}'.format(pct_off), color='blue'),
def outside_temp(n): res = requests.get(url) data = res.json() f = ((9.0 / 5.0) * data) + 32 # df = pd.read_csv('../../tempjan19.csv', names=['Time', 'Temp']) # current_temp = df['Temp'].iloc[-1] return daq.LEDDisplay(label='Outside T', value='{:,.2f}'.format(f), color='red'),
def led_display(title, value): return html.Div(children=[ html.P(title), daq.LEDDisplay( value=value, color="#92e0d3", backgroundColor="#1e2130", size=50, ), ], )
def build_quick_stats_panel(self): """Quick stats on the left of the view :return: html.Div object """ current_giesszellenbedarf = \ self.dm.giesszellenbedarf_over_time().iloc[0, :] return html.Div( id="quick-stats", className="row", children=[ html.Div( id="card-1", children=[ html.P("Operator ID"), daq.LEDDisplay( id="operator-led", value="042", color="#92e0d3", backgroundColor="#1e2130", size=20, ), ], ), html.Div( id="card-2", children=[ html.P("Durchschnittl. Formverschleiß"), daq.GraduatedBar(id="form-life-bar", value=self.dm.avg_attrition), ], ), html.Div( id="card-3", children=[ html.P( "Prozentuale Gießzellenauslastung diesen Monat"), daq.Gauge(id="attrition-gauge", min=0, max=100, showCurrentValue=True, value=100 * current_giesszellenbedarf.mean() / current_giesszellenbedarf.max()) ], ), html.Div( # todo: Implement this feature id="card-4", children=daq.BooleanSwitch(id="AI-powerbutton", on=False, label='AI', color="#92e0d3"), ), ], )
def update_time4(value): #time = resultsdf[(resultsdf['race']==value) & (resultsdf['lane']==4)]['time'] return html.Div([ daq.LEDDisplay(id='lane4-leddisplay', value=0, label='Time', labelPosition='bottom', size='40', color="#FF5E5E", backgroundColor="#000000") ])
def update_total_timer(n): t = datetime.now() hours = 24 - t.hour - 1 minutes = 60 - t.minute - 1 seconds = 60 - t.second # print(seconds) return daq.LEDDisplay(label='Time Left', value='{:02d}:{:02d}:{:02d}'.format( hours, minutes, seconds), color='orange')
def render_led_card(): return html.Div( id='render-led-card', children=[ daq.LEDDisplay( id="width-display", color='#02A90E', size=25, value=0.66, className="threet columns", ), daq.LEDDisplay( id="revs-display", color='#F7B801', size=25, value=1, className="threet columns", ), ], className='led-displays', )
def update_run_timer(off_time): ot = int(off_time) # print(ot) minutes = ot // 60 seconds = ot % 60 hours = minutes // 60 minutes = minutes % 60 return daq.LEDDisplay(label='Off Time', value='{:02d}:{:02d}:{:02d}'.format( hours, minutes, seconds), color='blue'),
def update_run_timer(n, run_count): rt = run_count # print(rt) minutes = rt // 60 seconds = rt % 60 hours = minutes // 60 minutes = minutes % 60 return daq.LEDDisplay(label='Run Time', value='{:02d}:{:02d}:{:02d}'.format( hours, minutes, seconds), color='red'),
def update_run_timer(time_off): rt = time_off # print(rt) minutes = rt // 60 seconds = rt % 60 hours = minutes // 60 minutes = minutes % 60 return daq.LEDDisplay(label='Off Time', value='{:02d}:{:02d}:{:02d}'.format( hours, minutes, seconds), color='blue'),
def project_summary(df_latest): number_of_active_projects = df_latest.shape[0] avr_donation_size = int( (df_latest.donated_amount_in_euro / df_latest.donations_count).replace( [np.inf, -np.inf], np.nan).dropna().mean()) mask = (df_latest['created_at'] > dt.now().replace( day=1, hour=1, minute=1, second=1, tzinfo=None)) number_project_current_month = df_latest[mask].shape[0] mydate = datetime.datetime.now() month_name = mydate.strftime("%B") card_deck = dbc.CardDeck([ dbc.Card([ dbc.CardHeader(html.B("Active Projects")), dbc.CardBody([ daq.LEDDisplay(value=number_of_active_projects, color="black") ], style={'textAlign': 'center'}) ], className="mt-2 mr-1"), dbc.Card([ dbc.CardHeader(html.B("Average donation size (€)")), dbc.CardBody( [daq.LEDDisplay(value=avr_donation_size, color="black")], style={'textAlign': 'center'}) ], className="mt-2 ml-1 mr-1"), dbc.Card([ dbc.CardHeader(html.B("New projects in {}".format(month_name))), dbc.CardBody([ daq.LEDDisplay(value=number_project_current_month, color="black") ], style={'textAlign': 'center'}) ], className="mt-2 ml-1") ]) return card_deck
def avg_outside_temp(n): df = pd.read_csv('../../tempjan19.csv', names=['Time', 'Temp'], index_col=['Time'], parse_dates=['Time']) daily_avg = df['Temp'].resample('D').mean() today_avg = daily_avg.iloc[-1] return daq.LEDDisplay(label='Outside Avg T', value='{:,.2f}'.format(today_avg), color='red'),