tensor-network-visualization 1.5.2__tar.gz → 1.5.3__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.
- {tensor_network_visualization-1.5.2/src/tensor_network_visualization.egg-info → tensor_network_visualization-1.5.3}/PKG-INFO +83 -14
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/README.md +82 -13
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/pyproject.toml +2 -2
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3/src/tensor_network_visualization.egg-info}/PKG-INFO +83 -14
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/SOURCES.txt +12 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/__init__.py +52 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_contraction_viewer_style.py +202 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_contraction_viewer_ui.py +126 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/contractions.py +114 -122
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/draw/contraction_scheme.py +733 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/dangling_self_edges.py +7 -1
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/edge_labels.py +1 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/graph_pipeline.py +37 -106
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/hover.py +8 -4
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/plotter.py +145 -39
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/render_prep.py +16 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/scene_state.py +5 -1
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/tensors.py +51 -8
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/viewport_geometry.py +3 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/graph.py +4 -4
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/graph_cache.py +10 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/positions.py +5 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/renderer.py +8 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_input_inspection.py +226 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_interaction/bridge.py +3 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/controller.py +423 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/controls.py +196 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_interaction/scheme.py +37 -57
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/state.py +152 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/tensor_inspector.py +220 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/views.py +213 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_interactive_scene.py +146 -18
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_logging.py +16 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_registry.py +5 -2
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_tensor_elements_controller.py +21 -230
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_data.py +1146 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_tensor_elements_payloads.py +275 -203
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_rendering.py +290 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_tensor_elements_support.py +9 -3
- tensor_network_visualization-1.5.3/src/tensor_network_viz/config.py +112 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/contraction_viewer.py +141 -491
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_backend.py +14 -4
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/contraction_cost.py +32 -12
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/graph.py +2 -4
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/trace.py +11 -1
- tensor_network_visualization-1.5.3/src/tensor_network_viz/exceptions.py +47 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensor_elements.py +47 -4
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensor_elements_config.py +39 -8
- tensor_network_visualization-1.5.3/src/tensor_network_viz/tensorkrowch/_history.py +405 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/tensorkrowch/graph.py +40 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/viewer.py +36 -15
- tensor_network_visualization-1.5.3/tests/test_ci_workflow.py +176 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_contraction_cost.py +8 -1
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_contraction_groups_once.py +7 -0
- tensor_network_visualization-1.5.3/tests/test_contraction_scheme.py +399 -0
- tensor_network_visualization-1.5.3/tests/test_contraction_scheme_api.py +22 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_contraction_viewer.py +182 -89
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_demo_cli_scheme.py +95 -15
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_einsum_autotrace.py +27 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_engine_detection.py +54 -3
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_engineering_baseline.py +89 -45
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_examples.py +195 -10
- tensor_network_visualization-1.5.3/tests/test_integration_tensorkrowch.py +139 -0
- tensor_network_visualization-1.5.3/tests/test_interaction_controls.py +120 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_interaction_state.py +217 -165
- tensor_network_visualization-1.5.3/tests/test_logging_and_exceptions.py +129 -0
- tensor_network_visualization-1.5.3/tests/test_packaging_metadata.py +49 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_plotting.py +467 -70
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_public_api.py +68 -7
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_show_tensor_network_throughput.py +19 -2
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_tensor_elements.py +619 -41
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_tensor_elements_perf.py +19 -0
- tensor_network_visualization-1.5.3/tests/test_verify_script.py +61 -0
- tensor_network_visualization-1.5.2/src/tensor_network_viz/_core/draw/contraction_scheme.py +0 -282
- tensor_network_visualization-1.5.2/src/tensor_network_viz/_input_inspection.py +0 -157
- tensor_network_visualization-1.5.2/src/tensor_network_viz/_interaction/controller.py +0 -662
- tensor_network_visualization-1.5.2/src/tensor_network_viz/_interaction/state.py +0 -88
- tensor_network_visualization-1.5.2/src/tensor_network_viz/_tensor_elements_data.py +0 -576
- tensor_network_visualization-1.5.2/src/tensor_network_viz/config.py +0 -123
- tensor_network_visualization-1.5.2/src/tensor_network_viz/tensorkrowch/graph.py +0 -20
- tensor_network_visualization-1.5.2/tests/test_ci_workflow.py +0 -33
- tensor_network_visualization-1.5.2/tests/test_contraction_scheme.py +0 -141
- tensor_network_visualization-1.5.2/tests/test_integration_tensorkrowch.py +0 -26
- tensor_network_visualization-1.5.2/tests/test_packaging_metadata.py +0 -29
- tensor_network_visualization-1.5.2/tests/test_verify_script.py +0 -24
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/LICENSE +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/setup.cfg +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/dependency_links.txt +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/requires.txt +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/top_level.txt +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/_draw_common.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/_label_format.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/_nodes_edges_common.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/axis_directions.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/curves.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/constants.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/contraction_edges.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/disk_metrics.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/edge_orchestration.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/edges.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/fonts_and_scale.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/label_descriptors.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/labels_misc.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/pick_distance.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/vectors.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/graph_utils.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/body.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/direction_common.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/force_directed.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/free_directions_2d.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/free_directions_3d.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/geometry.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/parameters.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/types.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout_structure.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_engine_specs.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_interaction/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_matplotlib_state.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_typing.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_ui_utils.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_equation.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_trace_state.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_trace_types.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/renderer.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/interactive_viewer.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/py.typed +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/quimb/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/quimb/graph.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/quimb/renderer.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/explicit.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/graph.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/renderer.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensorkrowch/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensorkrowch/renderer.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensornetwork/__init__.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensornetwork/graph.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensornetwork/renderer.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_draw_performance.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_edge_index_label_2d.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_edge_index_label_3d.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_einsum_backend.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_examples_structure.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_graph_cache.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_integration_einsum.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_integration_tensornetwork.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_label_draw_metrics_perf.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_label_format.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_layout_core.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_lazy_imports.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_node_degrees_perf.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_quimb_backend.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_render_performance_controls.py +0 -0
- {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.3}/tests/test_tenpy_backend.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensor-network-visualization
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.3
|
|
4
4
|
Summary: Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks.
|
|
5
5
|
Author: Alejandro Mata Ali
|
|
6
6
|
License-Expression: MIT
|
|
@@ -96,6 +96,36 @@ python -m pip install tensor-network-visualization
|
|
|
96
96
|
|
|
97
97
|
Base dependencies are only `numpy`, `matplotlib`, and `networkx`.
|
|
98
98
|
|
|
99
|
+
## Documentation Map
|
|
100
|
+
|
|
101
|
+
- Start here for installation and the public API overview.
|
|
102
|
+
- Use [`docs/guide.md`](docs/guide.md) for workflow-oriented explanations.
|
|
103
|
+
- Use [`docs/backends.md`](docs/backends.md) for backend-specific copy-paste examples.
|
|
104
|
+
- Use [`examples/README.md`](examples/README.md) when you want to run the local demos from this repository.
|
|
105
|
+
|
|
106
|
+
## Errors and Logging
|
|
107
|
+
|
|
108
|
+
Public entry points now raise package-specific exceptions while remaining compatible with the
|
|
109
|
+
built-in exception families they refine:
|
|
110
|
+
|
|
111
|
+
- `VisualizationInputError`: unsupported or ambiguous network input.
|
|
112
|
+
- `AxisConfigurationError`: incompatible `ax` / `view` combinations.
|
|
113
|
+
- `UnsupportedEngineError`: unknown engine or backend name.
|
|
114
|
+
- `TensorDataError`: unsupported or missing tensor data for `show_tensor_elements(...)`.
|
|
115
|
+
- `MissingOptionalDependencyError`: missing optional backend dependency.
|
|
116
|
+
|
|
117
|
+
All of them inherit from `TensorNetworkVizError`.
|
|
118
|
+
|
|
119
|
+
The package logger name is `tensor_network_viz`. It installs a `logging.NullHandler()` by default,
|
|
120
|
+
so importing the library does not change your application's logging configuration.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
import logging
|
|
124
|
+
|
|
125
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
126
|
+
logging.getLogger("tensor_network_viz").setLevel(logging.DEBUG)
|
|
127
|
+
```
|
|
128
|
+
|
|
99
129
|
### Optional extras
|
|
100
130
|
|
|
101
131
|
| Need | Install |
|
|
@@ -127,8 +157,16 @@ python -m pip install -U pip
|
|
|
127
157
|
python -m pip install "tensor-network-visualization[quimb]"
|
|
128
158
|
```
|
|
129
159
|
|
|
160
|
+
Once the virtual environment is active, the `python ...` commands shown in the rest of this
|
|
161
|
+
README work the same way on Windows and Linux.
|
|
162
|
+
|
|
130
163
|
## The API in One Minute
|
|
131
164
|
|
|
165
|
+
`show_controls` and `show` are independent:
|
|
166
|
+
|
|
167
|
+
- `show_controls=False` disables the embedded Matplotlib widgets and slider.
|
|
168
|
+
- `show=False` skips automatic display and only returns `(fig, ax)`.
|
|
169
|
+
|
|
132
170
|
### `show_tensor_network`
|
|
133
171
|
|
|
134
172
|
Use `show_tensor_network` for figure lifecycle:
|
|
@@ -150,7 +188,7 @@ show_tensor_network(
|
|
|
150
188
|
- `view`: `"2d"` or `"3d"`. If omitted, it starts in `"2d"`.
|
|
151
189
|
- `config`: all visual behavior lives here.
|
|
152
190
|
- `ax`: render into an existing Matplotlib axis.
|
|
153
|
-
- `show_controls`: if `False`,
|
|
191
|
+
- `show_controls`: if `False`, render a static figure without the embedded control panel.
|
|
154
192
|
- `show`: if `False`, nothing is displayed automatically.
|
|
155
193
|
|
|
156
194
|
### `show_tensor_elements`
|
|
@@ -172,15 +210,22 @@ show_tensor_elements(
|
|
|
172
210
|
When several tensors are present, the figure keeps one tensor active at a time and uses a slider
|
|
173
211
|
to switch between them. The interactive controls are grouped: `basic` (`elements`, `magnitude`,
|
|
174
212
|
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
175
|
-
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`
|
|
213
|
+
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`, `singular_values`, `eigen_real`,
|
|
214
|
+
`eigen_imag`).
|
|
176
215
|
|
|
177
216
|
- `data`: single tensor, iterable of tensors, supported backend-native tensor collections, or an
|
|
178
217
|
`EinsumTrace` with live tensor values.
|
|
179
218
|
- `engine`: optional backend override. If omitted, the library auto-detects it.
|
|
180
219
|
- `config`: tensor-inspection behavior lives here.
|
|
181
|
-
- `data` mode
|
|
220
|
+
- `data` mode includes global stats, per-axis summaries, and top-k coordinates by magnitude.
|
|
221
|
+
- `singular_values` renders the singular-value spectrum for the same matrixized tensor used by the
|
|
222
|
+
heatmap views and is hidden automatically when the active tensor contains `NaN` or `Inf`.
|
|
223
|
+
- `eigen_real` and `eigen_imag` render the real and imaginary parts of the eigenvalues for the same
|
|
224
|
+
matrixized tensor, ordered by eigenvalue magnitude. They appear only when the active analysis
|
|
225
|
+
matrix is finite and square.
|
|
182
226
|
- `ax`: render a single tensor into an existing Matplotlib axis.
|
|
183
|
-
- `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
|
|
227
|
+
- `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
|
|
228
|
+
tensor slider.
|
|
184
229
|
- `show`: if `False`, nothing is displayed automatically.
|
|
185
230
|
|
|
186
231
|
### `PlotConfig`
|
|
@@ -191,11 +236,16 @@ Use `PlotConfig` for visual behavior:
|
|
|
191
236
|
from tensor_network_viz import PlotConfig
|
|
192
237
|
|
|
193
238
|
config = PlotConfig(
|
|
239
|
+
show_nodes=True,
|
|
194
240
|
show_tensor_labels=True,
|
|
195
241
|
show_index_labels=False,
|
|
196
242
|
hover_labels=True,
|
|
197
243
|
show_contraction_scheme=False,
|
|
244
|
+
contraction_scheme_cost_hover=False,
|
|
245
|
+
contraction_tensor_inspector=False,
|
|
198
246
|
tensor_label_refinement="auto",
|
|
247
|
+
tensor_label_fontsize=None,
|
|
248
|
+
edge_label_fontsize=None,
|
|
199
249
|
)
|
|
200
250
|
```
|
|
201
251
|
|
|
@@ -204,6 +254,7 @@ This is where you configure:
|
|
|
204
254
|
- labels,
|
|
205
255
|
- hover tooltips,
|
|
206
256
|
- contraction-scheme overlays,
|
|
257
|
+
- optional tensor/edge label font-size overrides,
|
|
207
258
|
- styling,
|
|
208
259
|
- layout iterations,
|
|
209
260
|
- custom positions,
|
|
@@ -219,12 +270,19 @@ from tensor_network_viz import TensorElementsConfig
|
|
|
219
270
|
|
|
220
271
|
config = TensorElementsConfig(
|
|
221
272
|
mode="auto",
|
|
273
|
+
row_axes=None,
|
|
274
|
+
col_axes=None,
|
|
275
|
+
figsize=(7.2, 6.4),
|
|
222
276
|
max_matrix_shape=(256, 256),
|
|
223
|
-
histogram_bins=40,
|
|
224
|
-
topk_count=8,
|
|
225
|
-
robust_percentiles=(1.0, 99.0),
|
|
226
277
|
shared_color_scale=False,
|
|
278
|
+
robust_percentiles=(1.0, 99.0),
|
|
227
279
|
highlight_outliers=False,
|
|
280
|
+
outlier_zscore=3.5,
|
|
281
|
+
zero_threshold=1e-12,
|
|
282
|
+
log_magnitude_floor=1e-12,
|
|
283
|
+
histogram_bins=40,
|
|
284
|
+
histogram_max_samples=100_000,
|
|
285
|
+
topk_count=8,
|
|
228
286
|
)
|
|
229
287
|
```
|
|
230
288
|
|
|
@@ -235,11 +293,13 @@ This is where you configure:
|
|
|
235
293
|
- heatmap downsampling limits,
|
|
236
294
|
- histogram sampling and bin count,
|
|
237
295
|
- data-summary depth (`topk_count`),
|
|
238
|
-
-
|
|
296
|
+
- heatmap/spectral reduction via `max_matrix_shape`,
|
|
297
|
+
- optional robust/shared scaling and outlier overlays,
|
|
298
|
+
- singular-value display floor and zero handling.
|
|
239
299
|
|
|
240
300
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
241
|
-
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
242
|
-
`mode="signed_value"` directly in
|
|
301
|
+
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
302
|
+
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`, or `mode="eigen_imag"` directly in
|
|
243
303
|
`TensorElementsConfig(...)`.
|
|
244
304
|
|
|
245
305
|
## Most Common Workflows
|
|
@@ -403,9 +463,8 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
403
463
|
| `show_tensor_labels` | Draw tensor names on nodes. |
|
|
404
464
|
| `show_index_labels` | Draw index labels on bonds and dangling legs. |
|
|
405
465
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
406
|
-
| `show_contraction_scheme` |
|
|
407
|
-
| `
|
|
408
|
-
| `contraction_scheme_cost_hover` | Show contraction details in the playback panel. |
|
|
466
|
+
| `show_contraction_scheme` | Enable the dynamic contraction slider with real node shape/color changes. |
|
|
467
|
+
| `contraction_scheme_cost_hover` | Show contraction details in the slider panel. |
|
|
409
468
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
410
469
|
| `layout_iterations` | Force-layout effort. |
|
|
411
470
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -444,6 +503,7 @@ python examples/tensor_elements_demo.py
|
|
|
444
503
|
| Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
|
|
445
504
|
| Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
|
|
446
505
|
| `Unsupported tensor network engine` | Install the matching extra or pass the correct backend object. |
|
|
506
|
+
| `AxisConfigurationError` when passing `ax` | Use a 2D axis for `view="2d"`, a 3D axis for `view="3d"`, and only pass `ax` to `show_tensor_elements(...)` for a single tensor. |
|
|
447
507
|
| `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
|
|
448
508
|
| `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
|
|
449
509
|
| Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
|
|
@@ -472,3 +532,12 @@ Run the project checks:
|
|
|
472
532
|
```powershell
|
|
473
533
|
.\.venv\Scripts\python scripts\verify.py
|
|
474
534
|
```
|
|
535
|
+
|
|
536
|
+
Useful slices:
|
|
537
|
+
|
|
538
|
+
```powershell
|
|
539
|
+
.\.venv\Scripts\python scripts\verify.py quality
|
|
540
|
+
.\.venv\Scripts\python scripts\verify.py tests
|
|
541
|
+
.\.venv\Scripts\python scripts\verify.py smoke
|
|
542
|
+
.\.venv\Scripts\python scripts\verify.py package
|
|
543
|
+
```
|
|
@@ -45,6 +45,36 @@ python -m pip install tensor-network-visualization
|
|
|
45
45
|
|
|
46
46
|
Base dependencies are only `numpy`, `matplotlib`, and `networkx`.
|
|
47
47
|
|
|
48
|
+
## Documentation Map
|
|
49
|
+
|
|
50
|
+
- Start here for installation and the public API overview.
|
|
51
|
+
- Use [`docs/guide.md`](docs/guide.md) for workflow-oriented explanations.
|
|
52
|
+
- Use [`docs/backends.md`](docs/backends.md) for backend-specific copy-paste examples.
|
|
53
|
+
- Use [`examples/README.md`](examples/README.md) when you want to run the local demos from this repository.
|
|
54
|
+
|
|
55
|
+
## Errors and Logging
|
|
56
|
+
|
|
57
|
+
Public entry points now raise package-specific exceptions while remaining compatible with the
|
|
58
|
+
built-in exception families they refine:
|
|
59
|
+
|
|
60
|
+
- `VisualizationInputError`: unsupported or ambiguous network input.
|
|
61
|
+
- `AxisConfigurationError`: incompatible `ax` / `view` combinations.
|
|
62
|
+
- `UnsupportedEngineError`: unknown engine or backend name.
|
|
63
|
+
- `TensorDataError`: unsupported or missing tensor data for `show_tensor_elements(...)`.
|
|
64
|
+
- `MissingOptionalDependencyError`: missing optional backend dependency.
|
|
65
|
+
|
|
66
|
+
All of them inherit from `TensorNetworkVizError`.
|
|
67
|
+
|
|
68
|
+
The package logger name is `tensor_network_viz`. It installs a `logging.NullHandler()` by default,
|
|
69
|
+
so importing the library does not change your application's logging configuration.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import logging
|
|
73
|
+
|
|
74
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
75
|
+
logging.getLogger("tensor_network_viz").setLevel(logging.DEBUG)
|
|
76
|
+
```
|
|
77
|
+
|
|
48
78
|
### Optional extras
|
|
49
79
|
|
|
50
80
|
| Need | Install |
|
|
@@ -76,8 +106,16 @@ python -m pip install -U pip
|
|
|
76
106
|
python -m pip install "tensor-network-visualization[quimb]"
|
|
77
107
|
```
|
|
78
108
|
|
|
109
|
+
Once the virtual environment is active, the `python ...` commands shown in the rest of this
|
|
110
|
+
README work the same way on Windows and Linux.
|
|
111
|
+
|
|
79
112
|
## The API in One Minute
|
|
80
113
|
|
|
114
|
+
`show_controls` and `show` are independent:
|
|
115
|
+
|
|
116
|
+
- `show_controls=False` disables the embedded Matplotlib widgets and slider.
|
|
117
|
+
- `show=False` skips automatic display and only returns `(fig, ax)`.
|
|
118
|
+
|
|
81
119
|
### `show_tensor_network`
|
|
82
120
|
|
|
83
121
|
Use `show_tensor_network` for figure lifecycle:
|
|
@@ -99,7 +137,7 @@ show_tensor_network(
|
|
|
99
137
|
- `view`: `"2d"` or `"3d"`. If omitted, it starts in `"2d"`.
|
|
100
138
|
- `config`: all visual behavior lives here.
|
|
101
139
|
- `ax`: render into an existing Matplotlib axis.
|
|
102
|
-
- `show_controls`: if `False`,
|
|
140
|
+
- `show_controls`: if `False`, render a static figure without the embedded control panel.
|
|
103
141
|
- `show`: if `False`, nothing is displayed automatically.
|
|
104
142
|
|
|
105
143
|
### `show_tensor_elements`
|
|
@@ -121,15 +159,22 @@ show_tensor_elements(
|
|
|
121
159
|
When several tensors are present, the figure keeps one tensor active at a time and uses a slider
|
|
122
160
|
to switch between them. The interactive controls are grouped: `basic` (`elements`, `magnitude`,
|
|
123
161
|
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
124
|
-
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`
|
|
162
|
+
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`, `singular_values`, `eigen_real`,
|
|
163
|
+
`eigen_imag`).
|
|
125
164
|
|
|
126
165
|
- `data`: single tensor, iterable of tensors, supported backend-native tensor collections, or an
|
|
127
166
|
`EinsumTrace` with live tensor values.
|
|
128
167
|
- `engine`: optional backend override. If omitted, the library auto-detects it.
|
|
129
168
|
- `config`: tensor-inspection behavior lives here.
|
|
130
|
-
- `data` mode
|
|
169
|
+
- `data` mode includes global stats, per-axis summaries, and top-k coordinates by magnitude.
|
|
170
|
+
- `singular_values` renders the singular-value spectrum for the same matrixized tensor used by the
|
|
171
|
+
heatmap views and is hidden automatically when the active tensor contains `NaN` or `Inf`.
|
|
172
|
+
- `eigen_real` and `eigen_imag` render the real and imaginary parts of the eigenvalues for the same
|
|
173
|
+
matrixized tensor, ordered by eigenvalue magnitude. They appear only when the active analysis
|
|
174
|
+
matrix is finite and square.
|
|
131
175
|
- `ax`: render a single tensor into an existing Matplotlib axis.
|
|
132
|
-
- `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
|
|
176
|
+
- `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
|
|
177
|
+
tensor slider.
|
|
133
178
|
- `show`: if `False`, nothing is displayed automatically.
|
|
134
179
|
|
|
135
180
|
### `PlotConfig`
|
|
@@ -140,11 +185,16 @@ Use `PlotConfig` for visual behavior:
|
|
|
140
185
|
from tensor_network_viz import PlotConfig
|
|
141
186
|
|
|
142
187
|
config = PlotConfig(
|
|
188
|
+
show_nodes=True,
|
|
143
189
|
show_tensor_labels=True,
|
|
144
190
|
show_index_labels=False,
|
|
145
191
|
hover_labels=True,
|
|
146
192
|
show_contraction_scheme=False,
|
|
193
|
+
contraction_scheme_cost_hover=False,
|
|
194
|
+
contraction_tensor_inspector=False,
|
|
147
195
|
tensor_label_refinement="auto",
|
|
196
|
+
tensor_label_fontsize=None,
|
|
197
|
+
edge_label_fontsize=None,
|
|
148
198
|
)
|
|
149
199
|
```
|
|
150
200
|
|
|
@@ -153,6 +203,7 @@ This is where you configure:
|
|
|
153
203
|
- labels,
|
|
154
204
|
- hover tooltips,
|
|
155
205
|
- contraction-scheme overlays,
|
|
206
|
+
- optional tensor/edge label font-size overrides,
|
|
156
207
|
- styling,
|
|
157
208
|
- layout iterations,
|
|
158
209
|
- custom positions,
|
|
@@ -168,12 +219,19 @@ from tensor_network_viz import TensorElementsConfig
|
|
|
168
219
|
|
|
169
220
|
config = TensorElementsConfig(
|
|
170
221
|
mode="auto",
|
|
222
|
+
row_axes=None,
|
|
223
|
+
col_axes=None,
|
|
224
|
+
figsize=(7.2, 6.4),
|
|
171
225
|
max_matrix_shape=(256, 256),
|
|
172
|
-
histogram_bins=40,
|
|
173
|
-
topk_count=8,
|
|
174
|
-
robust_percentiles=(1.0, 99.0),
|
|
175
226
|
shared_color_scale=False,
|
|
227
|
+
robust_percentiles=(1.0, 99.0),
|
|
176
228
|
highlight_outliers=False,
|
|
229
|
+
outlier_zscore=3.5,
|
|
230
|
+
zero_threshold=1e-12,
|
|
231
|
+
log_magnitude_floor=1e-12,
|
|
232
|
+
histogram_bins=40,
|
|
233
|
+
histogram_max_samples=100_000,
|
|
234
|
+
topk_count=8,
|
|
177
235
|
)
|
|
178
236
|
```
|
|
179
237
|
|
|
@@ -184,11 +242,13 @@ This is where you configure:
|
|
|
184
242
|
- heatmap downsampling limits,
|
|
185
243
|
- histogram sampling and bin count,
|
|
186
244
|
- data-summary depth (`topk_count`),
|
|
187
|
-
-
|
|
245
|
+
- heatmap/spectral reduction via `max_matrix_shape`,
|
|
246
|
+
- optional robust/shared scaling and outlier overlays,
|
|
247
|
+
- singular-value display floor and zero handling.
|
|
188
248
|
|
|
189
249
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
190
|
-
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
191
|
-
`mode="signed_value"` directly in
|
|
250
|
+
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
251
|
+
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`, or `mode="eigen_imag"` directly in
|
|
192
252
|
`TensorElementsConfig(...)`.
|
|
193
253
|
|
|
194
254
|
## Most Common Workflows
|
|
@@ -352,9 +412,8 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
352
412
|
| `show_tensor_labels` | Draw tensor names on nodes. |
|
|
353
413
|
| `show_index_labels` | Draw index labels on bonds and dangling legs. |
|
|
354
414
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
355
|
-
| `show_contraction_scheme` |
|
|
356
|
-
| `
|
|
357
|
-
| `contraction_scheme_cost_hover` | Show contraction details in the playback panel. |
|
|
415
|
+
| `show_contraction_scheme` | Enable the dynamic contraction slider with real node shape/color changes. |
|
|
416
|
+
| `contraction_scheme_cost_hover` | Show contraction details in the slider panel. |
|
|
358
417
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
359
418
|
| `layout_iterations` | Force-layout effort. |
|
|
360
419
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -393,6 +452,7 @@ python examples/tensor_elements_demo.py
|
|
|
393
452
|
| Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
|
|
394
453
|
| Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
|
|
395
454
|
| `Unsupported tensor network engine` | Install the matching extra or pass the correct backend object. |
|
|
455
|
+
| `AxisConfigurationError` when passing `ax` | Use a 2D axis for `view="2d"`, a 3D axis for `view="3d"`, and only pass `ax` to `show_tensor_elements(...)` for a single tensor. |
|
|
396
456
|
| `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
|
|
397
457
|
| `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
|
|
398
458
|
| Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
|
|
@@ -421,3 +481,12 @@ Run the project checks:
|
|
|
421
481
|
```powershell
|
|
422
482
|
.\.venv\Scripts\python scripts\verify.py
|
|
423
483
|
```
|
|
484
|
+
|
|
485
|
+
Useful slices:
|
|
486
|
+
|
|
487
|
+
```powershell
|
|
488
|
+
.\.venv\Scripts\python scripts\verify.py quality
|
|
489
|
+
.\.venv\Scripts\python scripts\verify.py tests
|
|
490
|
+
.\.venv\Scripts\python scripts\verify.py smoke
|
|
491
|
+
.\.venv\Scripts\python scripts\verify.py package
|
|
492
|
+
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tensor-network-visualization"
|
|
7
|
-
version = "1.5.
|
|
7
|
+
version = "1.5.3"
|
|
8
8
|
description = "Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks."
|
|
9
9
|
authors = [{ name = "Alejandro Mata Ali" }]
|
|
10
10
|
readme = "README.md"
|
|
@@ -60,7 +60,7 @@ tensor_network_viz = ["py.typed"]
|
|
|
60
60
|
|
|
61
61
|
[tool.pytest.ini_options]
|
|
62
62
|
testpaths = ["tests"]
|
|
63
|
-
addopts = "-p no:cacheprovider"
|
|
63
|
+
addopts = "-p no:cacheprovider -m \"not perf\""
|
|
64
64
|
pythonpath = ["src"]
|
|
65
65
|
markers = [
|
|
66
66
|
"perf: runtime-sensitive regression checks and throughput guards",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensor-network-visualization
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.3
|
|
4
4
|
Summary: Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks.
|
|
5
5
|
Author: Alejandro Mata Ali
|
|
6
6
|
License-Expression: MIT
|
|
@@ -96,6 +96,36 @@ python -m pip install tensor-network-visualization
|
|
|
96
96
|
|
|
97
97
|
Base dependencies are only `numpy`, `matplotlib`, and `networkx`.
|
|
98
98
|
|
|
99
|
+
## Documentation Map
|
|
100
|
+
|
|
101
|
+
- Start here for installation and the public API overview.
|
|
102
|
+
- Use [`docs/guide.md`](docs/guide.md) for workflow-oriented explanations.
|
|
103
|
+
- Use [`docs/backends.md`](docs/backends.md) for backend-specific copy-paste examples.
|
|
104
|
+
- Use [`examples/README.md`](examples/README.md) when you want to run the local demos from this repository.
|
|
105
|
+
|
|
106
|
+
## Errors and Logging
|
|
107
|
+
|
|
108
|
+
Public entry points now raise package-specific exceptions while remaining compatible with the
|
|
109
|
+
built-in exception families they refine:
|
|
110
|
+
|
|
111
|
+
- `VisualizationInputError`: unsupported or ambiguous network input.
|
|
112
|
+
- `AxisConfigurationError`: incompatible `ax` / `view` combinations.
|
|
113
|
+
- `UnsupportedEngineError`: unknown engine or backend name.
|
|
114
|
+
- `TensorDataError`: unsupported or missing tensor data for `show_tensor_elements(...)`.
|
|
115
|
+
- `MissingOptionalDependencyError`: missing optional backend dependency.
|
|
116
|
+
|
|
117
|
+
All of them inherit from `TensorNetworkVizError`.
|
|
118
|
+
|
|
119
|
+
The package logger name is `tensor_network_viz`. It installs a `logging.NullHandler()` by default,
|
|
120
|
+
so importing the library does not change your application's logging configuration.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
import logging
|
|
124
|
+
|
|
125
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
126
|
+
logging.getLogger("tensor_network_viz").setLevel(logging.DEBUG)
|
|
127
|
+
```
|
|
128
|
+
|
|
99
129
|
### Optional extras
|
|
100
130
|
|
|
101
131
|
| Need | Install |
|
|
@@ -127,8 +157,16 @@ python -m pip install -U pip
|
|
|
127
157
|
python -m pip install "tensor-network-visualization[quimb]"
|
|
128
158
|
```
|
|
129
159
|
|
|
160
|
+
Once the virtual environment is active, the `python ...` commands shown in the rest of this
|
|
161
|
+
README work the same way on Windows and Linux.
|
|
162
|
+
|
|
130
163
|
## The API in One Minute
|
|
131
164
|
|
|
165
|
+
`show_controls` and `show` are independent:
|
|
166
|
+
|
|
167
|
+
- `show_controls=False` disables the embedded Matplotlib widgets and slider.
|
|
168
|
+
- `show=False` skips automatic display and only returns `(fig, ax)`.
|
|
169
|
+
|
|
132
170
|
### `show_tensor_network`
|
|
133
171
|
|
|
134
172
|
Use `show_tensor_network` for figure lifecycle:
|
|
@@ -150,7 +188,7 @@ show_tensor_network(
|
|
|
150
188
|
- `view`: `"2d"` or `"3d"`. If omitted, it starts in `"2d"`.
|
|
151
189
|
- `config`: all visual behavior lives here.
|
|
152
190
|
- `ax`: render into an existing Matplotlib axis.
|
|
153
|
-
- `show_controls`: if `False`,
|
|
191
|
+
- `show_controls`: if `False`, render a static figure without the embedded control panel.
|
|
154
192
|
- `show`: if `False`, nothing is displayed automatically.
|
|
155
193
|
|
|
156
194
|
### `show_tensor_elements`
|
|
@@ -172,15 +210,22 @@ show_tensor_elements(
|
|
|
172
210
|
When several tensors are present, the figure keeps one tensor active at a time and uses a slider
|
|
173
211
|
to switch between them. The interactive controls are grouped: `basic` (`elements`, `magnitude`,
|
|
174
212
|
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
175
|
-
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`
|
|
213
|
+
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`, `singular_values`, `eigen_real`,
|
|
214
|
+
`eigen_imag`).
|
|
176
215
|
|
|
177
216
|
- `data`: single tensor, iterable of tensors, supported backend-native tensor collections, or an
|
|
178
217
|
`EinsumTrace` with live tensor values.
|
|
179
218
|
- `engine`: optional backend override. If omitted, the library auto-detects it.
|
|
180
219
|
- `config`: tensor-inspection behavior lives here.
|
|
181
|
-
- `data` mode
|
|
220
|
+
- `data` mode includes global stats, per-axis summaries, and top-k coordinates by magnitude.
|
|
221
|
+
- `singular_values` renders the singular-value spectrum for the same matrixized tensor used by the
|
|
222
|
+
heatmap views and is hidden automatically when the active tensor contains `NaN` or `Inf`.
|
|
223
|
+
- `eigen_real` and `eigen_imag` render the real and imaginary parts of the eigenvalues for the same
|
|
224
|
+
matrixized tensor, ordered by eigenvalue magnitude. They appear only when the active analysis
|
|
225
|
+
matrix is finite and square.
|
|
182
226
|
- `ax`: render a single tensor into an existing Matplotlib axis.
|
|
183
|
-
- `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
|
|
227
|
+
- `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
|
|
228
|
+
tensor slider.
|
|
184
229
|
- `show`: if `False`, nothing is displayed automatically.
|
|
185
230
|
|
|
186
231
|
### `PlotConfig`
|
|
@@ -191,11 +236,16 @@ Use `PlotConfig` for visual behavior:
|
|
|
191
236
|
from tensor_network_viz import PlotConfig
|
|
192
237
|
|
|
193
238
|
config = PlotConfig(
|
|
239
|
+
show_nodes=True,
|
|
194
240
|
show_tensor_labels=True,
|
|
195
241
|
show_index_labels=False,
|
|
196
242
|
hover_labels=True,
|
|
197
243
|
show_contraction_scheme=False,
|
|
244
|
+
contraction_scheme_cost_hover=False,
|
|
245
|
+
contraction_tensor_inspector=False,
|
|
198
246
|
tensor_label_refinement="auto",
|
|
247
|
+
tensor_label_fontsize=None,
|
|
248
|
+
edge_label_fontsize=None,
|
|
199
249
|
)
|
|
200
250
|
```
|
|
201
251
|
|
|
@@ -204,6 +254,7 @@ This is where you configure:
|
|
|
204
254
|
- labels,
|
|
205
255
|
- hover tooltips,
|
|
206
256
|
- contraction-scheme overlays,
|
|
257
|
+
- optional tensor/edge label font-size overrides,
|
|
207
258
|
- styling,
|
|
208
259
|
- layout iterations,
|
|
209
260
|
- custom positions,
|
|
@@ -219,12 +270,19 @@ from tensor_network_viz import TensorElementsConfig
|
|
|
219
270
|
|
|
220
271
|
config = TensorElementsConfig(
|
|
221
272
|
mode="auto",
|
|
273
|
+
row_axes=None,
|
|
274
|
+
col_axes=None,
|
|
275
|
+
figsize=(7.2, 6.4),
|
|
222
276
|
max_matrix_shape=(256, 256),
|
|
223
|
-
histogram_bins=40,
|
|
224
|
-
topk_count=8,
|
|
225
|
-
robust_percentiles=(1.0, 99.0),
|
|
226
277
|
shared_color_scale=False,
|
|
278
|
+
robust_percentiles=(1.0, 99.0),
|
|
227
279
|
highlight_outliers=False,
|
|
280
|
+
outlier_zscore=3.5,
|
|
281
|
+
zero_threshold=1e-12,
|
|
282
|
+
log_magnitude_floor=1e-12,
|
|
283
|
+
histogram_bins=40,
|
|
284
|
+
histogram_max_samples=100_000,
|
|
285
|
+
topk_count=8,
|
|
228
286
|
)
|
|
229
287
|
```
|
|
230
288
|
|
|
@@ -235,11 +293,13 @@ This is where you configure:
|
|
|
235
293
|
- heatmap downsampling limits,
|
|
236
294
|
- histogram sampling and bin count,
|
|
237
295
|
- data-summary depth (`topk_count`),
|
|
238
|
-
-
|
|
296
|
+
- heatmap/spectral reduction via `max_matrix_shape`,
|
|
297
|
+
- optional robust/shared scaling and outlier overlays,
|
|
298
|
+
- singular-value display floor and zero handling.
|
|
239
299
|
|
|
240
300
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
241
|
-
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
242
|
-
`mode="signed_value"` directly in
|
|
301
|
+
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
302
|
+
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`, or `mode="eigen_imag"` directly in
|
|
243
303
|
`TensorElementsConfig(...)`.
|
|
244
304
|
|
|
245
305
|
## Most Common Workflows
|
|
@@ -403,9 +463,8 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
403
463
|
| `show_tensor_labels` | Draw tensor names on nodes. |
|
|
404
464
|
| `show_index_labels` | Draw index labels on bonds and dangling legs. |
|
|
405
465
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
406
|
-
| `show_contraction_scheme` |
|
|
407
|
-
| `
|
|
408
|
-
| `contraction_scheme_cost_hover` | Show contraction details in the playback panel. |
|
|
466
|
+
| `show_contraction_scheme` | Enable the dynamic contraction slider with real node shape/color changes. |
|
|
467
|
+
| `contraction_scheme_cost_hover` | Show contraction details in the slider panel. |
|
|
409
468
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
410
469
|
| `layout_iterations` | Force-layout effort. |
|
|
411
470
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -444,6 +503,7 @@ python examples/tensor_elements_demo.py
|
|
|
444
503
|
| Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
|
|
445
504
|
| Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
|
|
446
505
|
| `Unsupported tensor network engine` | Install the matching extra or pass the correct backend object. |
|
|
506
|
+
| `AxisConfigurationError` when passing `ax` | Use a 2D axis for `view="2d"`, a 3D axis for `view="3d"`, and only pass `ax` to `show_tensor_elements(...)` for a single tensor. |
|
|
447
507
|
| `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
|
|
448
508
|
| `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
|
|
449
509
|
| Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
|
|
@@ -472,3 +532,12 @@ Run the project checks:
|
|
|
472
532
|
```powershell
|
|
473
533
|
.\.venv\Scripts\python scripts\verify.py
|
|
474
534
|
```
|
|
535
|
+
|
|
536
|
+
Useful slices:
|
|
537
|
+
|
|
538
|
+
```powershell
|
|
539
|
+
.\.venv\Scripts\python scripts\verify.py quality
|
|
540
|
+
.\.venv\Scripts\python scripts\verify.py tests
|
|
541
|
+
.\.venv\Scripts\python scripts\verify.py smoke
|
|
542
|
+
.\.venv\Scripts\python scripts\verify.py package
|
|
543
|
+
```
|
|
@@ -7,19 +7,24 @@ src/tensor_network_visualization.egg-info/dependency_links.txt
|
|
|
7
7
|
src/tensor_network_visualization.egg-info/requires.txt
|
|
8
8
|
src/tensor_network_visualization.egg-info/top_level.txt
|
|
9
9
|
src/tensor_network_viz/__init__.py
|
|
10
|
+
src/tensor_network_viz/_contraction_viewer_style.py
|
|
11
|
+
src/tensor_network_viz/_contraction_viewer_ui.py
|
|
10
12
|
src/tensor_network_viz/_engine_specs.py
|
|
11
13
|
src/tensor_network_viz/_input_inspection.py
|
|
12
14
|
src/tensor_network_viz/_interactive_scene.py
|
|
15
|
+
src/tensor_network_viz/_logging.py
|
|
13
16
|
src/tensor_network_viz/_matplotlib_state.py
|
|
14
17
|
src/tensor_network_viz/_registry.py
|
|
15
18
|
src/tensor_network_viz/_tensor_elements_controller.py
|
|
16
19
|
src/tensor_network_viz/_tensor_elements_data.py
|
|
17
20
|
src/tensor_network_viz/_tensor_elements_payloads.py
|
|
21
|
+
src/tensor_network_viz/_tensor_elements_rendering.py
|
|
18
22
|
src/tensor_network_viz/_tensor_elements_support.py
|
|
19
23
|
src/tensor_network_viz/_typing.py
|
|
20
24
|
src/tensor_network_viz/_ui_utils.py
|
|
21
25
|
src/tensor_network_viz/config.py
|
|
22
26
|
src/tensor_network_viz/contraction_viewer.py
|
|
27
|
+
src/tensor_network_viz/exceptions.py
|
|
23
28
|
src/tensor_network_viz/interactive_viewer.py
|
|
24
29
|
src/tensor_network_viz/py.typed
|
|
25
30
|
src/tensor_network_viz/tensor_elements.py
|
|
@@ -71,8 +76,11 @@ src/tensor_network_viz/_core/layout/types.py
|
|
|
71
76
|
src/tensor_network_viz/_interaction/__init__.py
|
|
72
77
|
src/tensor_network_viz/_interaction/bridge.py
|
|
73
78
|
src/tensor_network_viz/_interaction/controller.py
|
|
79
|
+
src/tensor_network_viz/_interaction/controls.py
|
|
74
80
|
src/tensor_network_viz/_interaction/scheme.py
|
|
75
81
|
src/tensor_network_viz/_interaction/state.py
|
|
82
|
+
src/tensor_network_viz/_interaction/tensor_inspector.py
|
|
83
|
+
src/tensor_network_viz/_interaction/views.py
|
|
76
84
|
src/tensor_network_viz/einsum_module/__init__.py
|
|
77
85
|
src/tensor_network_viz/einsum_module/_backend.py
|
|
78
86
|
src/tensor_network_viz/einsum_module/_equation.py
|
|
@@ -90,6 +98,7 @@ src/tensor_network_viz/tenpy/explicit.py
|
|
|
90
98
|
src/tensor_network_viz/tenpy/graph.py
|
|
91
99
|
src/tensor_network_viz/tenpy/renderer.py
|
|
92
100
|
src/tensor_network_viz/tensorkrowch/__init__.py
|
|
101
|
+
src/tensor_network_viz/tensorkrowch/_history.py
|
|
93
102
|
src/tensor_network_viz/tensorkrowch/graph.py
|
|
94
103
|
src/tensor_network_viz/tensorkrowch/renderer.py
|
|
95
104
|
src/tensor_network_viz/tensornetwork/__init__.py
|
|
@@ -99,6 +108,7 @@ tests/test_ci_workflow.py
|
|
|
99
108
|
tests/test_contraction_cost.py
|
|
100
109
|
tests/test_contraction_groups_once.py
|
|
101
110
|
tests/test_contraction_scheme.py
|
|
111
|
+
tests/test_contraction_scheme_api.py
|
|
102
112
|
tests/test_contraction_viewer.py
|
|
103
113
|
tests/test_demo_cli_scheme.py
|
|
104
114
|
tests/test_draw_performance.py
|
|
@@ -114,11 +124,13 @@ tests/test_graph_cache.py
|
|
|
114
124
|
tests/test_integration_einsum.py
|
|
115
125
|
tests/test_integration_tensorkrowch.py
|
|
116
126
|
tests/test_integration_tensornetwork.py
|
|
127
|
+
tests/test_interaction_controls.py
|
|
117
128
|
tests/test_interaction_state.py
|
|
118
129
|
tests/test_label_draw_metrics_perf.py
|
|
119
130
|
tests/test_label_format.py
|
|
120
131
|
tests/test_layout_core.py
|
|
121
132
|
tests/test_lazy_imports.py
|
|
133
|
+
tests/test_logging_and_exceptions.py
|
|
122
134
|
tests/test_node_degrees_perf.py
|
|
123
135
|
tests/test_packaging_metadata.py
|
|
124
136
|
tests/test_plotting.py
|