myqcd 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- myqcd-0.1.0/LICENSE +21 -0
- myqcd-0.1.0/MANIFEST.in +11 -0
- myqcd-0.1.0/PKG-INFO +96 -0
- myqcd-0.1.0/README.md +65 -0
- myqcd-0.1.0/myqcd/__init__.py +235 -0
- myqcd-0.1.0/myqcd/__main__.py +4 -0
- myqcd-0.1.0/myqcd/audit.py +213 -0
- myqcd-0.1.0/myqcd/color.py +216 -0
- myqcd-0.1.0/myqcd/derivations.py +13109 -0
- myqcd-0.1.0/myqcd/diagram_export.py +195 -0
- myqcd-0.1.0/myqcd/feynman.py +364 -0
- myqcd-0.1.0/myqcd/formula_registry.py +785 -0
- myqcd-0.1.0/myqcd/gamma.py +394 -0
- myqcd-0.1.0/myqcd/latex_inventory.py +333 -0
- myqcd-0.1.0/myqcd/operator_audit.py +209 -0
- myqcd-0.1.0/myqcd/operators.py +302 -0
- myqcd-0.1.0/myqcd/py.typed +0 -0
- myqcd-0.1.0/myqcd/pyqcd_theory_audit.py +897 -0
- myqcd-0.1.0/myqcd/wick.py +199 -0
- myqcd-0.1.0/myqcd.egg-info/PKG-INFO +96 -0
- myqcd-0.1.0/myqcd.egg-info/SOURCES.txt +25 -0
- myqcd-0.1.0/myqcd.egg-info/dependency_links.txt +1 -0
- myqcd-0.1.0/myqcd.egg-info/entry_points.txt +2 -0
- myqcd-0.1.0/myqcd.egg-info/requires.txt +4 -0
- myqcd-0.1.0/myqcd.egg-info/top_level.txt +1 -0
- myqcd-0.1.0/pyproject.toml +55 -0
- myqcd-0.1.0/setup.cfg +4 -0
myqcd-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZhangXin8069
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
myqcd-0.1.0/MANIFEST.in
ADDED
myqcd-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: myqcd
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Executable audits for lattice-QCD formulas, operator construction, and Feynman diagram structure.
|
|
5
|
+
Author: ZhangXin8069
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.itp.ac.cn/zhangxin8069/MyQCD
|
|
8
|
+
Project-URL: 国内镜像 (Gitee), https://gitee.com/zhangxin8069/MyQCD
|
|
9
|
+
Project-URL: 国际镜像 (GitHub), https://github.com/zhangxin8069/MyQCD
|
|
10
|
+
Project-URL: Documentation, https://myqcd.readthedocs.io/
|
|
11
|
+
Project-URL: Issues, https://gitlab.itp.ac.cn/zhangxin8069/MyQCD/-/issues
|
|
12
|
+
Keywords: lattice-qcd,qcd,operator-construction,feynman-diagrams,sympy,physics
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: sympy>=1.12
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# MyQCD
|
|
33
|
+
|
|
34
|
+
MyQCD 是 PyQCD 格点 QCD 物理的可执行公式审计库:把报告中的结构公式拆成
|
|
35
|
+
SymPy 可检查推导、来源索引与独立的算符/费曼图层。它不复制上游 GPL 或无许可证
|
|
36
|
+
源码,所有新实现均以数学恒等式与精确代数测试为证据。
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install myqcd
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
唯一运行依赖是 `sympy`。Python 3.10 及以上可用;当前完整测试在 Python 3.12
|
|
45
|
+
(SymPy 1.14)上执行。
|
|
46
|
+
|
|
47
|
+
## 能力
|
|
48
|
+
|
|
49
|
+
| 模块 | 作用 |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `myqcd.audit` | 核心公式检查、论文显示公式索引与 JSON 报告 |
|
|
52
|
+
| `myqcd.pyqcd_theory_audit` | PyQCD 的 gamma、顶点、Wilson 线、Clover、Jackknife、ratio、混合方案与量纲审计 |
|
|
53
|
+
| `myqcd.derivations` | 格点规范场、梯度流、LaMET、PDF/TMD、重正化与统计的 SymPy 推导 |
|
|
54
|
+
| `myqcd.formula_registry` | 公式到报告、来源行号与推导入口的注册表 |
|
|
55
|
+
| `myqcd.latex_inventory` | 论文 LaTeX 显示公式清单 |
|
|
56
|
+
| `myqcd.wick` | 精确味道 Wick 配对与 Grassmann 重排符号 |
|
|
57
|
+
| `myqcd.gamma` | PyQCD DeGrand--Rossi gamma 基、0..17 索引、迹定理、16 个 Dirac 基与 H/T/C 符号 |
|
|
58
|
+
| `myqcd.color` | SU(3) 生成元、结构常数、对称常数、Casimir 与颜色 Fierz 恒等式 |
|
|
59
|
+
| `myqcd.operators` | 16 个 Dirac 双线性结构、精确分解、宇称/C 分类、量纲与 PyQCD 索引映射 |
|
|
60
|
+
| `myqcd.feynman` | 费曼图数据结构、QCD 顶点/传播子规则清单、Wick 配对图与圈数 |
|
|
61
|
+
| `myqcd.diagram_export` | 零依赖导出 TikZ-Feynman、Graphviz DOT 与 SVG |
|
|
62
|
+
| `myqcd.operator_audit` | 算符/图构建一键审计 |
|
|
63
|
+
|
|
64
|
+
## 入口
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python -m myqcd
|
|
68
|
+
python -m myqcd.operator_audit --root .
|
|
69
|
+
python -m myqcd.pyqcd_theory_audit --root .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`python -m myqcd` 需要源码仓库中的 `refer/papers/INDEX.md`;纯安装环境请使用
|
|
73
|
+
`python -m myqcd.operator_audit`,它只依赖包内代码与 SymPy。
|
|
74
|
+
|
|
75
|
+
## 证据边界
|
|
76
|
+
|
|
77
|
+
- `verified` 只表示写明的代数、量纲、有限维代理或组合恒等式通过。
|
|
78
|
+
- 不声称完成非阿贝尔圈积分、非微扰矩阵元、真实系综、GPU 数值、soft/rapidity
|
|
79
|
+
闭环或连续极限。
|
|
80
|
+
- 颜色约定:`myqcd.color` 使用厄米归一化 `Tr[T^aT^b] = +δ^{ab}/2`;历史
|
|
81
|
+
`derivations.py` 中的 SU(3) 推导使用反厄米 `-δ^{ab}/2`,两套约定不可混用。
|
|
82
|
+
- 费曼图导出只保证组合结构与字符串格式,不证明具体图的对称因子或圈积分结果。
|
|
83
|
+
|
|
84
|
+
## 仓库与文档
|
|
85
|
+
|
|
86
|
+
- 主仓库:<https://gitlab.itp.ac.cn/zhangxin8069/MyQCD>
|
|
87
|
+
- Gitee 镜像:<https://gitee.com/zhangxin8069/MyQCD>
|
|
88
|
+
- GitHub 镜像(由 Gitee 自动同步):<https://github.com/zhangxin8069/MyQCD>
|
|
89
|
+
- 文档:<https://myqcd.readthedocs.io/>
|
|
90
|
+
|
|
91
|
+
外部参考库以只读 Git 子模块固定在 `refer/git-rep/`,来源、提交与许可证见
|
|
92
|
+
`docs/absorb_reference_libraries_20261109.md`。
|
|
93
|
+
|
|
94
|
+
## 许可
|
|
95
|
+
|
|
96
|
+
MIT。见 `LICENSE`。
|
myqcd-0.1.0/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# MyQCD
|
|
2
|
+
|
|
3
|
+
MyQCD 是 PyQCD 格点 QCD 物理的可执行公式审计库:把报告中的结构公式拆成
|
|
4
|
+
SymPy 可检查推导、来源索引与独立的算符/费曼图层。它不复制上游 GPL 或无许可证
|
|
5
|
+
源码,所有新实现均以数学恒等式与精确代数测试为证据。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install myqcd
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
唯一运行依赖是 `sympy`。Python 3.10 及以上可用;当前完整测试在 Python 3.12
|
|
14
|
+
(SymPy 1.14)上执行。
|
|
15
|
+
|
|
16
|
+
## 能力
|
|
17
|
+
|
|
18
|
+
| 模块 | 作用 |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `myqcd.audit` | 核心公式检查、论文显示公式索引与 JSON 报告 |
|
|
21
|
+
| `myqcd.pyqcd_theory_audit` | PyQCD 的 gamma、顶点、Wilson 线、Clover、Jackknife、ratio、混合方案与量纲审计 |
|
|
22
|
+
| `myqcd.derivations` | 格点规范场、梯度流、LaMET、PDF/TMD、重正化与统计的 SymPy 推导 |
|
|
23
|
+
| `myqcd.formula_registry` | 公式到报告、来源行号与推导入口的注册表 |
|
|
24
|
+
| `myqcd.latex_inventory` | 论文 LaTeX 显示公式清单 |
|
|
25
|
+
| `myqcd.wick` | 精确味道 Wick 配对与 Grassmann 重排符号 |
|
|
26
|
+
| `myqcd.gamma` | PyQCD DeGrand--Rossi gamma 基、0..17 索引、迹定理、16 个 Dirac 基与 H/T/C 符号 |
|
|
27
|
+
| `myqcd.color` | SU(3) 生成元、结构常数、对称常数、Casimir 与颜色 Fierz 恒等式 |
|
|
28
|
+
| `myqcd.operators` | 16 个 Dirac 双线性结构、精确分解、宇称/C 分类、量纲与 PyQCD 索引映射 |
|
|
29
|
+
| `myqcd.feynman` | 费曼图数据结构、QCD 顶点/传播子规则清单、Wick 配对图与圈数 |
|
|
30
|
+
| `myqcd.diagram_export` | 零依赖导出 TikZ-Feynman、Graphviz DOT 与 SVG |
|
|
31
|
+
| `myqcd.operator_audit` | 算符/图构建一键审计 |
|
|
32
|
+
|
|
33
|
+
## 入口
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python -m myqcd
|
|
37
|
+
python -m myqcd.operator_audit --root .
|
|
38
|
+
python -m myqcd.pyqcd_theory_audit --root .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`python -m myqcd` 需要源码仓库中的 `refer/papers/INDEX.md`;纯安装环境请使用
|
|
42
|
+
`python -m myqcd.operator_audit`,它只依赖包内代码与 SymPy。
|
|
43
|
+
|
|
44
|
+
## 证据边界
|
|
45
|
+
|
|
46
|
+
- `verified` 只表示写明的代数、量纲、有限维代理或组合恒等式通过。
|
|
47
|
+
- 不声称完成非阿贝尔圈积分、非微扰矩阵元、真实系综、GPU 数值、soft/rapidity
|
|
48
|
+
闭环或连续极限。
|
|
49
|
+
- 颜色约定:`myqcd.color` 使用厄米归一化 `Tr[T^aT^b] = +δ^{ab}/2`;历史
|
|
50
|
+
`derivations.py` 中的 SU(3) 推导使用反厄米 `-δ^{ab}/2`,两套约定不可混用。
|
|
51
|
+
- 费曼图导出只保证组合结构与字符串格式,不证明具体图的对称因子或圈积分结果。
|
|
52
|
+
|
|
53
|
+
## 仓库与文档
|
|
54
|
+
|
|
55
|
+
- 主仓库:<https://gitlab.itp.ac.cn/zhangxin8069/MyQCD>
|
|
56
|
+
- Gitee 镜像:<https://gitee.com/zhangxin8069/MyQCD>
|
|
57
|
+
- GitHub 镜像(由 Gitee 自动同步):<https://github.com/zhangxin8069/MyQCD>
|
|
58
|
+
- 文档:<https://myqcd.readthedocs.io/>
|
|
59
|
+
|
|
60
|
+
外部参考库以只读 Git 子模块固定在 `refer/git-rep/`,来源、提交与许可证见
|
|
61
|
+
`docs/absorb_reference_libraries_20261109.md`。
|
|
62
|
+
|
|
63
|
+
## 许可
|
|
64
|
+
|
|
65
|
+
MIT。见 `LICENSE`。
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"""PyQCD 格点 QCD 物理公式与来源审计工具。
|
|
2
|
+
|
|
3
|
+
本包把报告中的结构公式拆成两层:
|
|
4
|
+
|
|
5
|
+
* :mod:`myqcd.derivations` 包含可在明确假设下由 SymPy 检查的解析推导;
|
|
6
|
+
* :mod:`myqcd.latex_inventory` 对 50 篇中文论文源文件中的显示公式逐条建档。
|
|
7
|
+
|
|
8
|
+
公式索引中的 ``unparsed`` 只表示尚未在不引入额外物理约定的情况下自动
|
|
9
|
+
语义化,并不表示论文公式错误。
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
|
|
14
|
+
from .derivations import (
|
|
15
|
+
DerivationResult,
|
|
16
|
+
derive_collins_soper_evolution,
|
|
17
|
+
derive_correlator_spectrum,
|
|
18
|
+
derive_diffusion_processes,
|
|
19
|
+
derive_gauge_flow_kernel,
|
|
20
|
+
derive_generating_functional,
|
|
21
|
+
derive_gradient_flow,
|
|
22
|
+
derive_gradient_flow_energy_density,
|
|
23
|
+
derive_heat_kernel_semigroup,
|
|
24
|
+
derive_gradient_flow_pole_cancellation,
|
|
25
|
+
derive_hmc_scalar,
|
|
26
|
+
derive_langevin_fokker_planck,
|
|
27
|
+
derive_boosted_smearing_width,
|
|
28
|
+
derive_lattice_dispersion_relations,
|
|
29
|
+
derive_lamet_matching,
|
|
30
|
+
derive_lamet_lightcone_kinematics,
|
|
31
|
+
derive_lattice_link,
|
|
32
|
+
derive_mcmc_autocorrelation,
|
|
33
|
+
derive_stout_smearing_su2,
|
|
34
|
+
derive_momentum_smearing_shift,
|
|
35
|
+
derive_mellin_convolution,
|
|
36
|
+
derive_nonperturbative_renormalization_conditions,
|
|
37
|
+
derive_normalizing_flow,
|
|
38
|
+
derive_pseudo_itd,
|
|
39
|
+
derive_pdf_moment_relations,
|
|
40
|
+
derive_phi4_lattice_observables,
|
|
41
|
+
derive_renormalization,
|
|
42
|
+
derive_tmd_fourier,
|
|
43
|
+
derive_quasi_pdf_tmd_relation,
|
|
44
|
+
derive_gpd_kinematics_and_matching,
|
|
45
|
+
derive_pion_da_normalization,
|
|
46
|
+
derive_tmd_soft_rge_consistency,
|
|
47
|
+
derive_target_mass_corrections,
|
|
48
|
+
derive_trivializing_map,
|
|
49
|
+
derive_trivializing_flow_factorization,
|
|
50
|
+
derive_euler_map_inverse_and_jacobian,
|
|
51
|
+
derive_qpdf_ppdf_fourier_inversion,
|
|
52
|
+
derive_flow_mcmc_balance,
|
|
53
|
+
derive_flowed_propagators,
|
|
54
|
+
derive_pseudo_pdf_ir_regulators,
|
|
55
|
+
derive_pseudo_pdf_one_loop,
|
|
56
|
+
derive_quark_gaussian_smearing,
|
|
57
|
+
derive_u1_gauge_invariance,
|
|
58
|
+
derive_u1_lattice_field_strength,
|
|
59
|
+
derive_u1_topological_charge,
|
|
60
|
+
derive_u1_compact_action,
|
|
61
|
+
derive_su3_generator_identities,
|
|
62
|
+
derive_su3_cayley_hamilton,
|
|
63
|
+
derive_correlated_chi_square_profile,
|
|
64
|
+
derive_ising_mean_field,
|
|
65
|
+
derive_ape_projection_su2,
|
|
66
|
+
derive_wilson_eigenvalue_statistics,
|
|
67
|
+
derive_wilson_fourier_endpoint,
|
|
68
|
+
derive_wilson_edge_universal_formulas,
|
|
69
|
+
derive_wilson_continuum_scale,
|
|
70
|
+
derive_two_dimensional_wilson_loop,
|
|
71
|
+
derive_instanton_holonomy_su2,
|
|
72
|
+
derive_grassmann_determinant_identity,
|
|
73
|
+
derive_wick_pairing_enumeration,
|
|
74
|
+
derive_wilson_gap_scaling,
|
|
75
|
+
derive_wilson_smearing_kernel,
|
|
76
|
+
derive_wilson_smearing_scaling,
|
|
77
|
+
derive_wilson_area_law,
|
|
78
|
+
derive_wilson_flow_five_dimensional,
|
|
79
|
+
derive_wilson_flow_runge_kutta,
|
|
80
|
+
derive_gradient_flow_duhamel_solution,
|
|
81
|
+
derive_wilson_flow_reference_scale,
|
|
82
|
+
derive_wilson_lattice_flow_monotonicity,
|
|
83
|
+
derive_flow_integral_ibp,
|
|
84
|
+
derive_gradient_flow_rg_log_recursion,
|
|
85
|
+
derive_gradient_flow_scheme_conversion,
|
|
86
|
+
derive_emt_operator_basis,
|
|
87
|
+
derive_ringed_fermion_normalization,
|
|
88
|
+
derive_emt_trace_anomaly,
|
|
89
|
+
derive_yang_mills_gradient_flow_emt,
|
|
90
|
+
derive_auxiliary_field_wilson_renormalization,
|
|
91
|
+
derive_ri_mom_ratio_renormalization,
|
|
92
|
+
derive_hybrid_renormalization,
|
|
93
|
+
derive_hybrid_momentum_matching_kernel,
|
|
94
|
+
derive_twist2_flowed_moment_matching,
|
|
95
|
+
derive_euclidean_lightcone_factorization,
|
|
96
|
+
derive_euclidean_ope_factorization,
|
|
97
|
+
derive_euclidean_renormalization_schemes,
|
|
98
|
+
derive_euclidean_lattice_data_window,
|
|
99
|
+
derive_isovector_pdf_extension,
|
|
100
|
+
derive_isovector_systematic_renorm_matching,
|
|
101
|
+
derive_quasi_pdf_all_order_renormalization,
|
|
102
|
+
derive_quasi_gluon_multiplicative_renormalization,
|
|
103
|
+
derive_power_corrections_renormalons_quasi,
|
|
104
|
+
derive_quasi_tmd_matching_and_cs_kernel,
|
|
105
|
+
derive_quasi_tmd_hard_kernel_i_epsilon,
|
|
106
|
+
derive_ri_xmom_renormalization_conditions,
|
|
107
|
+
derive_wilson_line_linear_counterterm,
|
|
108
|
+
derive_quasi_pdf_one_loop_matching_kernel,
|
|
109
|
+
derive_quasi_pdf_finite_momentum_one_loop_matching_kernel,
|
|
110
|
+
run_core_checks,
|
|
111
|
+
)
|
|
112
|
+
from .formula_registry import CORE_FORMULAS, FormulaSpec
|
|
113
|
+
from .latex_inventory import (
|
|
114
|
+
FormulaRecord,
|
|
115
|
+
InventoryReport,
|
|
116
|
+
extract_display_formulas,
|
|
117
|
+
scan_refer_papers,
|
|
118
|
+
)
|
|
119
|
+
from .wick import (
|
|
120
|
+
FermionField,
|
|
121
|
+
WickPairing,
|
|
122
|
+
count_wick_pairings,
|
|
123
|
+
enumerate_wick_pairings,
|
|
124
|
+
fermion_fields,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
__all__ = [
|
|
128
|
+
"CORE_FORMULAS",
|
|
129
|
+
"DerivationResult",
|
|
130
|
+
"FormulaRecord",
|
|
131
|
+
"FormulaSpec",
|
|
132
|
+
"FermionField",
|
|
133
|
+
"InventoryReport",
|
|
134
|
+
"WickPairing",
|
|
135
|
+
"count_wick_pairings",
|
|
136
|
+
"derive_correlator_spectrum",
|
|
137
|
+
"derive_diffusion_processes",
|
|
138
|
+
"derive_gauge_flow_kernel",
|
|
139
|
+
"derive_collins_soper_evolution",
|
|
140
|
+
"derive_generating_functional",
|
|
141
|
+
"derive_gradient_flow",
|
|
142
|
+
"derive_gradient_flow_energy_density",
|
|
143
|
+
"derive_heat_kernel_semigroup",
|
|
144
|
+
"derive_gradient_flow_pole_cancellation",
|
|
145
|
+
"derive_hmc_scalar",
|
|
146
|
+
"derive_langevin_fokker_planck",
|
|
147
|
+
"derive_boosted_smearing_width",
|
|
148
|
+
"derive_lattice_dispersion_relations",
|
|
149
|
+
"derive_lamet_matching",
|
|
150
|
+
"derive_lamet_lightcone_kinematics",
|
|
151
|
+
"derive_lattice_link",
|
|
152
|
+
"derive_mcmc_autocorrelation",
|
|
153
|
+
"derive_stout_smearing_su2",
|
|
154
|
+
"derive_momentum_smearing_shift",
|
|
155
|
+
"derive_mellin_convolution",
|
|
156
|
+
"derive_nonperturbative_renormalization_conditions",
|
|
157
|
+
"derive_normalizing_flow",
|
|
158
|
+
"derive_pseudo_itd",
|
|
159
|
+
"derive_pdf_moment_relations",
|
|
160
|
+
"derive_phi4_lattice_observables",
|
|
161
|
+
"derive_renormalization",
|
|
162
|
+
"derive_tmd_fourier",
|
|
163
|
+
"derive_quasi_pdf_tmd_relation",
|
|
164
|
+
"derive_gpd_kinematics_and_matching",
|
|
165
|
+
"derive_pion_da_normalization",
|
|
166
|
+
"derive_tmd_soft_rge_consistency",
|
|
167
|
+
"derive_target_mass_corrections",
|
|
168
|
+
"derive_trivializing_map",
|
|
169
|
+
"derive_trivializing_flow_factorization",
|
|
170
|
+
"derive_euler_map_inverse_and_jacobian",
|
|
171
|
+
"derive_qpdf_ppdf_fourier_inversion",
|
|
172
|
+
"derive_flow_mcmc_balance",
|
|
173
|
+
"derive_flowed_propagators",
|
|
174
|
+
"derive_pseudo_pdf_ir_regulators",
|
|
175
|
+
"derive_pseudo_pdf_one_loop",
|
|
176
|
+
"derive_quark_gaussian_smearing",
|
|
177
|
+
"derive_u1_gauge_invariance",
|
|
178
|
+
"derive_u1_lattice_field_strength",
|
|
179
|
+
"derive_u1_topological_charge",
|
|
180
|
+
"derive_u1_compact_action",
|
|
181
|
+
"derive_su3_generator_identities",
|
|
182
|
+
"derive_su3_cayley_hamilton",
|
|
183
|
+
"derive_correlated_chi_square_profile",
|
|
184
|
+
"derive_ising_mean_field",
|
|
185
|
+
"derive_ape_projection_su2",
|
|
186
|
+
"derive_wilson_eigenvalue_statistics",
|
|
187
|
+
"derive_wilson_fourier_endpoint",
|
|
188
|
+
"derive_wilson_edge_universal_formulas",
|
|
189
|
+
"derive_wilson_continuum_scale",
|
|
190
|
+
"derive_two_dimensional_wilson_loop",
|
|
191
|
+
"derive_instanton_holonomy_su2",
|
|
192
|
+
"derive_grassmann_determinant_identity",
|
|
193
|
+
"derive_wick_pairing_enumeration",
|
|
194
|
+
"derive_wilson_gap_scaling",
|
|
195
|
+
"derive_wilson_smearing_kernel",
|
|
196
|
+
"derive_wilson_smearing_scaling",
|
|
197
|
+
"derive_wilson_area_law",
|
|
198
|
+
"derive_wilson_flow_five_dimensional",
|
|
199
|
+
"derive_wilson_flow_runge_kutta",
|
|
200
|
+
"derive_gradient_flow_duhamel_solution",
|
|
201
|
+
"derive_wilson_flow_reference_scale",
|
|
202
|
+
"derive_wilson_lattice_flow_monotonicity",
|
|
203
|
+
"derive_flow_integral_ibp",
|
|
204
|
+
"derive_gradient_flow_rg_log_recursion",
|
|
205
|
+
"derive_gradient_flow_scheme_conversion",
|
|
206
|
+
"derive_emt_operator_basis",
|
|
207
|
+
"derive_ringed_fermion_normalization",
|
|
208
|
+
"derive_emt_trace_anomaly",
|
|
209
|
+
"derive_yang_mills_gradient_flow_emt",
|
|
210
|
+
"derive_auxiliary_field_wilson_renormalization",
|
|
211
|
+
"derive_ri_mom_ratio_renormalization",
|
|
212
|
+
"derive_hybrid_renormalization",
|
|
213
|
+
"derive_hybrid_momentum_matching_kernel",
|
|
214
|
+
"derive_twist2_flowed_moment_matching",
|
|
215
|
+
"derive_euclidean_lightcone_factorization",
|
|
216
|
+
"derive_euclidean_ope_factorization",
|
|
217
|
+
"derive_euclidean_renormalization_schemes",
|
|
218
|
+
"derive_euclidean_lattice_data_window",
|
|
219
|
+
"derive_isovector_pdf_extension",
|
|
220
|
+
"derive_isovector_systematic_renorm_matching",
|
|
221
|
+
"derive_quasi_pdf_all_order_renormalization",
|
|
222
|
+
"derive_quasi_gluon_multiplicative_renormalization",
|
|
223
|
+
"derive_power_corrections_renormalons_quasi",
|
|
224
|
+
"derive_quasi_tmd_matching_and_cs_kernel",
|
|
225
|
+
"derive_quasi_tmd_hard_kernel_i_epsilon",
|
|
226
|
+
"derive_ri_xmom_renormalization_conditions",
|
|
227
|
+
"derive_wilson_line_linear_counterterm",
|
|
228
|
+
"derive_quasi_pdf_one_loop_matching_kernel",
|
|
229
|
+
"derive_quasi_pdf_finite_momentum_one_loop_matching_kernel",
|
|
230
|
+
"extract_display_formulas",
|
|
231
|
+
"enumerate_wick_pairings",
|
|
232
|
+
"fermion_fields",
|
|
233
|
+
"run_core_checks",
|
|
234
|
+
"scan_refer_papers",
|
|
235
|
+
]
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"""命令行审计入口:核心 SymPy 检查 + 论文显示公式索引。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any, Dict, Iterable, Sequence
|
|
9
|
+
|
|
10
|
+
from .derivations import run_core_checks
|
|
11
|
+
from .latex_inventory import (
|
|
12
|
+
InventoryReport,
|
|
13
|
+
scan_refer_papers as _scan_refer_papers,
|
|
14
|
+
write_inventory,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class _AppendPaperIDSource(argparse.Action):
|
|
19
|
+
def __call__(self, parser, namespace, values, option_string=None):
|
|
20
|
+
sources = getattr(namespace, "paper_id_sources", None)
|
|
21
|
+
if sources is None:
|
|
22
|
+
sources = []
|
|
23
|
+
setattr(namespace, "paper_id_sources", sources)
|
|
24
|
+
source_type = "paper_ids" if option_string == "--paper-id" else "paper_id_file"
|
|
25
|
+
sources.append((source_type, values))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _normalize_paper_id_inputs(paper_ids: Iterable[str] | str | None) -> tuple[str, ...]:
|
|
29
|
+
if paper_ids is None:
|
|
30
|
+
return ()
|
|
31
|
+
if isinstance(paper_ids, str):
|
|
32
|
+
paper_ids = (paper_ids,)
|
|
33
|
+
|
|
34
|
+
normalized: list[str] = []
|
|
35
|
+
seen: set[str] = set()
|
|
36
|
+
for paper_id in paper_ids:
|
|
37
|
+
for chunk in paper_id.split(","):
|
|
38
|
+
candidate = chunk.strip()
|
|
39
|
+
if candidate and candidate not in seen:
|
|
40
|
+
seen.add(candidate)
|
|
41
|
+
normalized.append(candidate)
|
|
42
|
+
return tuple(normalized)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _paper_ids_from_file(path: Path) -> tuple[str, ...]:
|
|
46
|
+
try:
|
|
47
|
+
lines = path.read_text(encoding="utf-8").splitlines()
|
|
48
|
+
except OSError as exc:
|
|
49
|
+
raise ValueError(f"无法读取 paper id 文件 {path}: {exc}") from exc
|
|
50
|
+
|
|
51
|
+
paper_ids: list[str] = []
|
|
52
|
+
for line in lines:
|
|
53
|
+
stripped = line.strip()
|
|
54
|
+
if not stripped or stripped.startswith("#"):
|
|
55
|
+
continue
|
|
56
|
+
paper_ids.append(stripped)
|
|
57
|
+
return tuple(paper_ids)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _merge_paper_ids(
|
|
61
|
+
paper_ids: Iterable[str] | str | None = None,
|
|
62
|
+
paper_id_files: Iterable[Path | str] | None = None,
|
|
63
|
+
) -> tuple[str, ...]:
|
|
64
|
+
sources: list[tuple[str, Iterable[str] | str | Path]] = []
|
|
65
|
+
if paper_ids is not None:
|
|
66
|
+
sources.append(("paper_ids", paper_ids))
|
|
67
|
+
if paper_id_files:
|
|
68
|
+
for file_path in paper_id_files:
|
|
69
|
+
sources.append(("paper_id_file", file_path))
|
|
70
|
+
return _merge_paper_id_sources(sources)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _merge_paper_id_sources(
|
|
74
|
+
paper_id_sources: Sequence[tuple[str, Iterable[str] | str | Path]]
|
|
75
|
+
) -> tuple[str, ...]:
|
|
76
|
+
merged: list[str] = []
|
|
77
|
+
seen: set[str] = set()
|
|
78
|
+
for source_type, source_value in paper_id_sources:
|
|
79
|
+
if source_type == "paper_ids":
|
|
80
|
+
candidates = _normalize_paper_id_inputs(source_value)
|
|
81
|
+
elif source_type == "paper_id_file":
|
|
82
|
+
candidates = _paper_ids_from_file(Path(source_value))
|
|
83
|
+
else:
|
|
84
|
+
raise ValueError(f"不支持的 paper id 来源: {source_type}")
|
|
85
|
+
for candidate in candidates:
|
|
86
|
+
if candidate not in seen:
|
|
87
|
+
seen.add(candidate)
|
|
88
|
+
merged.append(candidate)
|
|
89
|
+
return tuple(merged)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _cli_error_message(exc: ValueError) -> str:
|
|
93
|
+
message = str(exc)
|
|
94
|
+
prefix = "paper_ids 中存在未收录的论文编号: "
|
|
95
|
+
if message.startswith(prefix):
|
|
96
|
+
return "不存在的 paper id: " + message[len(prefix) :]
|
|
97
|
+
return message
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def scan_refer_papers(
|
|
101
|
+
root: Path | str,
|
|
102
|
+
paper_ids: Iterable[str] | str | None = None,
|
|
103
|
+
paper_id_files: Iterable[Path | str] | None = None,
|
|
104
|
+
) -> InventoryReport:
|
|
105
|
+
"""扫描 refer/papers,并按 paper_id 过滤结果。"""
|
|
106
|
+
|
|
107
|
+
root_path = Path(root).resolve()
|
|
108
|
+
normalized_paper_ids = _merge_paper_ids(paper_ids=paper_ids, paper_id_files=paper_id_files)
|
|
109
|
+
if not normalized_paper_ids:
|
|
110
|
+
return _scan_refer_papers(root_path)
|
|
111
|
+
return _scan_refer_papers(root_path, paper_ids=normalized_paper_ids)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _unique_source_files(records) -> tuple[str, ...]:
|
|
115
|
+
return tuple(dict.fromkeys(record.source_file for record in records))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _build_audit_bundle(
|
|
119
|
+
root: Path | str,
|
|
120
|
+
paper_ids: Iterable[str] | str | None = None,
|
|
121
|
+
paper_id_files: Iterable[Path | str] | None = None,
|
|
122
|
+
) -> tuple[Dict[str, Any], InventoryReport]:
|
|
123
|
+
core = run_core_checks()
|
|
124
|
+
requested_paper_ids = _merge_paper_ids(
|
|
125
|
+
paper_ids=paper_ids,
|
|
126
|
+
paper_id_files=paper_id_files,
|
|
127
|
+
)
|
|
128
|
+
inventory = scan_refer_papers(root, paper_ids=requested_paper_ids)
|
|
129
|
+
paper_filter = {
|
|
130
|
+
"enabled": bool(requested_paper_ids),
|
|
131
|
+
"requested_paper_ids": list(requested_paper_ids),
|
|
132
|
+
"requested_count": len(requested_paper_ids),
|
|
133
|
+
"selected_paper_count": inventory.paper_count,
|
|
134
|
+
"source_files": list(_unique_source_files(inventory.records)),
|
|
135
|
+
}
|
|
136
|
+
report = {
|
|
137
|
+
"status": "verified_core_with_unparsed_inventory"
|
|
138
|
+
if core["status"] == "verified"
|
|
139
|
+
else "failed",
|
|
140
|
+
"core": core,
|
|
141
|
+
"paper_ids": list(requested_paper_ids),
|
|
142
|
+
"paper_filter": paper_filter,
|
|
143
|
+
"inventory": {
|
|
144
|
+
"paper_count": inventory.paper_count,
|
|
145
|
+
"source_file_count": inventory.source_file_count,
|
|
146
|
+
"formula_count": inventory.formula_count,
|
|
147
|
+
"unparsed_count": inventory.unparsed_count,
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
return report, inventory
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def build_audit_report(
|
|
154
|
+
root: Path | str,
|
|
155
|
+
paper_ids: Iterable[str] | str | None = None,
|
|
156
|
+
paper_id_files: Iterable[Path | str] | None = None,
|
|
157
|
+
) -> Dict[str, Any]:
|
|
158
|
+
report, _ = _build_audit_bundle(
|
|
159
|
+
root,
|
|
160
|
+
paper_ids=paper_ids,
|
|
161
|
+
paper_id_files=paper_id_files,
|
|
162
|
+
)
|
|
163
|
+
return report
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def main() -> int:
|
|
167
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
168
|
+
parser.set_defaults(paper_id_sources=[])
|
|
169
|
+
parser.add_argument(
|
|
170
|
+
"--root",
|
|
171
|
+
type=Path,
|
|
172
|
+
default=Path(__file__).resolve().parents[1],
|
|
173
|
+
help="MyQCD 工作区根目录",
|
|
174
|
+
)
|
|
175
|
+
parser.add_argument(
|
|
176
|
+
"--paper-id",
|
|
177
|
+
action=_AppendPaperIDSource,
|
|
178
|
+
metavar="PAPER_ID",
|
|
179
|
+
help="可重复指定,或用逗号分隔多个编号,例如 --paper-id P01 --paper-id P02 或 --paper-id P01,P02",
|
|
180
|
+
)
|
|
181
|
+
parser.add_argument(
|
|
182
|
+
"--paper-id-file",
|
|
183
|
+
action=_AppendPaperIDSource,
|
|
184
|
+
type=Path,
|
|
185
|
+
metavar="PATH",
|
|
186
|
+
help="每行一个 paper id,支持空行和以 # 开头的注释",
|
|
187
|
+
)
|
|
188
|
+
parser.add_argument(
|
|
189
|
+
"--inventory-json",
|
|
190
|
+
type=Path,
|
|
191
|
+
help="可选:将逐公式索引写入指定 JSON 文件",
|
|
192
|
+
)
|
|
193
|
+
args = parser.parse_args()
|
|
194
|
+
|
|
195
|
+
try:
|
|
196
|
+
requested_paper_ids = _merge_paper_id_sources(
|
|
197
|
+
getattr(args, "paper_id_sources", ())
|
|
198
|
+
)
|
|
199
|
+
report, inventory = _build_audit_bundle(
|
|
200
|
+
args.root,
|
|
201
|
+
paper_ids=requested_paper_ids,
|
|
202
|
+
)
|
|
203
|
+
except ValueError as exc:
|
|
204
|
+
parser.exit(2, f"error: {_cli_error_message(exc)}\n")
|
|
205
|
+
if args.inventory_json is not None:
|
|
206
|
+
write_inventory(args.inventory_json, inventory)
|
|
207
|
+
report["inventory_json"] = str(args.inventory_json)
|
|
208
|
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
|
209
|
+
return 0 if report["status"] != "failed" else 1
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
if __name__ == "__main__":
|
|
213
|
+
raise SystemExit(main())
|