vera-in-viewer 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: vera-in-viewer
3
+ Version: 1.0.0
4
+ Summary: trame + VTK.wasm viewer for VERAin reactor core descriptions (port of VeraInView's 3D core view)
5
+ Keywords: trame,vtk,wasm,veraIn,reactor,visualization
6
+ Author: Sebastien Jourdain
7
+ Author-email: Sebastien Jourdain <sebastien.jourdain@kitware.com>
8
+ License-Expression: BSD-3-Clause
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Scientific/Engineering :: Visualization
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Dist: numpy>=1.26
18
+ Requires-Dist: packaging>=23
19
+ Requires-Dist: trame>=3.12
20
+ Requires-Dist: trame-vtklocal>=1.7.1
21
+ Requires-Dist: trame-vuetify>=3.3.0
22
+ Requires-Dist: vtk>=9.7
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+
26
+ # VeraInViewer
27
+
28
+ A Python port of the **3D core visualization** of [VeraInView](https://casl.github.io/VeraInView/), built with
29
+ [trame](https://kitware.github.io/trame/), [VTK](https://vtk.org) and
30
+ [trame-vtklocal](https://github.com/Kitware/trame-vtklocal).
31
+
32
+ The scene is built with VTK on the server and mirrored in the browser with VTK.wasm, so all
33
+ rendering and interaction happen client side: only geometry and state changes go over the wire.
34
+
35
+ It reads VERAin XML files (Teuchos `ParameterList`, e.g. the built-in samples in `src/vera_in_viewer/samples`) and shows:
36
+
37
+ - every pin of every assembly / control / detector / insert, stacked along their axial
38
+ elevations, as concentric material rings (one concentric cylinder mesh per cell type, split
39
+ into one glyph mapper per material; walls only where a material is hidden)
40
+ - spacer grids (strap thickness computed from mass and density), baffle, vessel, neutron
41
+ pads and core plates, each with its own visibility toggle
42
+ - per material visibility, using VeraInView's color palette and color assignment rules
43
+ - elevation slices (the rod segments crossing an axial range, with a wireframe outline)
44
+ - control rod banks: positions per `STATES` card (cumulative, like the simulation sees them),
45
+ per bank slider and visibility, insert / withdraw all, color by bank
46
+ - 2D mode (parallel top view with pan/zoom interaction), vertical scaling, adjustable
47
+ cylinder resolution
48
+
49
+ ## Quick start
50
+
51
+ Requires [uv](https://docs.astral.sh/uv/).
52
+
53
+ ```bash
54
+ uv run vera-in-viewer # pick a built-in sample or drop a file
55
+ uv run vera-in-viewer --data ~/cases # also list the files of a directory
56
+ uv run vera-in-viewer --data ~/cases/core.xml # loaded right away
57
+ ```
58
+
59
+ A browser tab opens automatically. Useful trame options: `--port 1234`, `--server` (do not open a
60
+ browser), `--host 0.0.0.0`.
61
+
62
+ ### Interaction
63
+
64
+ In 3D, left drag rotates, right drag (or scroll) zooms, shift + left drag (or middle drag)
65
+ pans. The toolbar holds the structure toggles and the vertical scale slider. A collapsible floating
66
+ bar at the top right of the 3D view holds the camera controls:
67
+
68
+ - reset camera: fit the scene without changing the view direction
69
+ - 2D/3D (pan / orbit icons): 2D switches to a parallel top view (like the 2D core maps of
70
+ VeraInView) where left drag pans and right drag or scroll zooms (no rotation)
71
+ - perspective / parallel projection (cone / cylinder icons)
72
+ - top, side and isometric views
73
+ - download a PNG screenshot of the 3D view, read back from VTK.wasm in the browser. This needs a
74
+ VTK nightly (9.7.20260716 or newer), the button is hidden with older versions:
75
+
76
+ ```bash
77
+ uv pip install --pre --index-url https://wheels.vtk.org "vtk>=9.7.20260716.dev0"
78
+ uv run --no-sync vera-in-viewer
79
+ ```
80
+
81
+ The bar collapses into a single button with its top chevron.
82
+
83
+ The start page is a full screen drop zone: drop or browse a local file, pick one of the built-in
84
+ samples (CASL AMA problems 6 and 8, with a preview of each) or one of the files given with `--data`.
85
+ Once loaded, the toolbar shows the case title, the file name with the core size, pin segment
86
+ and material counts, and a close button to go back to the start page.
87
+
88
+ ## Development
89
+
90
+ ```bash
91
+ uv sync --all-extras --dev # create .venv with runtime + dev dependencies
92
+ uv run pytest # run the tests
93
+ uvx nox # lint + tests on every supported Python
94
+ uvx nox -s fmt # format and auto-fix with ruff
95
+ uvx nox -s serve # launch the viewer
96
+ uvx nox -s build # build sdist + wheel into ./dist
97
+ uvx pre-commit install # optional: ruff + uv lock checks on commit
98
+
99
+ # Run pre-commit
100
+ uvx pre-commit run --all-files
101
+ ```
102
+
103
+ | Tool | Role |
104
+ | ----------- | ----------------------------------------------------------------------- |
105
+ | uv | Python/dependency management, locked in `uv.lock`, `uv_build` backend |
106
+ | nox | Task runner (`noxfile.py`), sessions use uv and the lock file |
107
+ | ruff | Linting and formatting (config in `pyproject.toml`) |
108
+ | pytest | Tests, including the baffle/assembly overlap check on the built-in samples |
109
+ | pre-commit | Optional git hooks (`.pre-commit-config.yaml`) |
110
+ | GitHub CI | `.github/workflows/ci.yml` runs nox on Linux / macOS / Windows |
111
+
112
+ ### Layout
113
+
114
+ ```
115
+ src/vera_in_viewer/
116
+ parser.py VERAin XML -> nested dicts (port of XMLVeraParser.js)
117
+ colors.py categorical color assignment (port of ColorManager.js + presets)
118
+ model.py dicts -> CoreModel: pin instances, grids, baffle, vessel, states
119
+ (port of ImageGenerator.compute3DCore and ModelHelper extractors)
120
+ geometry.py VTK meshes: concentric cylinder source (port of vtk.js), cubes, glyph instances
121
+ pipeline.py CoreScene: VTK actors/mappers and view settings (port of PipelineManager.js)
122
+ app.py trame UI (vuetify 4) + trame-vtklocal LocalView
123
+ module/serve/ client assets: 2D interaction script, start page style and background
124
+ samples/ built-in VERAin samples, their previews and metadata (index.json)
125
+ tests/ unit tests and a tiny synthetic core (tests/data/mini_core.xml)
126
+ ```
127
+
128
+ `model.py` is pure Python + numpy, so the reactor description can be reused or tested without VTK.
129
+
130
+ ## Differences from VeraInView
131
+
132
+ - Only the 3D core view is ported (no 2D maps, cell/assembly views or editor).
133
+ - Assemblies are centered in their pitch (VeraInView offsets them by half a pin pitch).
134
+ - Baffle plates are computed per exposed assembly edge with proper convex/concave corner
135
+ handling and Y orientation matching the core map, so they never overlap assemblies.
136
+ - Control rods start fully inserted.
137
+ - The LOD/Full switch is replaced by a resolution slider; the default depends on the number of
138
+ pins (6 sides for full cores like VeraInView's LOD, 24 for small models).
139
+
140
+ ## Implementation notes
141
+
142
+ - Cell connectivity is stored in fixed width (`int32`) arrays: `vtkIdTypeArray` is 64-bit on
143
+ the server but 32-bit in the wasm32 client, which garbles the meshes.
144
+ - Coloring rods by bank uses a per instance color array toggled through the mapper scalar
145
+ visibility: changing only the actor color of a `vtkGlyph3DMapper` was not always picked up by
146
+ the client after a scene rebuild.
147
+ - VTK.wasm ignores interactor style changes after creation and has no serializer for
148
+ `vtkInteractorStyleManipulator`, so the 2D mode keeps the trackball style and a small client
149
+ script (`module/serve/view_2d.js`) remaps the left button to the middle one (pan).
150
+ - Scene updates are pushed one at a time and coalesced until the client acknowledges them,
151
+ so quick successive changes are not lost behind a large update.
@@ -0,0 +1,126 @@
1
+ # VeraInViewer
2
+
3
+ A Python port of the **3D core visualization** of [VeraInView](https://casl.github.io/VeraInView/), built with
4
+ [trame](https://kitware.github.io/trame/), [VTK](https://vtk.org) and
5
+ [trame-vtklocal](https://github.com/Kitware/trame-vtklocal).
6
+
7
+ The scene is built with VTK on the server and mirrored in the browser with VTK.wasm, so all
8
+ rendering and interaction happen client side: only geometry and state changes go over the wire.
9
+
10
+ It reads VERAin XML files (Teuchos `ParameterList`, e.g. the built-in samples in `src/vera_in_viewer/samples`) and shows:
11
+
12
+ - every pin of every assembly / control / detector / insert, stacked along their axial
13
+ elevations, as concentric material rings (one concentric cylinder mesh per cell type, split
14
+ into one glyph mapper per material; walls only where a material is hidden)
15
+ - spacer grids (strap thickness computed from mass and density), baffle, vessel, neutron
16
+ pads and core plates, each with its own visibility toggle
17
+ - per material visibility, using VeraInView's color palette and color assignment rules
18
+ - elevation slices (the rod segments crossing an axial range, with a wireframe outline)
19
+ - control rod banks: positions per `STATES` card (cumulative, like the simulation sees them),
20
+ per bank slider and visibility, insert / withdraw all, color by bank
21
+ - 2D mode (parallel top view with pan/zoom interaction), vertical scaling, adjustable
22
+ cylinder resolution
23
+
24
+ ## Quick start
25
+
26
+ Requires [uv](https://docs.astral.sh/uv/).
27
+
28
+ ```bash
29
+ uv run vera-in-viewer # pick a built-in sample or drop a file
30
+ uv run vera-in-viewer --data ~/cases # also list the files of a directory
31
+ uv run vera-in-viewer --data ~/cases/core.xml # loaded right away
32
+ ```
33
+
34
+ A browser tab opens automatically. Useful trame options: `--port 1234`, `--server` (do not open a
35
+ browser), `--host 0.0.0.0`.
36
+
37
+ ### Interaction
38
+
39
+ In 3D, left drag rotates, right drag (or scroll) zooms, shift + left drag (or middle drag)
40
+ pans. The toolbar holds the structure toggles and the vertical scale slider. A collapsible floating
41
+ bar at the top right of the 3D view holds the camera controls:
42
+
43
+ - reset camera: fit the scene without changing the view direction
44
+ - 2D/3D (pan / orbit icons): 2D switches to a parallel top view (like the 2D core maps of
45
+ VeraInView) where left drag pans and right drag or scroll zooms (no rotation)
46
+ - perspective / parallel projection (cone / cylinder icons)
47
+ - top, side and isometric views
48
+ - download a PNG screenshot of the 3D view, read back from VTK.wasm in the browser. This needs a
49
+ VTK nightly (9.7.20260716 or newer), the button is hidden with older versions:
50
+
51
+ ```bash
52
+ uv pip install --pre --index-url https://wheels.vtk.org "vtk>=9.7.20260716.dev0"
53
+ uv run --no-sync vera-in-viewer
54
+ ```
55
+
56
+ The bar collapses into a single button with its top chevron.
57
+
58
+ The start page is a full screen drop zone: drop or browse a local file, pick one of the built-in
59
+ samples (CASL AMA problems 6 and 8, with a preview of each) or one of the files given with `--data`.
60
+ Once loaded, the toolbar shows the case title, the file name with the core size, pin segment
61
+ and material counts, and a close button to go back to the start page.
62
+
63
+ ## Development
64
+
65
+ ```bash
66
+ uv sync --all-extras --dev # create .venv with runtime + dev dependencies
67
+ uv run pytest # run the tests
68
+ uvx nox # lint + tests on every supported Python
69
+ uvx nox -s fmt # format and auto-fix with ruff
70
+ uvx nox -s serve # launch the viewer
71
+ uvx nox -s build # build sdist + wheel into ./dist
72
+ uvx pre-commit install # optional: ruff + uv lock checks on commit
73
+
74
+ # Run pre-commit
75
+ uvx pre-commit run --all-files
76
+ ```
77
+
78
+ | Tool | Role |
79
+ | ----------- | ----------------------------------------------------------------------- |
80
+ | uv | Python/dependency management, locked in `uv.lock`, `uv_build` backend |
81
+ | nox | Task runner (`noxfile.py`), sessions use uv and the lock file |
82
+ | ruff | Linting and formatting (config in `pyproject.toml`) |
83
+ | pytest | Tests, including the baffle/assembly overlap check on the built-in samples |
84
+ | pre-commit | Optional git hooks (`.pre-commit-config.yaml`) |
85
+ | GitHub CI | `.github/workflows/ci.yml` runs nox on Linux / macOS / Windows |
86
+
87
+ ### Layout
88
+
89
+ ```
90
+ src/vera_in_viewer/
91
+ parser.py VERAin XML -> nested dicts (port of XMLVeraParser.js)
92
+ colors.py categorical color assignment (port of ColorManager.js + presets)
93
+ model.py dicts -> CoreModel: pin instances, grids, baffle, vessel, states
94
+ (port of ImageGenerator.compute3DCore and ModelHelper extractors)
95
+ geometry.py VTK meshes: concentric cylinder source (port of vtk.js), cubes, glyph instances
96
+ pipeline.py CoreScene: VTK actors/mappers and view settings (port of PipelineManager.js)
97
+ app.py trame UI (vuetify 4) + trame-vtklocal LocalView
98
+ module/serve/ client assets: 2D interaction script, start page style and background
99
+ samples/ built-in VERAin samples, their previews and metadata (index.json)
100
+ tests/ unit tests and a tiny synthetic core (tests/data/mini_core.xml)
101
+ ```
102
+
103
+ `model.py` is pure Python + numpy, so the reactor description can be reused or tested without VTK.
104
+
105
+ ## Differences from VeraInView
106
+
107
+ - Only the 3D core view is ported (no 2D maps, cell/assembly views or editor).
108
+ - Assemblies are centered in their pitch (VeraInView offsets them by half a pin pitch).
109
+ - Baffle plates are computed per exposed assembly edge with proper convex/concave corner
110
+ handling and Y orientation matching the core map, so they never overlap assemblies.
111
+ - Control rods start fully inserted.
112
+ - The LOD/Full switch is replaced by a resolution slider; the default depends on the number of
113
+ pins (6 sides for full cores like VeraInView's LOD, 24 for small models).
114
+
115
+ ## Implementation notes
116
+
117
+ - Cell connectivity is stored in fixed width (`int32`) arrays: `vtkIdTypeArray` is 64-bit on
118
+ the server but 32-bit in the wasm32 client, which garbles the meshes.
119
+ - Coloring rods by bank uses a per instance color array toggled through the mapper scalar
120
+ visibility: changing only the actor color of a `vtkGlyph3DMapper` was not always picked up by
121
+ the client after a scene rebuild.
122
+ - VTK.wasm ignores interactor style changes after creation and has no serializer for
123
+ `vtkInteractorStyleManipulator`, so the 2D mode keeps the trackball style and a small client
124
+ script (`module/serve/view_2d.js`) remaps the left button to the middle one (pan).
125
+ - Scene updates are pushed one at a time and coalesced until the client acknowledges them,
126
+ so quick successive changes are not lost behind a large update.
@@ -0,0 +1,115 @@
1
+ [project]
2
+ name = "vera-in-viewer"
3
+ version = "1.0.0"
4
+ description = "trame + VTK.wasm viewer for VERAin reactor core descriptions (port of VeraInView's 3D core view)"
5
+ readme = "README.md"
6
+ license = "BSD-3-Clause"
7
+ requires-python = ">=3.10"
8
+ keywords = [
9
+ "trame",
10
+ "vtk",
11
+ "wasm",
12
+ "veraIn",
13
+ "reactor",
14
+ "visualization",
15
+ ]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Scientific/Engineering :: Visualization",
23
+ "Intended Audience :: Science/Research",
24
+ "Operating System :: OS Independent",
25
+ ]
26
+ dependencies = [
27
+ "numpy>=1.26",
28
+ "packaging>=23",
29
+ "trame>=3.12",
30
+ "trame-vtklocal>=1.7.1",
31
+ "trame-vuetify>=3.3.0",
32
+ "vtk>=9.7",
33
+ ]
34
+
35
+ [[project.authors]]
36
+ name = "Sebastien Jourdain"
37
+ email = "sebastien.jourdain@kitware.com"
38
+
39
+ [project.scripts]
40
+ vera-in-viewer = "vera_in_viewer.app:main"
41
+
42
+ [build-system]
43
+ requires = ["uv_build>=0.9.9,<0.10.0"]
44
+ build-backend = "uv_build"
45
+
46
+ [dependency-groups]
47
+ dev = [
48
+ "pre-commit",
49
+ "ruff",
50
+ "nox>=2026.8.17",
51
+ "pytest>=9.1.1",
52
+ "pytest-cov>=6.0",
53
+ "ruff>=0.16.10",
54
+ ]
55
+
56
+ [tool.ruff]
57
+ line-length = 110
58
+ target-version = "py310"
59
+
60
+ [tool.ruff.lint]
61
+ select = [
62
+ "E",
63
+ "F",
64
+ "W",
65
+ "I",
66
+ "B",
67
+ "UP",
68
+ "SIM",
69
+ "RUF",
70
+ "PL",
71
+ "NPY",
72
+ ]
73
+ ignore = [
74
+ "PLR0912",
75
+ "PLR0913",
76
+ "PLR0915",
77
+ "PLR2004",
78
+ "PLR0917",
79
+ "SIM117",
80
+ ]
81
+
82
+ [tool.ruff.lint.per-file-ignores]
83
+ "tests/**" = ["PLC0415"]
84
+
85
+ [tool.semantic_release]
86
+ version_toml = ["pyproject.toml:project.version"]
87
+ commit_message = "chore(release): {version}"
88
+ build_command = """
89
+ python -m pip install -q uv
90
+ uv lock --upgrade-package vera-in-viewer
91
+ git add uv.lock
92
+ uv build
93
+ """
94
+ dist_path = "dist/"
95
+ upload_to_vcs_release = true
96
+
97
+ [tool.semantic_release.branches.main]
98
+ match = "main"
99
+ prerelease = false
100
+
101
+ [tool.semantic_release.changelog]
102
+ exclude_commit_patterns = ['^chore\(release\):']
103
+
104
+ [tool.semantic_release.changelog.default_templates]
105
+ changelog_file = "CHANGELOG.md"
106
+
107
+ [tool.semantic_release.commit_parser_options]
108
+ parse_squash_commits = true
109
+
110
+ [tool.pytest.ini_options]
111
+ testpaths = ["tests"]
112
+ addopts = [
113
+ "-ra",
114
+ "--strict-markers",
115
+ ]
@@ -0,0 +1,94 @@
1
+ [project]
2
+ name = "vera-in-viewer"
3
+ version = "1.0.0"
4
+ description = "trame + VTK.wasm viewer for VERAin reactor core descriptions (port of VeraInView's 3D core view)"
5
+ readme = "README.md"
6
+ license = "BSD-3-Clause"
7
+ authors = [
8
+ { name = "Sebastien Jourdain", email = "sebastien.jourdain@kitware.com" }
9
+ ]
10
+ requires-python = ">=3.10"
11
+ keywords = ["trame", "vtk", "wasm", "veraIn", "reactor", "visualization"]
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Topic :: Scientific/Engineering :: Visualization",
19
+ "Intended Audience :: Science/Research",
20
+ "Operating System :: OS Independent",
21
+ ]
22
+ dependencies = [
23
+ "numpy>=1.26",
24
+ "packaging>=23",
25
+ "trame>=3.12",
26
+ "trame-vtklocal>=1.7.1",
27
+ "trame-vuetify>=3.3.0",
28
+ "vtk>=9.7",
29
+ ]
30
+
31
+ [project.scripts]
32
+ vera-in-viewer = "vera_in_viewer.app:main"
33
+
34
+ [build-system]
35
+ requires = ["uv_build>=0.9.9,<0.10.0"]
36
+ build-backend = "uv_build"
37
+
38
+ [dependency-groups]
39
+ dev = [
40
+ "pre-commit",
41
+ "ruff",
42
+ "nox>=2026.8.17",
43
+ "pytest>=9.1.1",
44
+ "pytest-cov>=6.0",
45
+ "ruff>=0.16.10",
46
+ ]
47
+
48
+ [tool.ruff]
49
+ line-length = 110
50
+ target-version = "py310"
51
+
52
+ [tool.ruff.lint]
53
+ select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF", "PL", "NPY"]
54
+ ignore = [
55
+ "PLR0912", # too many branches
56
+ "PLR0913", # too many arguments
57
+ "PLR0915", # too many statements
58
+ "PLR2004", # magic values
59
+ "PLR0917", # too many positional arguments
60
+ "SIM117", # nested `with` is the idiomatic way to build trame UIs
61
+ ]
62
+
63
+ [tool.ruff.lint.per-file-ignores]
64
+ "tests/**" = ["PLC0415"]
65
+
66
+ [tool.semantic_release]
67
+ version_toml = ["pyproject.toml:project.version"]
68
+ commit_message = "chore(release): {version}"
69
+ # Keep uv.lock in sync with the bumped version so `uv sync --locked` keeps working.
70
+ build_command = """
71
+ python -m pip install -q uv
72
+ uv lock --upgrade-package vera-in-viewer
73
+ git add uv.lock
74
+ uv build
75
+ """
76
+ dist_path = "dist/"
77
+ upload_to_vcs_release = true
78
+
79
+ [tool.semantic_release.branches.main]
80
+ match = "main"
81
+ prerelease = false
82
+
83
+ [tool.semantic_release.changelog]
84
+ exclude_commit_patterns = ["^chore\\(release\\):"]
85
+
86
+ [tool.semantic_release.changelog.default_templates]
87
+ changelog_file = "CHANGELOG.md"
88
+
89
+ [tool.semantic_release.commit_parser_options]
90
+ parse_squash_commits = true
91
+
92
+ [tool.pytest.ini_options]
93
+ testpaths = ["tests"]
94
+ addopts = ["-ra", "--strict-markers"]
@@ -0,0 +1,10 @@
1
+ """Trame based 3D viewer for VERAin core descriptions."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("vera-in-viewer")
7
+ except PackageNotFoundError: # pragma: no cover
8
+ __version__ = "0.0.0"
9
+
10
+ __all__ = ["__version__"]
@@ -0,0 +1,3 @@
1
+ from .app import main
2
+
3
+ main()