pdfxtmd 0.3.0__cp311-cp311-musllinux_1_2_i686.whl → 1.0.0__cp311-cp311-musllinux_1_2_i686.whl
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.
- pdfxtmd-1.0.0.dist-info/METADATA +266 -0
- pdfxtmd-1.0.0.dist-info/RECORD +8 -0
- {pdfxtmd-0.3.0.dist-info → pdfxtmd-1.0.0.dist-info}/WHEEL +1 -1
- {pdfxtmd-0.3.0.dist-info → pdfxtmd-1.0.0.dist-info}/licenses/LICENSE +674 -674
- pdfxtmd-1.0.0.dist-info/top_level.txt +4 -0
- pdfxtmd.cpython-311-i386-linux-musl.so +0 -0
- pdfxtmd.libs/libgcc_s-f3fb5a36.so.1 +0 -0
- pdfxtmd.libs/libstdc++-d2a021ba.so.6.0.32 +0 -0
- pdfxtmd-0.3.0.dist-info/METADATA +0 -5
- pdfxtmd-0.3.0.dist-info/RECORD +0 -8
- pdfxtmd-0.3.0.dist-info/top_level.txt +0 -1
- pdfxtmd.libs/libgcc_s-887de51c.so.1 +0 -0
- pdfxtmd.libs/libstdc++-d6415257.so.6.0.33 +0 -0
@@ -0,0 +1,266 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pdfxtmd
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: PDFxTMD is a library for parton distribution functions (PDFs) that integrates both collinear PDFs (cPDFs) and transverse momentum-dependent PDFs (TMDs).
|
5
|
+
Home-page: https://github.com/Raminkord92/PDFxTMD
|
6
|
+
Author: Ramin Kord Valeshabadi
|
7
|
+
Author-email: Ramin Kord Valeshabadi <raminkord92@gmail.com>
|
8
|
+
License: GPL-3.0
|
9
|
+
Project-URL: Homepage, https://github.com/Raminkord92/PDFxTMD
|
10
|
+
Platform: any
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
13
|
+
Classifier: Operating System :: OS Independent
|
14
|
+
Requires-Python: >=3.6
|
15
|
+
Description-Content-Type: text/markdown
|
16
|
+
License-File: LICENSE
|
17
|
+
Dynamic: author
|
18
|
+
Dynamic: home-page
|
19
|
+
Dynamic: license-file
|
20
|
+
Dynamic: platform
|
21
|
+
Dynamic: requires-python
|
22
|
+
|
23
|
+
# PDFxTMDLib Python API
|
24
|
+
|
25
|
+
**PDFxTMDLib** provides a powerful and easy-to-use Python interface for high-performance Parton Distribution Function (PDF) calculations. It offers unified access to collinear PDFs (cPDFs), Transverse Momentum-Dependent PDFs (TMDs), uncertainty analysis, and QCD coupling calculations.
|
26
|
+
|
27
|
+
This guide covers the installation and usage of the Python bindings.
|
28
|
+
|
29
|
+
-----
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
|
33
|
+
You can install the package directly from PyPI:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
pip install pdfxtmd
|
37
|
+
```
|
38
|
+
|
39
|
+
-----
|
40
|
+
|
41
|
+
## High-Level API: `PDFSet`
|
42
|
+
|
43
|
+
The `PDFSet` interface is the recommended way to work with PDF sets. It handles the entire collection of PDF members (central value and error sets) and provides a simple API for calculating **uncertainties** and **correlations**.
|
44
|
+
|
45
|
+
### 1\. Collinear PDF (cPDF) Uncertainty
|
46
|
+
|
47
|
+
```python
|
48
|
+
import pdfxtmd
|
49
|
+
|
50
|
+
# 1. Initialize a CPDFSet for a given PDF set name
|
51
|
+
cpdf_set = pdfxtmd.CPDFSet("CT18NLO")
|
52
|
+
print(f"Loaded CPDF Set: CT18NLO with {len(cpdf_set)} members.")
|
53
|
+
|
54
|
+
# 2. Define kinematics
|
55
|
+
x = 0.01
|
56
|
+
mu2 = 100
|
57
|
+
|
58
|
+
# 3. Get the central value PDF from member 0
|
59
|
+
central_cpdf = cpdf_set[0]
|
60
|
+
up_pdf_central = central_cpdf.pdf(pdfxtmd.PartonFlavor.u, x, mu2)
|
61
|
+
print(f"Central Up Quark PDF: {up_pdf_central:.6f}")
|
62
|
+
|
63
|
+
# 4. Calculate the PDF uncertainty (the result is a PDFUncertainty object)
|
64
|
+
uncertainty = cpdf_set.Uncertainty(pdfxtmd.PartonFlavor.u, x, mu2)
|
65
|
+
print(f"Uncertainty: central={uncertainty.central:.6f}, +{uncertainty.errplus:.6f}, -{uncertainty.errminus:.6f}")
|
66
|
+
|
67
|
+
# 5. Calculate the correlation between two different partons
|
68
|
+
correlation = cpdf_set.Correlation(
|
69
|
+
pdfxtmd.PartonFlavor.u, x, mu2, # PDF A
|
70
|
+
pdfxtmd.PartonFlavor.d, x, mu2 # PDF B
|
71
|
+
)
|
72
|
+
print(f"Correlation between u and d quarks: {correlation:.4f}")
|
73
|
+
```
|
74
|
+
|
75
|
+
### 2\. TMD Uncertainty
|
76
|
+
|
77
|
+
The interface for TMDs is analogous. Just use `TMDSet` and include the transverse momentum `kt2`.
|
78
|
+
|
79
|
+
```python
|
80
|
+
import pdfxtmd
|
81
|
+
|
82
|
+
# 1. Initialize a TMDSet
|
83
|
+
tmd_set = pdfxtmd.TMDSet("PB-NLO-HERAI+II-2018-set2")
|
84
|
+
print(f"\nLoaded TMD Set: {tmd_set.info().get_string('SetDesc')} with {len(tmd_set)} members.")
|
85
|
+
|
86
|
+
# 2. Define kinematics
|
87
|
+
x = 0.01
|
88
|
+
mu2 = 100
|
89
|
+
kt2 = 10
|
90
|
+
|
91
|
+
# 3. Calculate the TMD uncertainty
|
92
|
+
uncertainty_tmd = tmd_set.Uncertainty(pdfxtmd.PartonFlavor.g, x, kt2, mu2)
|
93
|
+
print(f"Gluon TMD Uncertainty: central={uncertainty_tmd.central:.6f}, +{uncertainty_tmd.errplus:.6f}, -{uncertainty_tmd.errminus:.6f}")
|
94
|
+
```
|
95
|
+
|
96
|
+
-----
|
97
|
+
|
98
|
+
## Low-Level API: Factories
|
99
|
+
|
100
|
+
For applications where you only need to evaluate a **single PDF member** and do not require uncertainty analysis, the factory interface offers a more direct approach.
|
101
|
+
|
102
|
+
```python
|
103
|
+
import pdfxtmd
|
104
|
+
|
105
|
+
x = 0.01
|
106
|
+
mu2 = 100
|
107
|
+
kt2 = 10
|
108
|
+
|
109
|
+
# --- Collinear PDFs (cPDF) using Factory ---
|
110
|
+
cpdf_factory = pdfxtmd.GenericCPDFFactory()
|
111
|
+
cpdf = cpdf_factory.mkCPDF("CT18NLO", 0) # Get member 0
|
112
|
+
|
113
|
+
# Evaluate a single flavor
|
114
|
+
up_pdf = cpdf.pdf(pdfxtmd.PartonFlavor.u, x, mu2)
|
115
|
+
print(f"CPDF (Up Quark) from Factory: {up_pdf:.6f}")
|
116
|
+
|
117
|
+
# Evaluate all flavors at once (returns a numpy array)
|
118
|
+
all_flavors_cpdf = cpdf.pdf(x, mu2)
|
119
|
+
print(f"All CPDF Flavors from Factory: {all_flavors_cpdf}")
|
120
|
+
|
121
|
+
|
122
|
+
# --- TMDs using Factory ---
|
123
|
+
tmd_factory = pdfxtmd.GenericTMDFactory()
|
124
|
+
tmd = tmd_factory.mkTMD("PB-NLO-HERAI+II-2018-set2", 0) # Get member 0
|
125
|
+
|
126
|
+
# Evaluate a single flavor
|
127
|
+
gluon_tmd = tmd.tmd(pdfxtmd.PartonFlavor.g, x, kt2, mu2)
|
128
|
+
print(f"\nTMD (Gluon) from Factory: {gluon_tmd:.6f}")
|
129
|
+
|
130
|
+
# Evaluate all TMD flavors at once (returns a numpy array)
|
131
|
+
all_flavors_tmd = tmd.tmd(x, kt2, mu2)
|
132
|
+
print(f"All TMD Flavors from Factory: {all_flavors_tmd}")
|
133
|
+
```
|
134
|
+
|
135
|
+
-----
|
136
|
+
|
137
|
+
## QCD Coupling ($\alpha_s$) Calculations
|
138
|
+
|
139
|
+
You can calculate the strong coupling constant $\alpha_s$ in two ways.
|
140
|
+
|
141
|
+
```python
|
142
|
+
import pdfxtmd
|
143
|
+
|
144
|
+
cpdf_set = pdfxtmd.CPDFSet("CT18NLO")
|
145
|
+
|
146
|
+
# Method A: Directly from the PDFSet object (Recommended)
|
147
|
+
print("--- Method A: From PDFSet ---")
|
148
|
+
alpha_s_from_set = cpdf_set.alphasQ2(10000)
|
149
|
+
print(f"Alpha_s at mu2=10000: {alpha_s_from_set:.5f}")
|
150
|
+
|
151
|
+
|
152
|
+
# Method B: Using the low-level CouplingFactory
|
153
|
+
print("\n--- Method B: From CouplingFactory ---")
|
154
|
+
coupling_factory = pdfxtmd.CouplingFactory()
|
155
|
+
coupling = coupling_factory.mkCoupling("CT18NLO")
|
156
|
+
alpha_s_from_factory = coupling.AlphaQCDMu2(10000)
|
157
|
+
print(f"Alpha_s at mu2=10000: {alpha_s_from_factory:.5f}")
|
158
|
+
```
|
159
|
+
|
160
|
+
-----
|
161
|
+
|
162
|
+
## Complete Example: Plotting PDFs with Uncertainties
|
163
|
+
|
164
|
+
This example demonstrates a complete workflow: loading PDF/TMD sets, calculating values and uncertainties over a range of *x*, and plotting the results using `matplotlib`.
|
165
|
+
|
166
|
+
```python
|
167
|
+
import pdfxtmd
|
168
|
+
import numpy as np
|
169
|
+
import matplotlib.pyplot as plt
|
170
|
+
|
171
|
+
# --- Part 1: Collinear PDF (cPDF) ---
|
172
|
+
cpdf_set = pdfxtmd.CPDFSet("CT18NLO")
|
173
|
+
print(f"Loaded cPDF set: {cpdf_set.info().get_string('SetDesc')}")
|
174
|
+
|
175
|
+
x_values = np.logspace(-4, -1, 100)
|
176
|
+
mu2 = 1000
|
177
|
+
|
178
|
+
# Calculate central values and uncertainties
|
179
|
+
uncertainties = [cpdf_set.Uncertainty(pdfxtmd.PartonFlavor.g, x, mu2) for x in x_values]
|
180
|
+
central_pdfs = [u.central for u in uncertainties]
|
181
|
+
upper_band = [u.central + u.errplus for u in uncertainties]
|
182
|
+
lower_band = [u.central - u.errminus for u in uncertainties]
|
183
|
+
|
184
|
+
# Plot the cPDF
|
185
|
+
plt.figure(figsize=(10, 6))
|
186
|
+
plt.plot(x_values, central_pdfs, label='Gluon PDF (CT18NLO)', color='blue')
|
187
|
+
plt.fill_between(x_values, lower_band, upper_band, color='blue', alpha=0.2, label='68% CL Uncertainty')
|
188
|
+
plt.xscale('log')
|
189
|
+
plt.xlabel('$x$')
|
190
|
+
plt.ylabel('$xg(x, \mu^2)$')
|
191
|
+
plt.title(f'Gluon PDF with Uncertainty at $\mu^2 = {mu2} \ GeV^2$')
|
192
|
+
plt.legend()
|
193
|
+
plt.grid(True, which="both", ls="--")
|
194
|
+
plt.savefig('gluon_pdf_plot.png')
|
195
|
+
print("Saved plot to gluon_pdf_plot.png")
|
196
|
+
plt.close()
|
197
|
+
|
198
|
+
|
199
|
+
# --- Part 2: Transverse Momentum-Dependent PDF (TMD) ---
|
200
|
+
tmd_set = pdfxtmd.TMDSet("PB-LO-HERAI+II-2020-set2")
|
201
|
+
print(f"Loaded TMD set: {tmd_set.info().get_string('SetDesc')}")
|
202
|
+
|
203
|
+
kt2 = 1
|
204
|
+
|
205
|
+
# Calculate central values and uncertainties
|
206
|
+
tmd_uncertainties = [tmd_set.Uncertainty(pdfxtmd.PartonFlavor.g, x, kt2, mu2) for x in x_values]
|
207
|
+
central_tmds = [u.central for u in tmd_uncertainties]
|
208
|
+
tmd_upper_band = [u.central + u.errplus for u in tmd_uncertainties]
|
209
|
+
tmd_lower_band = [u.central - u.errminus for u in tmd_uncertainties]
|
210
|
+
|
211
|
+
# Plot the TMD
|
212
|
+
plt.figure(figsize=(10, 6))
|
213
|
+
plt.plot(x_values, central_tmds, label='Gluon TMD (PB-LO-2020)', color='green')
|
214
|
+
plt.fill_between(x_values, tmd_lower_band, tmd_upper_band, color='green', alpha=0.2, label='68% CL Uncertainty')
|
215
|
+
plt.xscale('log')
|
216
|
+
plt.xlabel('$x$')
|
217
|
+
plt.ylabel('$xg(x, k_t^2, \mu^2)$')
|
218
|
+
plt.title(f'Gluon TMD with Uncertainty at $k_t^2 = {kt2} \ GeV^2, \mu^2 = {mu2} \ GeV^2$')
|
219
|
+
plt.legend()
|
220
|
+
plt.grid(True, which="both", ls="--")
|
221
|
+
plt.savefig('gluon_tmd_plot.png')
|
222
|
+
print("Saved plot to gluon_tmd_plot.png")
|
223
|
+
plt.close()
|
224
|
+
```
|
225
|
+
|
226
|
+
-----
|
227
|
+
|
228
|
+
## Additional Information
|
229
|
+
|
230
|
+
### Error Handling
|
231
|
+
|
232
|
+
The API raises a `RuntimeError` for invalid kinematic inputs.
|
233
|
+
|
234
|
+
```python
|
235
|
+
try:
|
236
|
+
cpdf.pdf(pdfxtmd.PartonFlavor.u, -0.1, mu2) # Invalid x
|
237
|
+
except RuntimeError as e:
|
238
|
+
print(f"Caught expected error for invalid x: {e}")
|
239
|
+
```
|
240
|
+
|
241
|
+
### Enumerating Parton Flavors
|
242
|
+
|
243
|
+
You can inspect all available parton flavors and their integer codes.
|
244
|
+
|
245
|
+
```python
|
246
|
+
print("\n--- All PartonFlavor enum values ---")
|
247
|
+
for name, flavor in pdfxtmd.PartonFlavor.__members__.items():
|
248
|
+
print(f" {name}: {flavor.value}")
|
249
|
+
```
|
250
|
+
|
251
|
+
### Full Code Examples
|
252
|
+
|
253
|
+
For more detailed examples, see the full tutorials in the project repository:
|
254
|
+
|
255
|
+
* [python\_tutorial.py](https://www.google.com/search?q=examples/python/python_tutorial.py)
|
256
|
+
* [Jupyter Notebook Tutorial (run online)](https://www.google.com/search?q=https://colab.research.google.com/drive/1C_h9oGJJzt5h3m-h6o3lAJ5dl-AVv0j3)
|
257
|
+
|
258
|
+
-----
|
259
|
+
|
260
|
+
## License
|
261
|
+
|
262
|
+
This project is licensed under the GNU General Public License v3.0. See the `LICENSE` file for details.
|
263
|
+
|
264
|
+
## Contact
|
265
|
+
|
266
|
+
For questions or contributions, please contact [raminkord92@gmail.com](mailto:raminkord92@gmail.com).
|
@@ -0,0 +1,8 @@
|
|
1
|
+
pdfxtmd.cpython-311-i386-linux-musl.so,sha256=MvWAoxwAFGfZIf_BVk9VwbQNe6klyfE0jHpvPW51XNk,2608445
|
2
|
+
pdfxtmd-1.0.0.dist-info/WHEEL,sha256=6ltumPE74Em2X1OXYv5iIjaGYcDTCG-wPLy9Dk1DJEw,110
|
3
|
+
pdfxtmd-1.0.0.dist-info/RECORD,,
|
4
|
+
pdfxtmd-1.0.0.dist-info/top_level.txt,sha256=Txg3I6UFaHGSNU9rzKh01hDSldU__3I_tnEY_LwvR5U,42
|
5
|
+
pdfxtmd-1.0.0.dist-info/METADATA,sha256=c0YVbi5lDCJKGbyATkGULUNX9ohnBcmqgCY4m_3Zf98,8495
|
6
|
+
pdfxtmd-1.0.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
7
|
+
pdfxtmd.libs/libgcc_s-f3fb5a36.so.1,sha256=SrjjCCuY7RHj-T9JLrY9XFMgCCpYD9Qmezr4uoJGVEQ,168321
|
8
|
+
pdfxtmd.libs/libstdc++-d2a021ba.so.6.0.32,sha256=1zr_iwGwEBe95gyKdgiw7C4Y1RR9ijV40j66rk4elzg,3537349
|