Skip to content

Commit

Permalink
eigenvectors tab: Add dropdown for isosurface level
Browse files Browse the repository at this point in the history
closes #23
  • Loading branch information
blackwer committed Dec 6, 2023
1 parent 666c37e commit f29c537
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ManifoldEM/gui/eigen_views/mayavi_rho.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self):
class _Mayavi_Rho(HasTraits):
"""View of electrostatic potential map"""
scene3 = Instance(MlabSceneModel, ())
isosurface = Range(2, 9, 3, mode='enum')
isosurface_level = Range(2, 9, 3, mode='enum')
volume_alpha = Enum(1.0, .8, .6, .4, .2, 0.0)
phi = Str
theta = Str
Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(self, parent):
self.parent = parent


@on_trait_change('volume_alpha,isosurface')
@on_trait_change('volume_alpha,isosurface_level')
def update_scene3(self, init=False):
if _disable_viz:
return
Expand All @@ -105,7 +105,7 @@ def update_scene3(self, init=False):

mirror = df_vol[..., ::-1]

cplot = mlab.contour3d(mirror, contours=self.isosurface, color=(0.5, 0.5, 0.5), figure=self.fig3)
cplot = mlab.contour3d(mirror, contours=self.isosurface_level, color=(0.5, 0.5, 0.5), figure=self.fig3)
cplot.actor.actor.orientation = np.array([0., -90., 0.])

cplot.actor.actor.origin = np.array([len(df_vol) / 2, len(df_vol) / 2, len(df_vol) / 2])
Expand Down Expand Up @@ -284,6 +284,10 @@ def _title_default(self):
editor=TextEditor(evaluate=float),
enabled_when='phi == float(0)', #i.e., never
),
Item('isosurface_level',
springy=True,
show_label=True,
tooltip='Change the isosurface level of the volume map above.'),
),
show_border=False,
orientation='vertical'),
Expand Down

0 comments on commit f29c537

Please sign in to comment.