Skip to content

Commit fa407ba

Browse files
committed
Rebased
2 parents 14ef816 + 30872fb commit fa407ba

File tree

202 files changed

+25321
-22070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+25321
-22070
lines changed

.github/actions/prepare_environment/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ inputs:
1919
python-version:
2020
required: true
2121
description: "Python version to use"
22-
default: "3.12"
22+
default: "3.13"
2323

2424
runs:
2525
using: "composite"
@@ -33,7 +33,9 @@ runs:
3333
auto-update-conda: true
3434
activate-environment: nnpdf_environment
3535
conda-remove-defaults: true
36-
- name: Add NETRC
36+
- name: Add NETRC and cleanup cache
3737
shell: bash -l {0}
3838
run: |
39+
sudo rm -rf /opt/hostedtoolcache/Python/3.9*
40+
sudo rm -rf /opt/hostedtoolcache/CodeQL
3941
echo "$NETRC_FILE" | base64 --decode > ~/.netrc

.github/workflows/all_tests_nnpdf.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Test n3fit and validphys
3636
shell: bash -l {0}
3737
run: |
38-
pytest --cov=${PWD} --cov-config=pyproject.toml --mpl --pyargs validphys n3fit --mpl-default-tolerance 18
38+
pytest --cov=${PWD} --cov-config=pyproject.toml --mpl --pyargs validphys n3fit --mpl-default-tolerance 24
3939
- name: Keep coverage file
4040
if: startsWith(matrix.python-version, '3.13')
4141
uses: actions/upload-artifact@v4
@@ -100,6 +100,8 @@ jobs:
100100
- name: Install nnpdf without LHAPDF
101101
shell: bash -l {0}
102102
run: |
103+
sudo rm -rf /opt/hostedtoolcache/Python/{3.9*}
104+
sudo rm -rf /opt/hostedtoolcache/CodeQL
103105
pip install .[nolha,torch]
104106
# Since there is no LHAPDF in the system, initialize the folder and download pdfsets.index
105107
lhapdf-management update --init

.github/workflows/fitbot.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ on:
88

99
# some general variables
1010
env:
11-
N3FIT_MAXNREP: 20 # total number of replicas to fit
12-
POSTFIT_NREP: 16 # requested replicas for postfit
13-
REFERENCE_SET: NNBOT-955eb2bcc-2025-06-17 # reference set for exact results
14-
STABLE_REFERENCE_SET: NNBOT-955eb2bcc-2025-06-17 # reference set for last tag
11+
N3FIT_MAXNREP: 30 # total number of replicas to fit
12+
POSTFIT_NREP: 15 # requested minimum replicas for postfit
13+
REFERENCE_SET: NNBOT-99108504e-2025-11-22 # reference set for exact results
14+
STABLE_REFERENCE_SET: NNBOT-99108504e-2025-11-22 # reference set for last tag
1515
PYTHONHASHSEED: "0"
1616

1717
jobs:
@@ -55,12 +55,12 @@ jobs:
5555
cd $RUNFOLDER
5656
cp developing.yml $RUNCARD.yml
5757
vp-setupfit $RUNCARD.yml
58-
# run n3fit replicas sequentially
58+
# try running the n3fit replicas in parallel
5959
- name: Running n3fit
6060
shell: bash -l {0}
6161
run: |
6262
cd $RUNFOLDER
63-
for ((i=1; i<=$N3FIT_MAXNREP; i+=1)); do n3fit $RUNCARD.yml $i ; done
63+
n3fit $RUNCARD.yml 1 -r $N3FIT_MAXNREP
6464
# performing DGLAP
6565
- name: Running dglap
6666
shell: bash -l {0}
@@ -79,7 +79,7 @@ jobs:
7979
run: |
8080
conda activate nnpdfenv
8181
cd $RUNFOLDER
82-
postfit $POSTFIT_NREP $RUNCARD
82+
postfit $POSTFIT_NREP $RUNCARD --at-least-nrep
8383
res=$(vp-upload $RUNCARD 2>&1)
8484
echo ${res}
8585
while echo ${res} | grep ERROR >/dev/null

doc/sphinx/make_theory_csv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from argparse import ArgumentParser
66
from pathlib import Path
77

