This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/omnisci/F1-demo/blob/726c56ba4e8c878abeef81b7cf680bd4d36a4bd2/f1dash/track.py#L56-L60 | |
#dcc.Interval creates an object with no display characteristics, triggering a callback every 'interval' seconds | |
#for anything listening for the id 'track-interval' | |
trackgraph = html.Div([ | |
dcc.Graph(id='track-graph', | |
config={ | |
'displayModeBar': True | |
} | |
), | |
#controls when track and telemetry updates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from matplotlib import pyplot as plt | |
import matplotlib as mpl | |
import seaborn as sns | |
%matplotlib inline | |
#Read in data & create total column | |
stacked_bar_data = pd.read_csv("C:\stacked_bar.csv") | |
stacked_bar_data["total"] = stacked_bar_data.Series1 + stacked_bar_data.Series2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CAST(hist.x as int) as bin_center, | |
CAST(hist.y as bigint) as bin_height | |
FROM (select | |
histogram_numeric(salary, 20) as salary_hist | |
from | |
sample_08) a | |
LATERAL VIEW explode(salary_hist) exploded_table as hist; | |
--Results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python/pypy | |
import math | |
def smallestdivisall(n): | |
for i in xrange(1, math.factorial(n)+1): | |
for j in xrange(1, n+1): | |
if i % j != 0: | |
break | |
elif j == n: | |
return i | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/omnisci/F1-demo/blob/726c56ba4e8c878abeef81b7cf680bd4d36a4bd2/f1dash/app.py#L36-L55 | |
# helps load css at the footer, to avoid having default react css overwrite | |
app.index_string = ''' | |
<!DOCTYPE html> | |
<html> | |
<head> | |
{%metas%} | |
<title>{%title%}</title> | |
{%favicon%} | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### THIS IS A SUMMARY, THIS FILE WILL NOT RUN AS-IS #### | |
#### INPUTS to build_telemetry_chart #### | |
#https://github.com/omnisci/F1-demo/blob/726c56ba4e8c878abeef81b7cf680bd4d36a4bd2/f1dash/controls.py#L9-L32 | |
#### reference lap: build list dynamically with callback | |
reflapmenu = dcc.Dropdown( | |
id='reflapmenu', | |
searchable=False, | |
clearable=False, | |
style=dict(minWidth = '250px', paddingRight = '15px', borderRadius = 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_telemetry_data(sessionuid, lapstarttime, lapendtime, playercarindex, metric): | |
conn = pymapd.connect(host = host, user = user, password = password, dbname = dbname, port = port) | |
## get telemetry data | |
## by specifying the timestamps and sessionuid, it implies a single track | |
tele = f"""select | |
packettime, | |
max({metric}) as {metric} | |
from gtc_cartelemetry_v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = dash.Dash(__name__, external_stylesheets = [dbc.themes.DARKLY]) | |
app.title = "OmniSci Grand Prix | Converge 2019" | |
app.config['suppress_callback_exceptions'] = True | |
server = app.server | |
body = dbc.Container([ | |
dbc.Row([track, leaderboard]), | |
dbc.Row([telemetry, menubox]) | |
], | |
className="mt-4", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#From the post: https://randyzwitch.com/benchmarktools-julia-benchmarking/ | |
using Random, OmniSci, BenchmarkTools, Base.Threads | |
#change defaults, since examples long-running | |
BenchmarkTools.DEFAULT_PARAMETERS.seconds = 200 | |
BenchmarkTools.DEFAULT_PARAMETERS.samples = 5 | |
#generate test data | |
gendata(x, T) = [rand(typemin(T):typemax(T)) for y in 1:x] | |
int64_10x6 = gendata(10^6, Int64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into baywheels_tripdata | |
select | |
duration_sec, | |
start_time, | |
end_time, | |
start_station_id, | |
start_station_name, | |
start_station_latitude, | |
start_station_longitude, | |
end_station_id, |
NewerOlder