tensor-network-visualization 1.5.1__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.1/src/tensor_network_visualization.egg-info → tensor_network_visualization-1.5.3}/PKG-INFO +87 -10
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/README.md +86 -9
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/pyproject.toml +6 -4
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3/src/tensor_network_visualization.egg-info}/PKG-INFO +87 -10
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/SOURCES.txt +23 -0
- {tensor_network_visualization-1.5.1 → 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.3/src/tensor_network_viz/_core/_draw_common.py +9 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/contractions.py +114 -122
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/contraction_edges.py +3 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/draw/contraction_scheme.py +733 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/dangling_self_edges.py +60 -18
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/edge_labels.py +15 -5
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/edge_orchestration.py +7 -1
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/fonts_and_scale.py +184 -182
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/draw/graph_pipeline.py +233 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/hover.py +30 -15
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/draw/label_descriptors.py +56 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/labels_misc.py +158 -154
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/plotter.py +418 -304
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/render_prep.py +90 -11
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/scene_state.py +10 -1
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/tensors.py +81 -14
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/viewport_geometry.py +22 -1
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/graph.py +9 -4
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/graph_cache.py +171 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/direction_common.py +528 -477
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/layout/free_directions_2d.py +920 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_core/layout/free_directions_3d.py +495 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/geometry.py +21 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/positions.py +5 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/renderer.py +19 -2
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_input_inspection.py +226 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/__init__.py +3 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/bridge.py +167 -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.3/src/tensor_network_viz/_interaction/scheme.py +225 -0
- 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.3/src/tensor_network_viz/_interactive_scene.py +621 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_logging.py +16 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_matplotlib_state.py +55 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_registry.py +5 -2
- tensor_network_visualization-1.5.1/src/tensor_network_viz/tensor_elements.py → tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_controller.py +135 -192
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_data.py +1146 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_payloads.py +730 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_rendering.py +290 -0
- {tensor_network_visualization-1.5.1 → 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/_ui_utils.py +69 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/config.py +112 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/contraction_viewer.py +691 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_backend.py +14 -4
- tensor_network_visualization-1.5.3/src/tensor_network_viz/einsum_module/contraction_cost.py +170 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/graph.py +24 -11
- {tensor_network_visualization-1.5.1 → 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.3/src/tensor_network_viz/interactive_viewer.py +7 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/tensor_elements.py +142 -0
- tensor_network_visualization-1.5.3/src/tensor_network_viz/tensor_elements_config.py +91 -0
- 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.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/viewer.py +45 -94
- tensor_network_visualization-1.5.3/tests/test_ci_workflow.py +176 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_contraction_cost.py +112 -6
- {tensor_network_visualization-1.5.1 → 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.1 → tensor_network_visualization-1.5.3}/tests/test_contraction_viewer.py +218 -91
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_demo_cli_scheme.py +110 -14
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_draw_performance.py +3 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_einsum_autotrace.py +27 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_einsum_backend.py +41 -1
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_engine_detection.py +54 -3
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_engineering_baseline.py +115 -17
- tensor_network_visualization-1.5.3/tests/test_examples.py +707 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_graph_cache.py +45 -0
- 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.3/tests/test_interaction_state.py +217 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_label_draw_metrics_perf.py +3 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_layout_core.py +591 -9
- tensor_network_visualization-1.5.3/tests/test_logging_and_exceptions.py +129 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_node_degrees_perf.py +2 -0
- tensor_network_visualization-1.5.3/tests/test_packaging_metadata.py +49 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_plotting.py +873 -51
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_public_api.py +68 -6
- tensor_network_visualization-1.5.3/tests/test_show_tensor_network_throughput.py +189 -0
- tensor_network_visualization-1.5.3/tests/test_tensor_elements.py +1682 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_tensor_elements_perf.py +21 -0
- tensor_network_visualization-1.5.3/tests/test_verify_script.py +61 -0
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_core/_draw_common.py +0 -6
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_core/draw/contraction_scheme.py +0 -282
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_core/draw/graph_pipeline.py +0 -335
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_core/graph_cache.py +0 -101
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_core/layout/free_directions_2d.py +0 -493
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_core/layout/free_directions_3d.py +0 -250
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_tensor_elements_data.py +0 -474
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_tensor_elements_payloads.py +0 -573
- tensor_network_visualization-1.5.1/src/tensor_network_viz/_ui_utils.py +0 -33
- tensor_network_visualization-1.5.1/src/tensor_network_viz/config.py +0 -120
- tensor_network_visualization-1.5.1/src/tensor_network_viz/contraction_viewer.py +0 -938
- tensor_network_visualization-1.5.1/src/tensor_network_viz/einsum_module/contraction_cost.py +0 -79
- tensor_network_visualization-1.5.1/src/tensor_network_viz/interactive_viewer.py +0 -572
- tensor_network_visualization-1.5.1/src/tensor_network_viz/tensor_elements_config.py +0 -34
- tensor_network_visualization-1.5.1/src/tensor_network_viz/tensorkrowch/graph.py +0 -20
- tensor_network_visualization-1.5.1/tests/test_ci_workflow.py +0 -26
- tensor_network_visualization-1.5.1/tests/test_contraction_scheme.py +0 -141
- tensor_network_visualization-1.5.1/tests/test_examples.py +0 -342
- tensor_network_visualization-1.5.1/tests/test_integration_tensorkrowch.py +0 -26
- tensor_network_visualization-1.5.1/tests/test_packaging_metadata.py +0 -29
- tensor_network_visualization-1.5.1/tests/test_show_tensor_network_throughput.py +0 -57
- tensor_network_visualization-1.5.1/tests/test_tensor_elements.py +0 -634
- tensor_network_visualization-1.5.1/tests/test_verify_script.py +0 -24
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/LICENSE +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/setup.cfg +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/dependency_links.txt +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/requires.txt +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_visualization.egg-info/top_level.txt +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/_label_format.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/_nodes_edges_common.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/axis_directions.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/curves.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/constants.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/disk_metrics.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/edges.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/pick_distance.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/draw/vectors.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/graph_utils.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/body.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/force_directed.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/parameters.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout/types.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_core/layout_structure.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_engine_specs.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/_typing.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_equation.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_trace_state.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/_trace_types.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/einsum_module/renderer.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/py.typed +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/quimb/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/quimb/graph.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/quimb/renderer.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/explicit.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/graph.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tenpy/renderer.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensorkrowch/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensorkrowch/renderer.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensornetwork/__init__.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensornetwork/graph.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/src/tensor_network_viz/tensornetwork/renderer.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_edge_index_label_2d.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_edge_index_label_3d.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_examples_structure.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_integration_einsum.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_integration_tensornetwork.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_label_format.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_lazy_imports.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_quimb_backend.py +0 -0
- {tensor_network_visualization-1.5.1 → tensor_network_visualization-1.5.3}/tests/test_render_performance_controls.py +0 -0
- {tensor_network_visualization-1.5.1 → 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`
|
|
@@ -171,15 +209,23 @@ show_tensor_elements(
|
|
|
171
209
|
|
|
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
|
-
`distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
175
|
-
`signed_value`
|
|
212
|
+
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
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.
|
|
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.
|
|
181
226
|
- `ax`: render a single tensor into an existing Matplotlib axis.
|
|
182
|
-
- `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.
|
|
183
229
|
- `show`: if `False`, nothing is displayed automatically.
|
|
184
230
|
|
|
185
231
|
### `PlotConfig`
|
|
@@ -190,11 +236,16 @@ Use `PlotConfig` for visual behavior:
|
|
|
190
236
|
from tensor_network_viz import PlotConfig
|
|
191
237
|
|
|
192
238
|
config = PlotConfig(
|
|
239
|
+
show_nodes=True,
|
|
193
240
|
show_tensor_labels=True,
|
|
194
241
|
show_index_labels=False,
|
|
195
242
|
hover_labels=True,
|
|
196
243
|
show_contraction_scheme=False,
|
|
244
|
+
contraction_scheme_cost_hover=False,
|
|
245
|
+
contraction_tensor_inspector=False,
|
|
197
246
|
tensor_label_refinement="auto",
|
|
247
|
+
tensor_label_fontsize=None,
|
|
248
|
+
edge_label_fontsize=None,
|
|
198
249
|
)
|
|
199
250
|
```
|
|
200
251
|
|
|
@@ -203,6 +254,7 @@ This is where you configure:
|
|
|
203
254
|
- labels,
|
|
204
255
|
- hover tooltips,
|
|
205
256
|
- contraction-scheme overlays,
|
|
257
|
+
- optional tensor/edge label font-size overrides,
|
|
206
258
|
- styling,
|
|
207
259
|
- layout iterations,
|
|
208
260
|
- custom positions,
|
|
@@ -218,8 +270,19 @@ from tensor_network_viz import TensorElementsConfig
|
|
|
218
270
|
|
|
219
271
|
config = TensorElementsConfig(
|
|
220
272
|
mode="auto",
|
|
273
|
+
row_axes=None,
|
|
274
|
+
col_axes=None,
|
|
275
|
+
figsize=(7.2, 6.4),
|
|
221
276
|
max_matrix_shape=(256, 256),
|
|
277
|
+
shared_color_scale=False,
|
|
278
|
+
robust_percentiles=(1.0, 99.0),
|
|
279
|
+
highlight_outliers=False,
|
|
280
|
+
outlier_zscore=3.5,
|
|
281
|
+
zero_threshold=1e-12,
|
|
282
|
+
log_magnitude_floor=1e-12,
|
|
222
283
|
histogram_bins=40,
|
|
284
|
+
histogram_max_samples=100_000,
|
|
285
|
+
topk_count=8,
|
|
223
286
|
)
|
|
224
287
|
```
|
|
225
288
|
|
|
@@ -228,10 +291,15 @@ This is where you configure:
|
|
|
228
291
|
- the active inspection mode,
|
|
229
292
|
- row/column axis grouping for rank > 2 tensors,
|
|
230
293
|
- heatmap downsampling limits,
|
|
231
|
-
- histogram sampling and bin count
|
|
294
|
+
- histogram sampling and bin count,
|
|
295
|
+
- data-summary depth (`topk_count`),
|
|
296
|
+
- heatmap/spectral reduction via `max_matrix_shape`,
|
|
297
|
+
- optional robust/shared scaling and outlier overlays,
|
|
298
|
+
- singular-value display floor and zero handling.
|
|
232
299
|
|
|
233
300
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
234
|
-
`mode="phase"`, `mode="
|
|
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
|
|
235
303
|
`TensorElementsConfig(...)`.
|
|
236
304
|
|
|
237
305
|
## Most Common Workflows
|
|
@@ -395,9 +463,8 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
395
463
|
| `show_tensor_labels` | Draw tensor names on nodes. |
|
|
396
464
|
| `show_index_labels` | Draw index labels on bonds and dangling legs. |
|
|
397
465
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
398
|
-
| `show_contraction_scheme` |
|
|
399
|
-
| `
|
|
400
|
-
| `contraction_scheme_cost_hover` | Show cost tooltip on scheme regions. |
|
|
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. |
|
|
401
468
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
402
469
|
| `layout_iterations` | Force-layout effort. |
|
|
403
470
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -436,6 +503,7 @@ python examples/tensor_elements_demo.py
|
|
|
436
503
|
| Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
|
|
437
504
|
| Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
|
|
438
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. |
|
|
439
507
|
| `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
|
|
440
508
|
| `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
|
|
441
509
|
| Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
|
|
@@ -464,3 +532,12 @@ Run the project checks:
|
|
|
464
532
|
```powershell
|
|
465
533
|
.\.venv\Scripts\python scripts\verify.py
|
|
466
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`
|
|
@@ -120,15 +158,23 @@ show_tensor_elements(
|
|
|
120
158
|
|
|
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
|
-
`distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
124
|
-
`signed_value`
|
|
161
|
+
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
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.
|
|
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.
|
|
130
175
|
- `ax`: render a single tensor into an existing Matplotlib axis.
|
|
131
|
-
- `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.
|
|
132
178
|
- `show`: if `False`, nothing is displayed automatically.
|
|
133
179
|
|
|
134
180
|
### `PlotConfig`
|
|
@@ -139,11 +185,16 @@ Use `PlotConfig` for visual behavior:
|
|
|
139
185
|
from tensor_network_viz import PlotConfig
|
|
140
186
|
|
|
141
187
|
config = PlotConfig(
|
|
188
|
+
show_nodes=True,
|
|
142
189
|
show_tensor_labels=True,
|
|
143
190
|
show_index_labels=False,
|
|
144
191
|
hover_labels=True,
|
|
145
192
|
show_contraction_scheme=False,
|
|
193
|
+
contraction_scheme_cost_hover=False,
|
|
194
|
+
contraction_tensor_inspector=False,
|
|
146
195
|
tensor_label_refinement="auto",
|
|
196
|
+
tensor_label_fontsize=None,
|
|
197
|
+
edge_label_fontsize=None,
|
|
147
198
|
)
|
|
148
199
|
```
|
|
149
200
|
|
|
@@ -152,6 +203,7 @@ This is where you configure:
|
|
|
152
203
|
- labels,
|
|
153
204
|
- hover tooltips,
|
|
154
205
|
- contraction-scheme overlays,
|
|
206
|
+
- optional tensor/edge label font-size overrides,
|
|
155
207
|
- styling,
|
|
156
208
|
- layout iterations,
|
|
157
209
|
- custom positions,
|
|
@@ -167,8 +219,19 @@ from tensor_network_viz import TensorElementsConfig
|
|
|
167
219
|
|
|
168
220
|
config = TensorElementsConfig(
|
|
169
221
|
mode="auto",
|
|
222
|
+
row_axes=None,
|
|
223
|
+
col_axes=None,
|
|
224
|
+
figsize=(7.2, 6.4),
|
|
170
225
|
max_matrix_shape=(256, 256),
|
|
226
|
+
shared_color_scale=False,
|
|
227
|
+
robust_percentiles=(1.0, 99.0),
|
|
228
|
+
highlight_outliers=False,
|
|
229
|
+
outlier_zscore=3.5,
|
|
230
|
+
zero_threshold=1e-12,
|
|
231
|
+
log_magnitude_floor=1e-12,
|
|
171
232
|
histogram_bins=40,
|
|
233
|
+
histogram_max_samples=100_000,
|
|
234
|
+
topk_count=8,
|
|
172
235
|
)
|
|
173
236
|
```
|
|
174
237
|
|
|
@@ -177,10 +240,15 @@ This is where you configure:
|
|
|
177
240
|
- the active inspection mode,
|
|
178
241
|
- row/column axis grouping for rank > 2 tensors,
|
|
179
242
|
- heatmap downsampling limits,
|
|
180
|
-
- histogram sampling and bin count
|
|
243
|
+
- histogram sampling and bin count,
|
|
244
|
+
- data-summary depth (`topk_count`),
|
|
245
|
+
- heatmap/spectral reduction via `max_matrix_shape`,
|
|
246
|
+
- optional robust/shared scaling and outlier overlays,
|
|
247
|
+
- singular-value display floor and zero handling.
|
|
181
248
|
|
|
182
249
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
183
|
-
`mode="phase"`, `mode="
|
|
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
|
|
184
252
|
`TensorElementsConfig(...)`.
|
|
185
253
|
|
|
186
254
|
## Most Common Workflows
|
|
@@ -344,9 +412,8 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
344
412
|
| `show_tensor_labels` | Draw tensor names on nodes. |
|
|
345
413
|
| `show_index_labels` | Draw index labels on bonds and dangling legs. |
|
|
346
414
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
347
|
-
| `show_contraction_scheme` |
|
|
348
|
-
| `
|
|
349
|
-
| `contraction_scheme_cost_hover` | Show cost tooltip on scheme regions. |
|
|
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. |
|
|
350
417
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
351
418
|
| `layout_iterations` | Force-layout effort. |
|
|
352
419
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -385,6 +452,7 @@ python examples/tensor_elements_demo.py
|
|
|
385
452
|
| Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
|
|
386
453
|
| Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
|
|
387
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. |
|
|
388
456
|
| `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
|
|
389
457
|
| `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
|
|
390
458
|
| Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
|
|
@@ -413,3 +481,12 @@ Run the project checks:
|
|
|
413
481
|
```powershell
|
|
414
482
|
.\.venv\Scripts\python scripts\verify.py
|
|
415
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,8 +60,12 @@ 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
|
+
markers = [
|
|
66
|
+
"perf: runtime-sensitive regression checks and throughput guards",
|
|
67
|
+
"smoke: lightweight render smoke checks",
|
|
68
|
+
]
|
|
65
69
|
|
|
66
70
|
[tool.ruff]
|
|
67
71
|
line-length = 100
|
|
@@ -77,6 +81,4 @@ select = ["E", "F", "I", "B", "UP", "C4", "SIM", "RUF100"]
|
|
|
77
81
|
"examples/**/*.py" = ["E402"]
|
|
78
82
|
# Repo-root bench helpers insert ``src`` on sys.path before third-party imports.
|
|
79
83
|
"scripts/**/*.py" = ["E402"]
|
|
80
|
-
# Draw/layout splits mirror the old monolith: submodule star-import of tuning constants.
|
|
81
|
-
"src/tensor_network_viz/_core/draw/*.py" = ["F403", "F405"]
|
|
82
84
|
"src/tensor_network_viz/_core/layout/body.py" = ["F403", "F405"]
|
|
@@ -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`
|
|
@@ -171,15 +209,23 @@ show_tensor_elements(
|
|
|
171
209
|
|
|
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
|
-
`distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
175
|
-
`signed_value`
|
|
212
|
+
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
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.
|
|
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.
|
|
181
226
|
- `ax`: render a single tensor into an existing Matplotlib axis.
|
|
182
|
-
- `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.
|
|
183
229
|
- `show`: if `False`, nothing is displayed automatically.
|
|
184
230
|
|
|
185
231
|
### `PlotConfig`
|
|
@@ -190,11 +236,16 @@ Use `PlotConfig` for visual behavior:
|
|
|
190
236
|
from tensor_network_viz import PlotConfig
|
|
191
237
|
|
|
192
238
|
config = PlotConfig(
|
|
239
|
+
show_nodes=True,
|
|
193
240
|
show_tensor_labels=True,
|
|
194
241
|
show_index_labels=False,
|
|
195
242
|
hover_labels=True,
|
|
196
243
|
show_contraction_scheme=False,
|
|
244
|
+
contraction_scheme_cost_hover=False,
|
|
245
|
+
contraction_tensor_inspector=False,
|
|
197
246
|
tensor_label_refinement="auto",
|
|
247
|
+
tensor_label_fontsize=None,
|
|
248
|
+
edge_label_fontsize=None,
|
|
198
249
|
)
|
|
199
250
|
```
|
|
200
251
|
|
|
@@ -203,6 +254,7 @@ This is where you configure:
|
|
|
203
254
|
- labels,
|
|
204
255
|
- hover tooltips,
|
|
205
256
|
- contraction-scheme overlays,
|
|
257
|
+
- optional tensor/edge label font-size overrides,
|
|
206
258
|
- styling,
|
|
207
259
|
- layout iterations,
|
|
208
260
|
- custom positions,
|
|
@@ -218,8 +270,19 @@ from tensor_network_viz import TensorElementsConfig
|
|
|
218
270
|
|
|
219
271
|
config = TensorElementsConfig(
|
|
220
272
|
mode="auto",
|
|
273
|
+
row_axes=None,
|
|
274
|
+
col_axes=None,
|
|
275
|
+
figsize=(7.2, 6.4),
|
|
221
276
|
max_matrix_shape=(256, 256),
|
|
277
|
+
shared_color_scale=False,
|
|
278
|
+
robust_percentiles=(1.0, 99.0),
|
|
279
|
+
highlight_outliers=False,
|
|
280
|
+
outlier_zscore=3.5,
|
|
281
|
+
zero_threshold=1e-12,
|
|
282
|
+
log_magnitude_floor=1e-12,
|
|
222
283
|
histogram_bins=40,
|
|
284
|
+
histogram_max_samples=100_000,
|
|
285
|
+
topk_count=8,
|
|
223
286
|
)
|
|
224
287
|
```
|
|
225
288
|
|
|
@@ -228,10 +291,15 @@ This is where you configure:
|
|
|
228
291
|
- the active inspection mode,
|
|
229
292
|
- row/column axis grouping for rank > 2 tensors,
|
|
230
293
|
- heatmap downsampling limits,
|
|
231
|
-
- histogram sampling and bin count
|
|
294
|
+
- histogram sampling and bin count,
|
|
295
|
+
- data-summary depth (`topk_count`),
|
|
296
|
+
- heatmap/spectral reduction via `max_matrix_shape`,
|
|
297
|
+
- optional robust/shared scaling and outlier overlays,
|
|
298
|
+
- singular-value display floor and zero handling.
|
|
232
299
|
|
|
233
300
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
234
|
-
`mode="phase"`, `mode="
|
|
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
|
|
235
303
|
`TensorElementsConfig(...)`.
|
|
236
304
|
|
|
237
305
|
## Most Common Workflows
|
|
@@ -395,9 +463,8 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
395
463
|
| `show_tensor_labels` | Draw tensor names on nodes. |
|
|
396
464
|
| `show_index_labels` | Draw index labels on bonds and dangling legs. |
|
|
397
465
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
398
|
-
| `show_contraction_scheme` |
|
|
399
|
-
| `
|
|
400
|
-
| `contraction_scheme_cost_hover` | Show cost tooltip on scheme regions. |
|
|
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. |
|
|
401
468
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
402
469
|
| `layout_iterations` | Force-layout effort. |
|
|
403
470
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -436,6 +503,7 @@ python examples/tensor_elements_demo.py
|
|
|
436
503
|
| Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
|
|
437
504
|
| Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
|
|
438
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. |
|
|
439
507
|
| `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
|
|
440
508
|
| `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
|
|
441
509
|
| Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
|
|
@@ -464,3 +532,12 @@ Run the project checks:
|
|
|
464
532
|
```powershell
|
|
465
533
|
.\.venv\Scripts\python scripts\verify.py
|
|
466
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,15 +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
|
|
13
|
+
src/tensor_network_viz/_input_inspection.py
|
|
14
|
+
src/tensor_network_viz/_interactive_scene.py
|
|
15
|
+
src/tensor_network_viz/_logging.py
|
|
16
|
+
src/tensor_network_viz/_matplotlib_state.py
|
|
11
17
|
src/tensor_network_viz/_registry.py
|
|
18
|
+
src/tensor_network_viz/_tensor_elements_controller.py
|
|
12
19
|
src/tensor_network_viz/_tensor_elements_data.py
|
|
13
20
|
src/tensor_network_viz/_tensor_elements_payloads.py
|
|
21
|
+
src/tensor_network_viz/_tensor_elements_rendering.py
|
|
14
22
|
src/tensor_network_viz/_tensor_elements_support.py
|
|
15
23
|
src/tensor_network_viz/_typing.py
|
|
16
24
|
src/tensor_network_viz/_ui_utils.py
|
|
17
25
|
src/tensor_network_viz/config.py
|
|
18
26
|
src/tensor_network_viz/contraction_viewer.py
|
|
27
|
+
src/tensor_network_viz/exceptions.py
|
|
19
28
|
src/tensor_network_viz/interactive_viewer.py
|
|
20
29
|
src/tensor_network_viz/py.typed
|
|
21
30
|
src/tensor_network_viz/tensor_elements.py
|
|
@@ -45,6 +54,7 @@ src/tensor_network_viz/_core/draw/edges.py
|
|
|
45
54
|
src/tensor_network_viz/_core/draw/fonts_and_scale.py
|
|
46
55
|
src/tensor_network_viz/_core/draw/graph_pipeline.py
|
|
47
56
|
src/tensor_network_viz/_core/draw/hover.py
|
|
57
|
+
src/tensor_network_viz/_core/draw/label_descriptors.py
|
|
48
58
|
src/tensor_network_viz/_core/draw/labels_misc.py
|
|
49
59
|
src/tensor_network_viz/_core/draw/pick_distance.py
|
|
50
60
|
src/tensor_network_viz/_core/draw/plotter.py
|
|
@@ -63,6 +73,14 @@ src/tensor_network_viz/_core/layout/geometry.py
|
|
|
63
73
|
src/tensor_network_viz/_core/layout/parameters.py
|
|
64
74
|
src/tensor_network_viz/_core/layout/positions.py
|
|
65
75
|
src/tensor_network_viz/_core/layout/types.py
|
|
76
|
+
src/tensor_network_viz/_interaction/__init__.py
|
|
77
|
+
src/tensor_network_viz/_interaction/bridge.py
|
|
78
|
+
src/tensor_network_viz/_interaction/controller.py
|
|
79
|
+
src/tensor_network_viz/_interaction/controls.py
|
|
80
|
+
src/tensor_network_viz/_interaction/scheme.py
|
|
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
|
|
66
84
|
src/tensor_network_viz/einsum_module/__init__.py
|
|
67
85
|
src/tensor_network_viz/einsum_module/_backend.py
|
|
68
86
|
src/tensor_network_viz/einsum_module/_equation.py
|
|
@@ -80,6 +98,7 @@ src/tensor_network_viz/tenpy/explicit.py
|
|
|
80
98
|
src/tensor_network_viz/tenpy/graph.py
|
|
81
99
|
src/tensor_network_viz/tenpy/renderer.py
|
|
82
100
|
src/tensor_network_viz/tensorkrowch/__init__.py
|
|
101
|
+
src/tensor_network_viz/tensorkrowch/_history.py
|
|
83
102
|
src/tensor_network_viz/tensorkrowch/graph.py
|
|
84
103
|
src/tensor_network_viz/tensorkrowch/renderer.py
|
|
85
104
|
src/tensor_network_viz/tensornetwork/__init__.py
|
|
@@ -89,6 +108,7 @@ tests/test_ci_workflow.py
|
|
|
89
108
|
tests/test_contraction_cost.py
|
|
90
109
|
tests/test_contraction_groups_once.py
|
|
91
110
|
tests/test_contraction_scheme.py
|
|
111
|
+
tests/test_contraction_scheme_api.py
|
|
92
112
|
tests/test_contraction_viewer.py
|
|
93
113
|
tests/test_demo_cli_scheme.py
|
|
94
114
|
tests/test_draw_performance.py
|
|
@@ -104,10 +124,13 @@ tests/test_graph_cache.py
|
|
|
104
124
|
tests/test_integration_einsum.py
|
|
105
125
|
tests/test_integration_tensorkrowch.py
|
|
106
126
|
tests/test_integration_tensornetwork.py
|
|
127
|
+
tests/test_interaction_controls.py
|
|
128
|
+
tests/test_interaction_state.py
|
|
107
129
|
tests/test_label_draw_metrics_perf.py
|
|
108
130
|
tests/test_label_format.py
|
|
109
131
|
tests/test_layout_core.py
|
|
110
132
|
tests/test_lazy_imports.py
|
|
133
|
+
tests/test_logging_and_exceptions.py
|
|
111
134
|
tests/test_node_degrees_perf.py
|
|
112
135
|
tests/test_packaging_metadata.py
|
|
113
136
|
tests/test_plotting.py
|