Skip to main content

VeraInViewer

A Python port of the 3D core visualization of VeraInView, built with trame, VTK and trame-vtklocal.

VeraInViewer started with uvx vera-in-viewer

The scene is built with VTK on the server and mirrored in the browser with VTK.wasm, so all rendering and interaction happen client side: only geometry and state changes go over the wire.

It reads VERAin XML files (Teuchos ParameterList, e.g. the built-in samples in src/vera_in_viewer/samples) and shows:

  • every pin of every assembly / control / detector / insert, stacked along their axial elevations, as concentric material rings (one concentric cylinder mesh per cell type, split into one glyph mapper per material; walls only where a material is hidden)
  • spacer grids (strap thickness computed from mass and density), baffle, vessel, neutron pads and core plates, each with its own visibility toggle
  • per material visibility, using VeraInView's color palette and color assignment rules
  • elevation slices (the rod segments crossing an axial range, with a wireframe outline)
  • control rod banks: positions per STATES card (cumulative, like the simulation sees them), per bank slider and visibility, insert / withdraw all, color by bank
  • 2D mode (parallel top view with pan/zoom interaction), vertical scaling, adjustable cylinder resolution

Quick start

Requires uv.

uv run vera-in-viewer                          # pick a built-in sample or drop a file
uv run vera-in-viewer --data ~/cases           # also list the files of a directory
uv run vera-in-viewer --data ~/cases/core.xml  # loaded right away

A browser tab opens automatically. Useful trame options: --port 1234, --server (do not open a browser), --host 0.0.0.0.

--electron renders the 3D view on the server with VTK, into a GPU texture shared with an Electron window (trame-rca shared-texture view), instead of using VTK.wasm in the browser. It only works when the server is started by @kitware/trame-rca-electron, as the desktop application does.

Interaction

In 3D, left drag rotates, right drag (or scroll) zooms, shift + left drag (or middle drag) pans. The toolbar holds the structure toggles and the vertical scale slider. A collapsible floating bar at the top right of the 3D view holds the camera controls:

  • reset camera: fit the scene without changing the view direction

  • 2D/3D (pan / orbit icons): 2D switches to a parallel top view (like the 2D core maps of VeraInView) where left drag pans and right drag or scroll zooms (no rotation)

  • perspective / parallel projection (cone / cylinder icons)

  • top, side and isometric views

  • download a PNG screenshot of the 3D view, read back from VTK.wasm in the browser (rendered on the server with --electron). With VTK.wasm, this needs a VTK nightly (9.7.20260716 or newer), the button is hidden with older versions:

    uv pip install --pre --index-url https://wheels.vtk.org "vtk>=9.7.20260716.dev0"
    uv run --no-sync vera-in-viewer
    

The bar collapses into a single button with its top chevron.

The start page is a full screen drop zone: drop or browse a local file, pick one of the built-in samples (CASL AMA problems 6 and 8, with a preview of each) or one of the files given with --data. Once loaded, the toolbar shows the case title, the file name with the core size, pin segment and material counts, and a close button to go back to the start page.

Desktop application

The electron directory packages the viewer as a standalone desktop app: PyInstaller freezes the Python server and Electron provides the native window. The server runs with --electron: VTK renders on the GPU into a texture Electron shows directly, without VTK.wasm. cd electron && npm install && npm run build builds the installer for the current platform.

Development

uv sync --all-extras --dev  # create .venv with runtime + dev dependencies
uv run pytest               # run the tests
uvx nox                     # lint + tests on every supported Python
uvx nox -s fmt              # format and auto-fix with ruff
uvx nox -s serve            # launch the viewer
uvx nox -s build            # build sdist + wheel into ./dist
uvx pre-commit install      # optional: ruff + uv lock checks on commit