8-
from nnpdf_data import theory_cards
8+
from nnpdf_data import THEORY_CARDS_PATH
99
from nnpdf_data.theorydbutils import fetch_all
1010

1111
if __name__ == "__main__":
@@ -20,7 +20,7 @@
2020

2121
args = parser.parse_args()
2222

23-
theory_df = fetch_all(theory_cards)
23+
theory_df = fetch_all(THEORY_CARDS_PATH)
2424

2525
# Enforce the following order in the table:
2626
order = ["PTO", "QED", "Comments", "IC", "Q0", "ModEv"]

doc/sphinx/source/data/data-config.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ located in the ``nnpdf`` git repository at
2323

2424
where a separate ``CommonData`` file is stored for each *Dataset* with the
2525
filename format described in :ref:`dataset-naming-convention`.
26-
The data is installed as part of the python package of ``nnpdf``,
26+
The data is installed as part of the python package of ``nnpdf`` or ``nnpdf_data``.
2727
all data files to be installed must have a ``.yaml`` extension.
2828

29+
It is possible to add extra sources of data by adding a ``data_path`` variable
30+
to the ``nnprofile.yaml`` file (see :ref:`nnprofile`).
31+
The extra sources will always be searched before the default path.
32+
2933

3034
Theory lookup table
3135
===================

doc/sphinx/source/index.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,28 @@ The NNPDF collaboration is currently composed of the following
3333
members:
3434

3535
* Richard D. Ball - University of Edinburgh
36-
* Alessandro Candido - CERN
36+
* Alessandro Candido - Quantum Research Centre, Technology Innovation Institute, Abu Dhabi
3737
* Stefano Carrazza - Università degli Studi di Milano and INFN
3838
* Amedeo Chiefa - University of Edinburgh
39+
* Ella Cole - University of Cambridge
3940
* Mark Costantini - University of Cambridge
40-
* Juan M. Cruz-Martinez - CERN
41+
* Juan M. Cruz-Martinez - Universidad de Sevilla
4142
* Luigi Del Debbio - University of Edinburgh
4243
* Stefano Forte - Università degli Studi di Milano and INFN
43-
* Tommaso Giani - Max-Planck-Institut für Physik
44+
* Tommaso Giani - Università degli Studi di Torino and INFN
45+
* Eva Groenendijk - Università degli Studi di Milano and INFN
4446
* Felix Hekhorn - University of Jyväskylä
45-
* José Ignacio Latorre - Quantum Research Centre, Technology
46-
Innovation Institute, Abu Dhabi, United Arab Emirates and Center for Quantum Technologies, National University of Singapore
47+
* Jaco ter Hoeve - University of Edinburgh
48+
* José Ignacio Latorre - Quantum Research Centre, Technology Innovation Institute, Abu Dhabi, United Arab Emirates and Center for Quantum Technologies, National University of Singapore
4749
* Giacomo Magni - IJCLab Orsay and CNRS
4850
* Emanuele R. Nocera - Università degli Studi di Torino and INFN
4951
* Tanjona R. Rabemananjara - Vrije University Amsterdam and Nikhef
5052
* Juan Rojo - Vrije University Amsterdam and Nikhef
53+
* Valentina Schutze - University of Cambridge
5154
* Tanishq Sharma - Università di Torino and INFN
52-
* Roy Stegeman - University of Edinburgh
55+
* Roy Stegeman - Quantum Research Centre, Technology Innovation Institute, Abu Dhabi
5356
* Maria Ubiali - University of Cambridge
57+
* Ramon Winterhalder - Università degli Studi di Milano and INFN
5458

5559
Former members of the NNPDF collaboration include
5660

