TNSP-bridge is a tool used to facilitate the conversion of tensor data from the format of the old TNSP to TAT format. It's important to note that different versions of TNSP may have variations in their data structures, but this specific subproject focuses on compatibility with TNSP version 4. And we support the conversion of non-symmetry tensors and boson/fermion (Z(2)) / (U(1)) symmetry tensors of various scalar types.
Install
Please either copy or create a soft link for the directory in the site-packages directory.
Alternatively, users can utilize pip to install the TNSP-bridge package by running the command pip install tnsp_bridge.
Documents
The only function is bridge, which accepts a function that extracts the old version tensor data line by line and returns the tensor in the new version.
For example, here is the old version of the data:
T T T T
readable_data T
2 8 3 0
1 4 8
3 7 8
1.00000000 2.00000000 3.00000000 -1.00000000 -2.00000000 -3.00000000 -4.00000000 0.00000000
End_data
readable_data T
1 8 3 0
1 4 8
3 7 8
3 2 1 1 2 2 1 1
End_data
readable_data T
1 6 2 0
1 4
3 6
3 4 1 -1 -1 1
End_data
A1_1.D A1_1.R A1_1.n
readable_data T
3 9 12 0
1 22049 0 0 4 538976288 538976288 538976288 8 538976288 538976288 538976288
3 0 0 0 7 0 0 0 9 0 0 0
0.23446911431164341 0.13002435022579403 -3.1842370052190448E-002 0.45356268067516309 -1.4087785231172337E-002 -9.0396315774136524E-002 -2.0732171027595565E-002 -0.35235299284206140 -1.2456779139446277E-002
End_data
EOF
The code below converts the aforementioned data,
stored in the string variable named example_data, to the new version format:
from bridge import bridge
data_line_by_line = example_data.split("\n")
data_line_by_line.reverse()
print(bridge(data_line_by_line.pop, compat=True, parity=False))
{names:[A1_1.n,A1_1.R,A1_1.D],edges:[{arrow:0,segment:{0:1}},{arrow:1,segment:{-1:1,-2:2,-3:2,-4:1}},{arrow:1,segment:{1:3,2:2,3:1}}],blocks:{[0,-1,1]:[0.234469,0.130024,-0.0318424],[0,-2,2]:[0.453563,-0.0140878,-0.0903963,-0.0207322],[0,-3,3]:[-0.352353,-0.0124568]}}
The function bridge has two optional arguments.
The first one is parity, used to distinguish the symmetry group of a symmetry tensor.
When parity is set to False (default), it should be a fermion or boson (U(1)) symmetry tensor.
If set to True, a fermion or boson (Z(1)) symmetry tensor is considered.
The second argument is compat, which distinguishes the version in the old TNSP.
Within old TNSP, there are two data formats: the older one is processed when compat is set to True, and the newer one if set to False (default).
Metadata
Release files for tnsp-bridge 0.3.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tnsp_bridge-0.3.17-py3-none-any.whl | Python 3 | none | any | Details for tnsp_bridge-0.3.17-py3-none-any.whl |
Release files / tnsp_bridge-0.3.17-py3-none-any.whl
| Download URL | tnsp_bridge-0.3.17-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7c65d213bbf8dfd3f5b5442d39eb365a4243fc721bcf1efcf1a4f9c926904f3
|
|
BLAKE2b-256 checksum How to use checksums |
27cad1eb2ba0bbfd9cb7cc511457f88e0787f039d4654882bb5aeab930e8b179
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for tnsp-bridge 0.3.17
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.