Skip to content

Commit d3273a0

Browse files
committed
Better layout
1 parent 710f9ab commit d3273a0

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

app.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pyvista as pv
77
import sys
88

9-
version = "v0.0.7"
9+
version = "v0.0.8"
1010

1111
st_mode = "-gui" not in sys.argv
1212

@@ -39,15 +39,15 @@
3939
plotter = pv.Plotter()
4040

4141

42-
add_virtualworm_muscles(plotter)
43-
# add_virtualworm_neurons(plotter)
44-
add_neuroml_model(plotter, "NeuroML2/c302_D_Full.net.nml", somas_only=True)
45-
add_sibernetic_model(plotter)
42+
spacing = 50
43+
44+
add_sibernetic_model(plotter, swap_y_z=True, offset=spacing)
45+
add_neuroml_model(plotter, "NeuroML2/c302_A_Full.net.nml", somas_only=False) # at 0...
46+
add_virtualworm_muscles(plotter, translate=(-1 * spacing, 0, 0))
47+
# add_virtualworm_neurons(plotter, translate=(-1.8*spacing, 0, 0))
4648

4749

4850
plotter.set_viewup([0, 10, 0])
49-
# plotter.remove_scalar_bar("RegionId")
50-
# plotter.remove_scalar_bar("types")
5151

5252

5353
print("Created the scene...")

load.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99
if __name__ == "__main__":
1010
plotter = pv.Plotter()
1111

12-
add_virtualworm_muscles(plotter, translate=(-40, 0, 0))
13-
add_virtualworm_neurons(plotter)
12+
spacing = 50
1413

15-
add_neuroml_model(plotter, "NeuroML2/c302_D_Full.net.nml", somas_only=False)
16-
add_sibernetic_model(plotter, swap_y_z=True)
14+
add_sibernetic_model(plotter, swap_y_z=True, offset=spacing)
15+
add_neuroml_model(
16+
plotter, "NeuroML2/c302_D_Full.net.nml", somas_only=False
17+
) # at 0...
18+
add_virtualworm_muscles(plotter, translate=(-1 * spacing, 0, 0))
19+
add_virtualworm_neurons(plotter, translate=(-1.8 * spacing, 0, 0))
1720

1821
plotter.set_background("white")
1922
plotter.set_viewup([0, 10, 0])
2023

21-
plotter.add_axes()
24+
# plotter.add_axes()
2225

2326
if "-nogui" not in sys.argv:
2427
plotter.show()

neuromlmodel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def add_neuroml_model(
8282
"Plotting only sphere (radius: %s) %s(%i) at %s, %s"
8383
% (radius, cell.id, cell_index, pos, pp)
8484
)
85-
sphere = pv.Sphere(center=(pp[0], pp[1], pp[2]), radius=radius * factor)
85+
sphere = pv.Sphere(center=(pp[0], pp[1], pp[2]), radius=radius)
8686

8787
plotter.add_mesh(sphere, color=color)
8888

siberneticmodel.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
plotter = None
1313

14-
spacing_ = 50
14+
offset_ = 50
1515

1616

17-
def add_sibernetic_model(pl, swap_y_z=False, spacing=50):
18-
global all_points, all_point_types, last_mesh, plotter, spacing_
19-
spacing_ = spacing
17+
def add_sibernetic_model(pl, swap_y_z=False, offset=50):
18+
global all_points, all_point_types, last_mesh, plotter, offset_
19+
offset_ = offset
2020
plotter = pl
2121

2222
points = []
@@ -96,7 +96,7 @@ def add_sibernetic_model(pl, swap_y_z=False, spacing=50):
9696
plotter.remove_scalar_bar("types")
9797

9898
max_time = len(all_points) - 1
99-
pl.add_slider_widget(create_mesh, rng=[0, max_time], value=0, title="Time point")
99+
pl.add_slider_widget(create_mesh, rng=[0, max_time], value=30, title="Time point")
100100
pl.add_timer_event(max_steps=5, duration=2, callback=create_mesh)
101101

102102

@@ -105,7 +105,7 @@ def create_mesh(step):
105105

106106
step_count = step
107107
value = step_count
108-
global all_points, all_point_types, last_mesh, plotter, spacing_
108+
global all_points, all_point_types, last_mesh, plotter, offset_
109109

110110
index = int(value)
111111

@@ -128,7 +128,7 @@ def create_mesh(step):
128128
)
129129
else:
130130
last_mesh.points = curr_points
131-
last_mesh.translate((spacing_, -50, -100), inplace=True)
131+
last_mesh.translate((offset_, -50, -100), inplace=True)
132132

133133
plotter.render()
134134

0 commit comments

Comments
 (0)