doc/sphinx/source/n3fit/methodology.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,58 @@ The figure above provides a schematic representation of this feature scaling met
346346
2. ``[number of points]`` points are kept (dark blue), while other points are discarded (light blue).
347347
3. A cubic spline function is used to do the interpolation between the points that have not been
348348
discarded.
349+
350+
351+
Diagonal basis
352+
--------------
353+
354+
Performing the training and validation split without diagonalising the :math:`t_0` covmat :math:`C_{0}` neglects
355+
any correlations that may be present between training and validation data. To remedy this,
356+
we rotate to a basis in which the correlation matrix is diagonal before performing any training/validation split.
357+
Starting from the definition of the :math:`\chi^2` function in the NNPDF methodology, we have
358+
359+
.. math::
360+
361+
\chi^2 &= (D-T)^T C_0^{-1} (D-T) \\
362+
&= (D-T)^T R^{-1} R C_0^{-1} R R^{-1} (D-T) \\
363+
&= (D-T)^T R^{-1} \left( R^{-1} C_0 R^{-1} \right)^{-1} R^{-1} (D-T) \\
364+
&\equiv \tilde{\epsilon}^T \rho^{-1} \tilde{\epsilon} \, ,
365+
366+
where we have defined :math:`\tilde{\epsilon} \equiv R^{-1}(D-T)` and :math:`\rho = R^{-1} C_0 R^{-1}`.
367+
368+
Choosing :math:`R_{ii} = \sqrt{C_{0, ii}}`, we have that :math:`R^{-1} C_0 R^{-1}` coincides with the usual definition of the correlation matrix.
369+
370+
Next, we move to the basis in which :math:`\rho` is diagonal. Writing :math:`\rho = \tilde{U}^T \tilde{\Lambda} \tilde{U}`, we find
371+
372+
.. math::
373+
374+
\chi^2 &= \tilde{\epsilon}^T \rho^{-1} \tilde{\epsilon} \\
375+
&= \tilde{\epsilon}^T (\tilde{U}^T \tilde{\Lambda} \tilde{U})^{-1} \tilde{\epsilon} \\
376+
&= \tilde{\epsilon}^T \tilde{U}^T \tilde{\Lambda}^{-1} \tilde{U} \tilde{\epsilon} \\
377+
&\equiv \dbtilde{\epsilon}^T \tilde{\Lambda}^{-1} \dbtilde{\epsilon} \, ,
378+
379+
where on the last line we have defined
380+
381+
.. math::
382+
383+
\dbtilde{\epsilon} \equiv \tilde{U}\tilde{\epsilon} = \tilde{U}R^{-1}(D-T).
384+
385+
In index notation, this reads
386+
387+
.. math::
388+
389+
\dbtilde{\epsilon_i} = \tilde{U}_{ij} \frac{(D-T)_j}{\sqrt{C_{0, jj}}}
390+
391+
The transformed data :math:`\dbtilde{\epsilon}` is statistically independent in the diagonal basis of the correlation matrix :math:`\rho`.
392+
Computing the covariance of :math:`\dbtilde{\epsilon}`,
393+
394+
.. math::
395+
396+
\mathbb{E}[\dbtilde{\epsilon}\dbtilde{\epsilon}^T]
397+
&= \mathbb{E} \big[ (\tilde{U} R^{-1}(D-T)) (\tilde{U} R^{-1}(D-T))^T \big] \\
398+
&= \tilde{U} R^{-1} \mathbb{E}[(D-T)(D-T)^T] R^{-1} \tilde{U}^T \\
399+
&= \tilde{U} \rho \tilde{U}^T \\
400+
&= \tilde{U}\tilde{U}^T \tilde{\Lambda} \tilde{U}\tilde{U}^T \\
401+
&= \tilde{\Lambda} \, ,
402+
403+
we find that it is diagonal, which demonstrates that the training/validation data are statistically independent indeed.

