Python library for Operator Product Expansion calculations in Vertex Operator Algebras
Project description
PyOPE
PyOPE is a Python library for symbolic Operator Product Expansion (OPE) calculations in Vertex Operator Algebras (VOA) and 2d Conformal Field Theory (CFT).
It is built on top of Python and SymPy, with the goal of providing a programmable, testable, and extensible environment for OPE computations while staying close to the Mathematica reference implementation OPEdefs.m.
Status
- Version:
0.2.0 - Development status: Alpha
- Python:
>=3.8 - Main dependencies:
sympy,numpy
The project currently supports:
- Registration and evaluation of OPEs between basic generators
- OPE rules for derivatives, linear combinations, and normal-ordered operators
- Construction and simplification of
NO(...)andnormal_product(...) - Extraction of pole coefficients via
bracket(A, B, n) - Jacobi identity checks
- A set of experimental tools for C2 spaces, realizations, and null-state searches
The C2, null-state, and realization-related interfaces are still evolving and may change in later releases.
Installation
Install from PyPI:
pip install pyope-voa
The distribution name is pyope-voa, but the import name remains:
import pyope
Install from source:
pip install -e .
Install development dependencies:
pip install -e ".[dev]"
Install notebook-related dependencies:
pip install -e ".[jupyter]"
Quick Start
Here is a minimal Virasoro example defining the OPE of $T(z)T(w)$:
import sympy as sp
from pyope import BasicOperator, Bosonic, MakeOPE, OPE
from pyope import One, Zero, NO, bracket, d
T = BasicOperator("T", conformal_weight=2)
Bosonic(T)
c = sp.Symbol("c")
OPE[T, T] = MakeOPE(
[
sp.Rational(1, 2) * c * One,
Zero,
2 * T,
d(T),
]
)
tt = OPE(T, T)
print("max pole =", tt.max_pole)
print("{TT}_4 =", bracket(T, T, 4))
print("{TT}_2 =", bracket(T, T, 2))
print("(TT) =", NO(T, T))
MakeOPE([...]) follows the same convention as the Mathematica package: entries are listed from the highest pole down to the $(z-w)^{-1}$ term.
In the example above, the list corresponds to:
- the $(z-w)^{-4}$ coefficient
- the $(z-w)^{-3}$ coefficient
- the $(z-w)^{-2}$ coefficient
- the $(z-w)^{-1}$ coefficient
Core Concepts
1. Basis operators
In typical usage, you first define generators and then declare their statistics:
from pyope import BasicOperator, Bosonic
J = BasicOperator("J", conformal_weight=1)
Bosonic(J)
2. Registering OPE data
Define an OPE with:
OPE[A, B] = MakeOPE([...])
Evaluate it with:
result = OPE(A, B)
The result is an OPEData object, and individual poles can be accessed with .pole(n).
3. Normal-ordered products
PyOPE intentionally rejects direct multiplication such as A * B for local operators, to avoid confusing VOA operator syntax with ordinary multiplication.
Use one of the following instead:
NO(A, B)normal_product(A, B, C, ...)
Example:
from pyope import BasicOperator, Bosonic, normal_product, simplify
A = BasicOperator("A")
B = BasicOperator("B")
Bosonic(A, B)
expr = normal_product(B, A, B)
print(simplify(expr))
4. Derivatives and brackets
d(A)denotes the first derivativedn(n, A)denotes the $n$th derivativebracket(A, B, n)extracts the $n$th bracket / pole coefficient
from pyope import bracket, d, dn
print(bracket(T, T, 4))
print(bracket(d(T), T, 3))
print(dn(2, T))
5. Jacobi identity checks
from pyope import verify_jacobi_identity
print(verify_jacobi_identity(T, T, T))
Available API
Frequently used public interfaces include:
OPE,MakeOPE,NO,NO_product,normal_product,bracketBasicOperator,Operator,d,dnOne,Zero,Deltasimplifycheck_jacobi_identity,verify_jacobi_identity
The package also exports a number of more research-oriented and experimental tools, including:
C2Space,C2NullSearcher,GenericC2ReducerDescendantSpaceSingularVectorAnalyzerRealizationBackendand related realization helpers
For the full export list, see src/pyope/__init__.py.
Examples And References
The repository already contains a number of examples and reference materials:
- GitHub repository: https://github.com/panyw5/pyope
- Demos and notebooks: https://github.com/panyw5/pyope/tree/main/demo
- Test framework notes: https://github.com/panyw5/pyope/blob/main/tests/TEST_FRAMEWORK.md
- Mathematica reference materials: https://github.com/panyw5/pyope/tree/main/OPEdefs
Current examples cover:
- Virasoro
- Kac-Moody
- Jacobi identities
- Several W-algebra and null-state experiments
Running Tests
Run the full test suite:
python -m pytest
Run only Mathematica-reference tests:
python -m pytest -m mathematica_ref
Skip slow tests:
python -m pytest -m "not slow"
Packaging Notes
The current PyPI release is centered on the core package under src/pyope.
- the
wheelcontains the core library and package metadata - notebooks,
.wlsfiles, and temporary research scripts are not included in the current wheel
That means users installing with pip install pyope-voa get the core library rather than the full research repository.
Citation And Background
- K. Thielemans, "An Algorithmic Approach to Operator Product Expansions, W-algebras and W-strings", arXiv:hep-th/9506159
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyope_voa-0.2.0.tar.gz.
File metadata
- Download URL: pyope_voa-0.2.0.tar.gz
- Upload date:
- Size: 87.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d5c4a3b1dc25abd51aa89a15b9f61c397ac666edcbc91ea172bceb916e5b004
|
|
| MD5 |
c097294f7720ea9f77be09cc7728c72b
|
|
| BLAKE2b-256 |
2cbee6ad38d8a4bad32ed27a3b0a31eb8255ed01040a4661b97ba8e2b5186710
|
File details
Details for the file pyope_voa-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyope_voa-0.2.0-py3-none-any.whl
- Upload date:
- Size: 98.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ae8bbf93e926a966ae522a13e598d0fb4e673d8429a465cfe59eb66c3cb840b
|
|
| MD5 |
b8717f8ac77f26c177f6ed14140b9661
|
|
| BLAKE2b-256 |
f822f2d3fdf83e2c776c7f52d0d8f3b0a79d4be2a76342789843603afbe95070
|