Spaces:
Sleeping
Sleeping
change so that grid can be coarser for less loading time
Browse files- plotting.py +9 -4
plotting.py
CHANGED
|
@@ -19,6 +19,11 @@ def plot(kvl_file):
|
|
| 19 |
curves = st.multiselect('Select TOP Key to Visualize surface, SED keys to project', keys)
|
| 20 |
inst = st.select_slider('Select Time Instance', t_iter)
|
| 21 |
gridno=st.checkbox('Grid on')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
time = int(inst) / dt
|
| 23 |
sampleno = len(kvl_file['TOP']) / nt
|
| 24 |
start_index = int(time * sampleno)
|
|
@@ -36,15 +41,15 @@ def plot(kvl_file):
|
|
| 36 |
y_data = np.arange(z_data.shape[0])
|
| 37 |
|
| 38 |
# Create meshgrid for surface
|
| 39 |
-
xGrid, yGrid = np.meshgrid(x_data, y_data)
|
| 40 |
-
xRev, yRev = np.meshgrid(y_data, x_data)
|
| 41 |
|
| 42 |
# Create figure
|
| 43 |
fig = go.Figure(data=[go.Surface(x=x_data, y=y_data, z=z_data,surfacecolor=intensity_data,colorscale='Rainbow')])
|
| 44 |
if gridno: #grid on
|
| 45 |
-
for i,j,k in zip(xGrid,yGrid,z_data):
|
| 46 |
fig.add_trace(go.Scatter3d(x=i,y=j,z=k, mode='lines', line=dict(color='black', width=1,)))
|
| 47 |
-
for i,j,k in zip(xRev,yRev,z_data.T):
|
| 48 |
fig.add_trace(go.Scatter3d(x=j,y=i,z=k, mode='lines', line=dict(color='black', width=1,)))
|
| 49 |
|
| 50 |
# Update the layout of the figure
|
|
|
|
| 19 |
curves = st.multiselect('Select TOP Key to Visualize surface, SED keys to project', keys)
|
| 20 |
inst = st.select_slider('Select Time Instance', t_iter)
|
| 21 |
gridno=st.checkbox('Grid on')
|
| 22 |
+
if gridno:
|
| 23 |
+
kgrid=st.number_input('Higher the number, coarser the grid',value=2,placeholder=2)
|
| 24 |
+
else:
|
| 25 |
+
kgrid=2
|
| 26 |
+
|
| 27 |
time = int(inst) / dt
|
| 28 |
sampleno = len(kvl_file['TOP']) / nt
|
| 29 |
start_index = int(time * sampleno)
|
|
|
|
| 41 |
y_data = np.arange(z_data.shape[0])
|
| 42 |
|
| 43 |
# Create meshgrid for surface
|
| 44 |
+
xGrid, yGrid = np.meshgrid(x_data[::kgrid], y_data[::kgrid])
|
| 45 |
+
xRev, yRev = np.meshgrid(y_data[::kgrid], x_data[::kgrid])
|
| 46 |
|
| 47 |
# Create figure
|
| 48 |
fig = go.Figure(data=[go.Surface(x=x_data, y=y_data, z=z_data,surfacecolor=intensity_data,colorscale='Rainbow')])
|
| 49 |
if gridno: #grid on
|
| 50 |
+
for i,j,k in zip(xGrid,yGrid,z_data[::kgrid,::kgrid]):
|
| 51 |
fig.add_trace(go.Scatter3d(x=i,y=j,z=k, mode='lines', line=dict(color='black', width=1,)))
|
| 52 |
+
for i,j,k in zip(xRev,yRev,z_data[::kgrid,::kgrid].T):
|
| 53 |
fig.add_trace(go.Scatter3d(x=j,y=i,z=k, mode='lines', line=dict(color='black', width=1,)))
|
| 54 |
|
| 55 |
# Update the layout of the figure
|