doc/sphinx/source/theory_params.csv

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,12 @@ Field/key, Type, Description, Comments
22
ID, Integer, TheoryID, Theory enumerating ID
33
PTO, Integer, pQCD order, (0/1/2 = LO/NLO/NNLO)
44
FNS, Text, Flavour Number Scheme, "e.g FONLL-A/B/C, ZM-VFNS or FFNS"
5-
DAMP, Integer, FONLL damping factor switch, Boolean
65
IC, Integer, Intrinsic charm switch, Boolean
76
ModEv, Text, DGLAP solution mode, EXA/EXP/TRN
87
XIR, Real, :math:`\xi_R`, :math:`\mu_R/Q`
98
XIF, Real, :math:`\xi_F`, :math:`\mu_F/Q`
10-
NfFF, Integer, Number of flavours in the FFNS, 3/4/5/6
11-
MaxNfAs, Integer, :math:`n^{(\alpha_s)}_{f \textrm{max}}`, Max active flavours in :math:`\alpha_s`
12-
MaxNfPdf, Integer, :math:`n^{(PDF)}_{f \textrm{max}}`, Max active flavours in PDFs
13-
Q0, Real, :math:`Q_0`, FK Table initial scale
14-
alphas, Real, Strong coupling, Format: :math:`\alpha_s(Q_{\textrm{ref}})`
15-
Qref, Real, :math:`Q_{\textrm{ref}}`, Reference scale for :math:`\alpha_S` in GeV
169
QED, Integer, QED switch, Boolean
17-
alphaqed, Real, QED coupling, Format: :math:`\alpha_{QED}(Q_{\textrm{qedref}})`
18-
Qedref, Real, :math:`Q_{\textrm{qedref}}`, QED reference scale (GeV)
19-
SxRes, Integer, small-:math:`x` resummation switch, Boolean
20-
SxOrd, Text, small-:math:`x` pt switch, "('LL', 'NLL', 'NLL')"
21-
HQ, Text, HQ mass treatment, POLE/MSBAR
10+
Q0, Real, :math:`Q_0`, FK Table initial scale
2211
mc, Real, :math:`c` quark mass :math:`M_c/m_c(Q_{mc})`, Units: GeV
2312
Qmc, Real, :math:`Q_{mc}`, :math:`c` reference scale (GeV)
2413
kcThr, Real, :math:`c` production threshold ratio, Ratio to :math:`m_c`
@@ -35,6 +24,28 @@ GF, Real, :math:`G_F`, Fermi coupling constant
3524
SIN2TW, Real, :math:`\sin^2\theta_W`,
3625
TMC, Integer, Target mass corrections, Boolean
3726
MP, Real, :math:`M_P` Proton mass, Units: GeV
27+
Comments, Text, General comments
28+
alphas, Real, Strong coupling, Format: :math:`\alpha_s(Q_{\textrm{ref}})`
29+
alphaqed, Real, QED coupling, Format: :math:`\alpha_{QED}(Q_{\textrm{qedref}})`
30+
Qref, Real, :math:`Q_{\textrm{ref}}`, Reference scale for :math:`\alpha_S` and :math:`\alpha_{\rm EW}` in GeV
31+
XIA, Real, :math:`\xi_A`, :math:`\mu_A/Q`
32+
NfFF, Integer, Number of flavours in the FFNS, 3/4/5/6
33+
nfref, Integer, :math:`n_f^{(\textrm{ref})}`, Number of active flavours at :math:`Q_{\textrm{ref}}`
34+
MaxNfPdf, Integer, :math:`n_f^{\textrm{max}}`, Used by pineko and the photon module to define the thresholds
35+
nf0, Integer, :math:`n_f^{(0)}`, Number of active flavours at :math:`Q_0`
36+
HQ, Text, HQ mass treatment, POLE/MSBAR
37+
IterEv, Integer, iterations for the evolution of the PDF, Defaults to 60 when ModEv = EXA
38+
ModSV, Text, Scale variation scheme, expanded/exponentiated
39+
DAMP, Integer, FONLL damping factor switch, Boolean
40+
DAMPPOWERc, Integer, Damping power for charm in FONLL, needed when DAMP and FONLL are used
41+
DAMPPOWERb, Integer, Damping power for bottom in FONLL, needed when DAMP and FONLL are used
42+
n3lo_ad_variation, List, IHOU variation of the N3LO anomalous dimensions, Order is (gg, gq, qg, qq, nsp, nsm, nsv)
43+
with values 0 or 1 for FHMRUVV
44+
n3lo_cf_variation, List, IHOU variations of the N3LO massive DIS coefficient functions, Values are -1, 0, 1
45+
use_fhmruvv, Integer, use N3LO anomalous dimensions by FHMRUVV group, Boolean
46+
MaxNfAs, Integer, :math:`n^{(\alpha_s)}_{f \textrm{max}}`, Max active flavours in :math:`\alpha_s`
47+
SxRes, Integer, small-:math:`x` resummation switch, Boolean
48+
SxOrd, Text, small-:math:`x` pt switch, "('LL', 'NLL', 'NLL')"
49+
EScaleVar, Integer, Switch for DGLAP scale variation, Boolean
50+
Qedref, Real, :math:`Q_{\textrm{qedref}}`, QED reference scale (GeV)
3851
global_nx, Integer, Global x-grid precision, Default (0) uses set-by-set precision
39-
EScaleVar, Real, Switch for DGLAP scale variation, Boolean
40-
Comments, Text, General comments,

doc/sphinx/source/tutorials/datthcomp.rst

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ You need to provide:
1010
1. A PDF which includes your data set;
1111
2. A valid theory ID;
1212
3. A choice of cuts policy;
13-
4. A list of data sets to do the comparison for.
13+
4. A list of data sets to do the comparison for;
14+
5. Options to shift theoretical predictions according to the correlated part of the experimental uncertainties and/or to normalise the comparison to the central value of the experimental data.
1415

1516
Below is an example runcard for a data theory comparison for BCDMSP, ``runcard.yaml``:
1617

@@ -21,38 +22,30 @@ Below is an example runcard for a data theory comparison for BCDMSP, ``runcard.y
2122
keywords: [example]
2223
author: Rosalyn Pearson
2324
24-
pdfs:
25-
- id: NNPDF31_nnlo_as_0118
26-
label: NNPDF31_nnlo_as_0118
27-
28-
theoryid: 53
29-
30-
use_cuts: false
25+
dataspecs:
26+
- speclabel: "NNPDF40 (w/o shift)"
27+
theoryid: 40_000_000
28+
use_cuts: "internal"
29+
with_shift: False
30+
pdf: NNPDF40_nnlo_as_01180
31+
- speclabel: "NNPDF40 (w/ shift)"
32+
theoryid: 40_000_000
33+
use_cuts: "internal"
34+
with_shift: True
35+
pdf: NNPDF40_nnlo_as_01180
3136
3237
dataset_inputs:
33-
- { dataset: BCDMSP}
38+
- { dataset: HERA_NC_318GEV_EAVG_BOTTOM-SIGMARED, variant: legacy}
39+
- { dataset: ATLAS_1JET_8TEV_R06, variant: legacy}
40+
- { dataset: BCDMS_NC_NOTFIXED_P_EM-F2, variant: legacy}
3441
35-
template: dthcomparison.md
42+
template_text: |
43+
# Data theory comparison with and without shifts
44+
{@ with dataset_inputs @}
45+
{@ plot_fancy_dataspecs(normalize_to=data) @}
46+
{@ endwith @}
3647
3748
actions_:
3849
- report(main=true)
3950
40-
The corresponding template, ``dthcomparison.md``, looks like this:
41-
42-
.. code:: yaml
43-
44-
%BCDMSP (theory ID 52)
45-
46-
{@ dataset_inputs plot_fancy @}
47-
{@ dataset_inputs::pdfs plot_fancy(normalize_to=data)@}
48-
{@ dataset_inputs::pdfs plot_chi2dist @}
49-
{@ dataset_inputs::pdfs group_result_table @}
50-
51-
1. ``plot_fancy`` produces data-theory comparison plots for the data. This is called
52-
twice to produce both normalised and unnormalised sets of plots.
53-
2. ``plot_chi2dist`` gives the chi2 distribution between the theory and data.
54-
3. ``group_result_table`` gives the numerical values which appear in the plots.
55-
56-
Running :code:`validphys runcard.yaml` should produce a ``validphys`` report of the data-theory
57-
comparison like the one `here <https://vp.nnpdf.science/ErmVZEPGT42GCfreWwzalg==/>`_ - see the
58-
`vp-guide <https://data.nnpdf.science/validphys-docs/guide.html#development-installs>`_.
51+
The function ``plot_fancy_dataspecs`` produces data-theory comparison plots for the specified list of data for all of the data specifications ``dataspecs``. The code can be run as :code:`validphys runcard.yaml` which will produce a ``validphys`` report with the desired plots. See the runcard ``data_theory_comparison.yaml`` in the validphys ``examples`` folder for details.

0 commit comments

Comments
 (0)