Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

180 slicing options #194

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion GoVizzy/gv_ui/gv_ui/DisplayUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def display_app():
gvWidgets.slice_y_check,
gvWidgets.slice_z_slider,
gvWidgets.slice_z_check,
figure_controls])
gvWidgets.slice_color,
figure_controls,])
display(slice_box)


Expand Down
15 changes: 11 additions & 4 deletions GoVizzy/gv_ui/gv_ui/gvWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Documentation for widget library: https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#file-upload
'''
from IPython.display import display
from ipywidgets import Layout, Button, Box, Textarea, Label, ColorPicker, FloatSlider, Checkbox, link, BoundedFloatText, IntSlider
from ipywidgets import Layout, Button, Box, Textarea, Label, ColorPicker, FloatSlider, Checkbox, link, BoundedFloatText, IntSlider, Dropdown
from ipyvolume.widgets import Mesh, Scatter
import numpy as np

Expand Down Expand Up @@ -67,6 +67,13 @@
indent=True
)

slice_color = Dropdown(
options=['Grays', 'Reds', 'Oranges', 'Greens', 'Blues', 'Purples'],
description='Slice Color Scheme',
disabled=False,
indent=True
)

bond_visibility_toggle = Checkbox(
value=True,
description='Bond Visibility',
Expand All @@ -75,7 +82,7 @@
)

bond_color_picker = ColorPicker(
value="black",
value="black",
description="Bond Color"
)

Expand Down Expand Up @@ -146,7 +153,7 @@ def atom_scale_slider(atom: Mesh, description: str="Scale"):
# Input form items
form_items = [

Box([Label(value='Path to .cube file'),
Box([Label(value='Path to .cube file'),
Textarea()], layout=form_item_layout),
color,
Button(description='Submit', layout=Layout(flex='1 1 0%', width='auto')),
Expand All @@ -162,4 +169,4 @@ def atom_scale_slider(atom: Mesh, description: str="Scale"):
width='50%'
))

form, color, slice_x_slider, slice_y_slider, slice_z_slider, slice_x_check, slice_y_check, slice_z_check, bond_scale_slider, bond_color_picker, bond_visibility_toggle
form, color, slice_x_slider, slice_y_slider, slice_z_slider, slice_x_check, slice_y_check, slice_z_check, slice_color, bond_scale_slider, bond_color_picker, bond_visibility_toggle
7 changes: 4 additions & 3 deletions GoVizzy/gv_ui/gv_ui/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ def display_cell_slices(self):

# Slice order is different to match ipyvolume, which plots the volume in a y-up orientation
def update(x = 0, y = 0, z = 0):
xSlice.imshow(cube.data3D[:, :, x])
ySlice.imshow(cube.data3D[:, y, :])
zSlice.imshow(cube.data3D[z, :, :])
color = str(gvWidgets.slice_color.value)
xSlice.imshow(cube.data3D[:, :, x], cmap=color,)
ySlice.imshow(cube.data3D[:, y, :], cmap=color,)
zSlice.imshow(cube.data3D[z, :, :], cmap=color,)
plt.show()

out = widgets.interactive_output(update, {'x':gvWidgets.slice_x_slider,
Expand Down