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

viewing VTK files in jupyter #291

Open
shimwell opened this issue Aug 30, 2024 · 1 comment
Open

viewing VTK files in jupyter #291

shimwell opened this issue Aug 30, 2024 · 1 comment

Comments

@shimwell
Copy link
Member

shimwell commented Aug 30, 2024

I accidentally stumbled on this today while trying to view a vtk from within a container and thought the workshop could benefit from this.

Currently we ask users to install paraview locally. However we could view the vtk files directly in julyter lab.

We could include pyvista with pip install 'pyvista[jupyter]' in the docker image and then plot mesh tally results like this one from task 8

import pyvista as pv
mesh = pv.read('heating_tally_on_reg_mesh.vtk')
mesh.set_active_scalars(name='mean')
clipped = mesh.clip(normal='y')
# clipped_and_thresholded = clipped.threshold(0.1e-21)
clipped_and_thresholded = clipped.threshold_percent(0.01)
clipped_and_thresholded.plot()

📹 vtk-openmc-pyvist-jupyter.webm 📹
vtk-openmc-jupyter-pyvista

@jon-proximafusion
Copy link
Collaborator

looks like the dockerfile needs a few extra parts

  •                      # needed for pyvista functionality
    
  •                      xvfb
    
  •            pyvista[all] \
    
  •            jupyter-server-proxy \
    
  •            trame
    

+CMD ["xvfb-run", "-s", "-screen 0 1024x768x24", "jupyter", "notebook", "--ip=0.0.0.0", "--no-browser", "--allow-root"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants