Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d227917
use_t0_sampling in explicit node of production rule
comane Mar 17, 2025
feebbd1
added docstring to produce_dataset_inputs_sampling_covmat method
comane Mar 19, 2025
dfa9ac6
t0 sampling in default nnpdf40-like runcard
comane Mar 19, 2025
2417c2b
added docs on t0-sampling to n3fit runcard detailed guide
comane Mar 19, 2025
bc9ff6a
updated docs and default values so that use_t0_sampling is used as de…
comane Mar 19, 2025
e1ed008
use_t0_sampling in explicit node of production rule
comane Mar 17, 2025
d1c1057
added docstring to produce_dataset_inputs_sampling_covmat method
comane Mar 19, 2025
a4ae379
t0 sampling in default nnpdf40-like runcard
comane Mar 19, 2025
bfc58b9
added docs on t0-sampling to n3fit runcard detailed guide
comane Mar 19, 2025
f94c824
updated docs and default values so that use_t0_sampling is used as de…
comane Mar 19, 2025
c3a29a9
Automatically regenerated regressions from PR 2300, branch reactivate…
Mar 24, 2025
6d7cd05
Automatically regenerated regressions from PR 2300, branch reactivate…
Mar 24, 2025
94552e0
Merge branch 'master' into reactivate_use_t0_sampling
comane Apr 24, 2025
1ee176a
Merge branch 'reactivate_use_t0_sampling' of https://github.com/NNPDF…
comane Apr 24, 2025
c4ffb9b
fixed test_overfit_metric.py test
comane Apr 24, 2025
e2726f2
fixed test_regression.py
comane Apr 24, 2025
5aaf03a
set use_t0_sampling to False in generate pseudodata tests
comane Apr 24, 2025
b214e5e
use_t0_sampling=True default when loading a fitenvironment
comane Apr 25, 2025
1a46e42
removed use_t0_sampling: False from config for overfit metric
comane Apr 25, 2025
f7b6507
Update validphys2/src/validphys/config.py
comane Apr 28, 2025
15c0c93
added test with use_t0_sampling = True
comane May 7, 2025
ae3c333
test that t0 sampling is different from exp
comane May 7, 2025
def7dd5
Merge branch 'master' into reactivate_use_t0_sampling
comane May 8, 2025
ad71f3f
updated reference set for fitbot
comane May 13, 2025
349c1a3
Merge branch 'reactivate_use_t0_sampling' of https://github.com/NNPDF…
comane May 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions doc/sphinx/source/n3fit/runcard_detailed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,34 @@ to fix it such that it is the same for all replicas with ``same_trvl_per_replica

.. _preprocessing-label:


Monte Carlo replica data
------------------------
The uncertainties on the PDFs are determined trough a Monte Carlo sampling procedure
where each pseudodata replica is generated by adding some noise to the central value
of the data points.
In order to generate the pseudodata, the user can set the following parameter in the runcard:

.. code-block:: yaml

genrep: true

The noise is generated by sampling from a normal distribution
that is centred around zero. There are two options for the covariance matrix
of the noise: the experimental covariance matrix (default)
or the t0 covariance matrix.

In order to use the t0-covariance matrix in the pseudodata generation, it is enough
to set

.. code-block:: yaml

use_t0_sampling: true

in the runcard.



Preprocessing
-------------
The behaviour of the preprocessing in the ``n3fit`` code is controlled, as in the old ``nnfit`` code, through the ``fitting:basis`` parameter of the nnpdf runcard.
Expand Down
2 changes: 2 additions & 0 deletions n3fit/runcards/examples/nnpdf40-like.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ theory:
trvlseed: 591866982
nnseed: 945709987
mcseed: 519562661

genrep: true
use_t0_sampling: true

################################################################################
parameters: # This defines the parameter dictionary that is passed to the Model Trainer
Expand Down
47 changes: 37 additions & 10 deletions validphys2/src/validphys/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,25 +798,52 @@ def produce_sep_mult(self, separate_multiplicative=False):

@configparser.explicit_node
def produce_dataset_inputs_sampling_covmat(
self, sep_mult=False, use_thcovmat_in_sampling=False
self, sep_mult=False, use_thcovmat_in_sampling=False, use_t0_sampling=False
):
"""
Produces the correct covmat to be used in make_replica according
to some options: whether to include the theory covmat and whether to
Produces the correct MC replica method sampling covmat to be used in
make_replica according to some options: whether to sample using a t0
covariance matrix, include the theory covmat and whether to
separate the multiplcative errors.

Parameters
----------
sep_mult : bool
Whether to separate the multiplicative errors.
use_thcovmat_in_sampling : bool
Whether to include the theory covariance matrix.
use_t0_sampling : bool
Whether to sample using a t0 covariance matrix.

Returns
-------
Callable
"""
from validphys import covmats

if use_thcovmat_in_sampling:
if sep_mult:
return covmats.dataset_inputs_total_covmat_separate
if use_t0_sampling:
if use_thcovmat_in_sampling:
if sep_mult:
return covmats.dataset_inputs_t0_total_covmat_separate
else:
return covmats.dataset_inputs_t0_total_covmat
else:
return covmats.dataset_inputs_total_covmat
if sep_mult:
return covmats.dataset_inputs_t0_exp_covmat_separate
else:
return covmats.dataset_inputs_t0_exp_covmat

else:
if sep_mult:
return covmats.dataset_inputs_exp_covmat_separate
if use_thcovmat_in_sampling:
if sep_mult:
return covmats.dataset_inputs_total_covmat_separate
else:
return covmats.dataset_inputs_total_covmat
else:
return covmats.dataset_inputs_exp_covmat
if sep_mult:
return covmats.dataset_inputs_exp_covmat_separate
else:
return covmats.dataset_inputs_exp_covmat

def produce_loaded_theory_covmat(
self,
Expand Down
Loading