-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
103 lines (83 loc) · 2.3 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""
Copyright (C) 2023 - PRESENT Zhengyu Peng
E-mail: zpeng.me@gmail.com
Website: https://zpeng.me
` `
-:. -#:
-//:. -###:
-////:. -#####:
-/:.://:. -###++##:
.. `://:- -###+. :##:
`:/+####+. :##:
.::::::::/+###. :##:
.////-----+##: `:###:
`-//:. :##: `:###/.
`-//:. :##:`:###/.
`-//:+######/.
`-/+####/.
`+##+.
:##:
:##:
:##:
:##:
:##:
.+:
"""
import dash
from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import numpy as np
import plotly.io as pio
from dash.exceptions import PreventUpdate
from layout.layout import get_app_layout
app = dash.Dash(
__name__,
meta_tags=[{"name": "viewport",
"content": "width=device-width,initial-scale=1"}],
)
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True
app.title = "Radar Dashboard"
app.layout = get_app_layout
server = app.server
@app.callback(
output=dict(
fig=Output("chirps", "figure"),
),
inputs=dict(
fstart=Input("fstart", "value"),
fend=Input("fend", "value"),
tc=Input("tc", "value"),
prp=Input("prp", "value"),
),
)
def plot_chirp(fstart, fend, tc, prp):
if fstart is None:
raise PreventUpdate
if fend is None:
raise PreventUpdate
if tc is None:
raise PreventUpdate
if prp is None:
raise PreventUpdate
freq = np.array([fstart, fend])
t1 = np.array([0, tc])
t2 = t1+prp
new_fig = [{"mode": "lines", "type": "scatter", "x": t1,
"y": freq, "name": 'chirp 0'},
{"mode": "lines", "type": "scatter", "x": t2,
"y": freq, "name": 'chirp 1'}]
fig_layout = dict(
template=pio.templates['seaborn'],
height=300,
margin=dict(l=20, r=5, t=30, b=20),
xaxis=dict(title="Time (us)"),
yaxis=dict(title="Frequency (GHz)"),
)
return dict(
fig={
"data": new_fig,
"layout": fig_layout,
})
if __name__ == "__main__":
app.run_server(debug=True, threaded=True, processes=1, host="0.0.0.0")