Spaces:
Running
Running
possible method for loading banner
Browse files- .gitignore +5 -0
- Python/plot.py +103 -0
- Web_Code/CSS/css_0.css +22 -1
- _quarto.yml +1 -2
- index.html +0 -19
- index.qmd +63 -3
- tornado.html +0 -0
.gitignore
CHANGED
@@ -6,6 +6,11 @@ _extensions/
|
|
6 |
_.site/
|
7 |
|
8 |
/.luarc.json
|
|
|
|
|
|
|
|
|
|
|
9 |
# *.pdf
|
10 |
# *.svg
|
11 |
# *.npz
|
|
|
6 |
_.site/
|
7 |
|
8 |
/.luarc.json
|
9 |
+
index_files
|
10 |
+
site_libs
|
11 |
+
|
12 |
+
index*
|
13 |
+
|
14 |
# *.pdf
|
15 |
# *.svg
|
16 |
# *.npz
|
Python/plot.py
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import plotly.io as pio
|
3 |
+
|
4 |
+
# pio.renderers.default = "plotly_mimetype+notebook_connected"
|
5 |
+
|
6 |
+
import plotly.graph_objects as go # to combine figures
|
7 |
+
|
8 |
+
# load data from the numpy npz file
|
9 |
+
data = np.load('Data/6_Html_Data/0_Viz/plt_Dat_16.78.npz')
|
10 |
+
|
11 |
+
# extraxt the data - load it
|
12 |
+
x_Traj = data["x"]
|
13 |
+
y_Traj = data["y"]
|
14 |
+
z_Traj = data["z"]
|
15 |
+
x_Cone = data["x_Cone"]
|
16 |
+
y_Cone = data["y_Cone"]
|
17 |
+
z_Cone = data["z_Cone"]
|
18 |
+
u_Cone = data["u_Cone"]
|
19 |
+
v_Cone = data["v_Cone"]
|
20 |
+
w_Cone = data["w_Cone"]
|
21 |
+
|
22 |
+
# The trajectory
|
23 |
+
fig = go.Figure(data=[go.Scatter3d(
|
24 |
+
x= x_Traj,
|
25 |
+
y= y_Traj,
|
26 |
+
z= z_Traj,
|
27 |
+
name = "Trajectory",
|
28 |
+
showlegend = False,
|
29 |
+
)])
|
30 |
+
|
31 |
+
|
32 |
+
fig.update_traces(marker_size = 2,
|
33 |
+
mode = "lines",
|
34 |
+
marker_color ="green")
|
35 |
+
|
36 |
+
|
37 |
+
# Cones
|
38 |
+
fig_Cones = go.Figure(data=go.Cone( x = x_Cone ,
|
39 |
+
y = y_Cone ,
|
40 |
+
z = z_Cone ,
|
41 |
+
u = u_Cone ,
|
42 |
+
v = v_Cone ,
|
43 |
+
w = w_Cone ,
|
44 |
+
name = "Direction",
|
45 |
+
showlegend = False,
|
46 |
+
|
47 |
+
)
|
48 |
+
)
|
49 |
+
|
50 |
+
|
51 |
+
# hiding color-bar
|
52 |
+
fig_Cones.update_traces(showscale=False)
|
53 |
+
|
54 |
+
# combine cone and trajectory
|
55 |
+
fig.add_traces(data = fig_Cones.data)
|
56 |
+
|
57 |
+
|
58 |
+
# style the figure
|
59 |
+
fig.update_layout(
|
60 |
+
# plotlyexpress 3d axes:
|
61 |
+
scene = dict(
|
62 |
+
xaxis = dict(
|
63 |
+
showbackground = False,
|
64 |
+
showticklabels = False,
|
65 |
+
title='',
|
66 |
+
showgrid = False,
|
67 |
+
zeroline = False,),
|
68 |
+
yaxis = dict(
|
69 |
+
showbackground = False,
|
70 |
+
showticklabels = False,
|
71 |
+
title='',
|
72 |
+
showgrid = False,
|
73 |
+
zeroline = False,),
|
74 |
+
zaxis = dict(
|
75 |
+
showbackground = False,
|
76 |
+
showticklabels = False,
|
77 |
+
title='',
|
78 |
+
showgrid = False,
|
79 |
+
zeroline = False,
|
80 |
+
),
|
81 |
+
),
|
82 |
+
# template= 'plotly_dark'
|
83 |
+
# template= 'plotly'
|
84 |
+
paper_bgcolor='rgba(0,0,0,0)',
|
85 |
+
plot_bgcolor='rgba(0,0,0,0)',
|
86 |
+
modebar = dict(bgcolor='rgba(0, 0, 0, 0)'),
|
87 |
+
margin=dict(
|
88 |
+
l=0,
|
89 |
+
r=0,
|
90 |
+
b=0,
|
91 |
+
t=0,
|
92 |
+
pad=0
|
93 |
+
),
|
94 |
+
|
95 |
+
scene_camera_eye=dict(x=0,
|
96 |
+
y=1,
|
97 |
+
z=0),
|
98 |
+
)
|
99 |
+
|
100 |
+
fig.show(div_id ="rest")
|
101 |
+
|
102 |
+
a = fig.to_html(div_id ="test_")
|
103 |
+
print("stop")
|
Web_Code/CSS/css_0.css
CHANGED
@@ -28,4 +28,25 @@
|
|
28 |
/* plotly logo */
|
29 |
.modebar-btn--logo{
|
30 |
visibility: hidden;
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/* plotly logo */
|
29 |
.modebar-btn--logo{
|
30 |
visibility: hidden;
|
31 |
+
}
|
32 |
+
|
33 |
+
/* when the main page is opened, it might take some time to load everything - for that a loader shall be made visibe. */
|
34 |
+
.cl_Loader {
|
35 |
+
border: 16px solid #f3f3f3;
|
36 |
+
border-radius: 50%;
|
37 |
+
border-top: 16px solid #3498db;
|
38 |
+
width: 120px;
|
39 |
+
height: 120px;
|
40 |
+
animation: spin 2s linear infinite;
|
41 |
+
position: absolute;
|
42 |
+
top: 50%;
|
43 |
+
left: 50%;
|
44 |
+
margin-top: -60px;
|
45 |
+
margin-left: -60px;
|
46 |
+
}
|
47 |
+
|
48 |
+
@keyframes spin {
|
49 |
+
0% { transform: rotate(0deg); }
|
50 |
+
100% { transform: rotate(360deg); }
|
51 |
+
}
|
52 |
+
|
_quarto.yml
CHANGED
@@ -193,8 +193,6 @@ format:
|
|
193 |
highlight-style: dracula
|
194 |
|
195 |
|
196 |
-
|
197 |
-
|
198 |
pdf:
|
199 |
documentclass: scrreprt
|
200 |
|
@@ -206,3 +204,4 @@ format:
|
|
206 |
tbl-cap-location: bottom
|
207 |
|
208 |
|
|
|
|
193 |
highlight-style: dracula
|
194 |
|
195 |
|
|
|
|
|
196 |
pdf:
|
197 |
documentclass: scrreprt
|
198 |
|
|
|
204 |
tbl-cap-location: bottom
|
205 |
|
206 |
|
207 |
+
# adding javascipt code is possible - see:
|
index.html
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<meta charset="utf-8" />
|
5 |
-
<meta name="viewport" content="width=device-width" />
|
6 |
-
<title>My static Space</title>
|
7 |
-
<link rel="stylesheet" href="style.css" />
|
8 |
-
</head>
|
9 |
-
<body>
|
10 |
-
<div class="card">
|
11 |
-
<h1>Welcome to your static Space!</h1>
|
12 |
-
<p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
|
13 |
-
<p>
|
14 |
-
Also don't forget to check the
|
15 |
-
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
16 |
-
</p>
|
17 |
-
</div>
|
18 |
-
</body>
|
19 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.qmd
CHANGED
@@ -1,10 +1,17 @@
|
|
1 |
-
#
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
4 |
|
|
|
5 |
```{python}
|
6 |
# | echo: false
|
7 |
#| code-fold: true
|
|
|
|
|
8 |
import numpy as np
|
9 |
import plotly.io as pio
|
10 |
pio.renderers.default = "plotly_mimetype+notebook_connected"
|
@@ -102,5 +109,58 @@ fig.update_layout(
|
|
102 |
z=0),
|
103 |
)
|
104 |
|
105 |
-
fig.show()
|
106 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Meet The Tornado {.unnumbered}
|
2 |
|
3 |
+
<div id="loader_Initial" class="cl_Loader">
|
4 |
+
</div>
|
5 |
+
<div id="content_Load" style="display:none;">
|
6 |
+
<!-- Your webpage content goes here
|
7 |
|
8 |
|
9 |
+
<!-- Code to generate the main image, i.e. the tornada -->
|
10 |
```{python}
|
11 |
# | echo: false
|
12 |
#| code-fold: true
|
13 |
+
#| label: tornado_main
|
14 |
+
#|
|
15 |
import numpy as np
|
16 |
import plotly.io as pio
|
17 |
pio.renderers.default = "plotly_mimetype+notebook_connected"
|
|
|
109 |
z=0),
|
110 |
)
|
111 |
|
112 |
+
fig.show(div_id="here_Comes")
|
113 |
+
```
|
114 |
+
</div>
|
115 |
+
|
116 |
+
|
117 |
+
<script>
|
118 |
+
|
119 |
+
function hideLoaderAndShowContent() {
|
120 |
+
const loader = document.getElementById("loader_Initial");
|
121 |
+
const content = document.getElementById("content_Load");
|
122 |
+
|
123 |
+
loader.style.display = "none";
|
124 |
+
content.style.display = "block";
|
125 |
+
}
|
126 |
+
|
127 |
+
function checkForPlotlyPlot() {
|
128 |
+
console.log("everything is loaded")
|
129 |
+
|
130 |
+
const plotElement = document.querySelector(".plotly-graph-div");
|
131 |
+
|
132 |
+
if (plotElement) {
|
133 |
+
console.log("Plotly plot is loaded.");
|
134 |
+
clearInterval(intervalId);
|
135 |
+
hideLoaderAndShowContent();
|
136 |
+
} else {
|
137 |
+
console.log("Plotly plot is not loaded.");
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
function checkIfElementLoaded(elementId) {
|
143 |
+
const element = document.getElementById(elementId);
|
144 |
+
if (element) {
|
145 |
+
console.log("Element with ID:", elementId, "is loaded.");
|
146 |
+
} else {
|
147 |
+
console.log("Element with ID:", elementId, "is not loaded.");
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
function onPageLoad() {
|
152 |
+
// Replace 'yourElementId' with the ID of the element you want to check
|
153 |
+
checkIfElementLoaded("tornado_main");
|
154 |
+
}
|
155 |
+
|
156 |
+
// java script defined fcn to reeatedly execute a function
|
157 |
+
const intervalId = setInterval(checkForPlotlyPlot, 1000); // Checks every 1000ms (1 second)
|
158 |
+
|
159 |
+
// window.addEventListener("load", onPageLoad);
|
160 |
+
// window.addEventListener("load", checkForPlotlyPlot);
|
161 |
+
|
162 |
+
|
163 |
+
</script>
|
164 |
+
|
165 |
+
|
166 |
+
|
tornado.html
DELETED
The diff for this file is too large to render.
See raw diff
|
|