# Run pre-commit
uvx pre-commit run --all-files
Tool Role
uv Python/dependency management, locked in uv.lock, uv_build backend
nox Task runner (noxfile.py), sessions use uv and the lock file
ruff Linting and formatting (config in pyproject.toml)
pytest Tests, including the baffle/assembly overlap check on the built-in samples
pre-commit Optional git hooks (.pre-commit-config.yaml)
GitHub CI .github/workflows/ci.yml runs nox on Linux / macOS / Windows

Layout

src/vera_in_viewer/
  parser.py     VERAin XML -> nested dicts (port of XMLVeraParser.js)
  colors.py     categorical color assignment (port of ColorManager.js + presets)
  model.py      dicts -> CoreModel: pin instances, grids, baffle, vessel, states
                (port of ImageGenerator.compute3DCore and ModelHelper extractors)
  geometry.py   VTK meshes: concentric cylinder source (port of vtk.js), cubes, glyph instances
  pipeline.py   CoreScene: VTK actors/mappers and view settings (port of PipelineManager.js)
  app.py        trame UI (vuetify 4) + trame-vtklocal LocalView
  module/serve/ client assets: 2D interaction script, start page style and background
  samples/      built-in VERAin samples, their previews and metadata (index.json)
tests/          unit tests and a tiny synthetic core (tests/data/mini_core.xml)

model.py is pure Python + numpy, so the reactor description can be reused or tested without VTK.

Differences from VeraInView

  • Only the 3D core view is ported (no 2D maps, cell/assembly views or editor).
  • Assemblies are centered in their pitch (VeraInView offsets them by half a pin pitch).
  • Baffle plates are computed per exposed assembly edge with proper convex/concave corner handling and Y orientation matching the core map, so they never overlap assemblies.
  • Control rods start fully inserted.
  • The LOD/Full switch is replaced by a resolution slider; the default depends on the number of pins (6 sides for full cores like VeraInView's LOD, 24 for small models).

Implementation notes

  • Cell connectivity is stored in fixed width (int32) arrays: vtkIdTypeArray is 64-bit on the server but 32-bit in the wasm32 client, which garbles the meshes.
  • Coloring rods by bank uses a per instance color array toggled through the mapper scalar visibility: changing only the actor color of a vtkGlyph3DMapper was not always picked up by the client after a scene rebuild.
  • VTK.wasm ignores interactor style changes after creation and has no serializer for vtkInteractorStyleManipulator, so the 2D mode keeps the trackball style and a small client script (module/serve/view_2d.js) remaps the left button to the middle one (pan).
  • Scene updates are pushed one at a time and coalesced until the client acknowledges them, so quick successive changes are not lost behind a large update.

Metadata

Release files for vera-in-viewer 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vera-in-viewer 1.1.0
File Size Uploaded Provenance Actions
vera_in_viewer-1.1.0.tar.gz 275.3 kB With provenance Details for vera_in_viewer-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vera-in-viewer 1.1.0
File Interpreter ABI Platform Actions
vera_in_viewer-1.1.0-py3-none-any.whl Python 3 none any Details for vera_in_viewer-1.1.0-py3-none-any.whl

Total release size: 552.0 kB

Release files / vera_in_viewer-1.1.0.tar.gz

Download URL vera_in_viewer-1.1.0.tar.gz
Size 275.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e15dac8b1c64cf3d51f0ba8a30f97d0c6729fd2bd5b58ef876930af6c9aef024
BLAKE2b-256 checksum
How to use checksums
e203766619a8c28c6faccc120b5b97a6846d16ca883a93d6991bfb16e341881f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / vera_in_viewer-1.1.0-py3-none-any.whl

Download URL vera_in_viewer-1.1.0-py3-none-any.whl
Size 276.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
467030c4d5d080631f81efdbb3c154cba252d1f9ce15b8a631f481cb5c5a0ad6
BLAKE2b-256 checksum
How to use checksums
7eb2e2033b2074035af119b774121398bd7cb21ef0975818130c3b1dccd7f7b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for vera-in-viewer 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vera_in_viewer-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page