Skip to content

Commit

Permalink
Merge pull request #1626 from NNPDF/not0flags
Browse files Browse the repository at this point in the history
Remove additional t0 flags
  • Loading branch information
Zaharid committed Nov 15, 2022
2 parents 94b80c3 + 9881880 commit 110f814
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 53 deletions.
5 changes: 0 additions & 5 deletions doc/sphinx/source/tutorials/thcov_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,6 @@ It can be found `here <https://github.com/NNPDF/nnpdf/tree/master/validphys2/exa
use_thcovmat_in_fitting: true
use_thcovmat_in_sampling: true
sampling_t0:
use_t0: false
fitting_t0:
use_t0: true
############################################################
fitting:
Expand Down
2 changes: 1 addition & 1 deletion n3fit/runcards/examples/Basic_feature_scaling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ datacuts:
theory:
theoryid: 200 # database id
sampling:
use_t0: false
separate_multiplicative: true

############################################################
trvlseed: 1
nnseed: 2
Expand Down
2 changes: 0 additions & 2 deletions n3fit/runcards/examples/Basic_hyperopt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ theory:
theoryid: 200 # database id

sampling:
use_t0: false
separate_multiplicative: true

hyperscan_config:
stopping:
min_epochs: 1e3
Expand Down
2 changes: 0 additions & 2 deletions n3fit/runcards/examples/Basic_runcard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ theory:
theoryid: 200 # database id

sampling:
use_t0: false
separate_multiplicative: true

parameters: # This defines the parameter dictionary that is passed to the Model Trainer
nodes_per_layer: [15, 10, 8]
activation_per_layer: ['sigmoid', 'sigmoid', 'linear']
Expand Down
1 change: 0 additions & 1 deletion n3fit/runcards/examples/Basic_runcard_parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ theory:
theoryid: 162 # database id

sampling:
use_t0: false
separate_multiplicative: true
############################################################
trvlseed: 1
Expand Down
2 changes: 0 additions & 2 deletions n3fit/runcards/examples/DIS_diagonal_l2reg_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ theory:
theoryid: 162 # database id

sampling:
use_t0: false
separate_multiplicative: true

############################################################
trvlseed: 1
nnseed: 2
Expand Down
3 changes: 0 additions & 3 deletions n3fit/runcards/examples/Fit_with_theory_covmat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ theorycovmatconfig:
use_thcovmat_in_fitting: true
use_thcovmat_in_sampling: true

sampling:
use_t0: false
separate_multiplicative: false

############################################################
trvlseed: 376191634
Expand Down
2 changes: 0 additions & 2 deletions n3fit/runcards/examples/developing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ theory:
theoryid: 200 # database id

sampling:
use_t0: false
separate_multiplicative: true

############################################################
trvlseed: 1
nnseed: 2
Expand Down
2 changes: 0 additions & 2 deletions n3fit/src/n3fit/scripts/n3fit_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ def from_yaml(cls, o, *args, **kwargs):
N3FIT_FIXED_CONFIG['use_scalevar_uncertainties'] = thconfig.get('use_scalevar_uncertainties', True)
#Sampling flags
if (sam_t0:=file_content.get('sampling')) is not None:
N3FIT_FIXED_CONFIG['use_t0_sampling'] = sam_t0.get('use_t0', False)
N3FIT_FIXED_CONFIG['separate_multiplicative'] = sam_t0.get('separate_multiplicative', True)
#Fitting flag
N3FIT_FIXED_CONFIG['use_t0_fitting'] = file_content.get('fitting').get('use_t0', True)
file_content.update(N3FIT_FIXED_CONFIG)
return cls(file_content, *args, **kwargs)

Expand Down
45 changes: 12 additions & 33 deletions validphys2/src/validphys/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ def produce_dataset_inputs_fitting_covmat(
self,
theory_covmat_flag=False,
use_thcovmat_in_fitting=False,
use_t0_fitting=True,
):
"""
Produces the correct covmat to be used in fitting_data_dict according
Expand All @@ -723,24 +722,16 @@ def produce_dataset_inputs_fitting_covmat(
"""
from validphys import covmats

if use_t0_fitting:
if theory_covmat_flag and use_thcovmat_in_fitting:
return covmats.dataset_inputs_t0_total_covmat
else:
return covmats.dataset_inputs_t0_exp_covmat
else:
if theory_covmat_flag and use_thcovmat_in_fitting:
return covmats.dataset_inputs_total_covmat
else:
return covmats.dataset_inputs_exp_covmat
if theory_covmat_flag and use_thcovmat_in_fitting:
return covmats.dataset_inputs_t0_total_covmat
return covmats.dataset_inputs_t0_exp_covmat

@configparser.explicit_node
def produce_dataset_inputs_sampling_covmat(
self,
sep_mult,
theory_covmat_flag=False,
use_thcovmat_in_sampling=False,
use_t0_sampling=False,
):
"""
Produces the correct covmat to be used in make_replica according
Expand All @@ -750,28 +741,16 @@ def produce_dataset_inputs_sampling_covmat(
"""
from validphys import covmats

if use_t0_sampling:
if theory_covmat_flag and use_thcovmat_in_sampling:
if sep_mult:
return covmats.dataset_inputs_t0_total_covmat_separate
else:
return covmats.dataset_inputs_t0_total_covmat
if theory_covmat_flag and use_thcovmat_in_sampling:
if sep_mult:
return covmats.dataset_inputs_total_covmat_separate
else:
if sep_mult:
return covmats.dataset_inputs_t0_exp_covmat_separate
else:
return covmats.dataset_inputs_t0_exp_covmat
return covmats.dataset_inputs_total_covmat
else:
if theory_covmat_flag and use_thcovmat_in_sampling:
if sep_mult:
return covmats.dataset_inputs_total_covmat_separate
else:
return covmats.dataset_inputs_total_covmat
if sep_mult:
return covmats.dataset_inputs_exp_covmat_separate
else:
if sep_mult:
return covmats.dataset_inputs_exp_covmat_separate
else:
return covmats.dataset_inputs_exp_covmat
return covmats.dataset_inputs_exp_covmat

def produce_loaded_theory_covmat(
self,
Expand Down Expand Up @@ -1051,12 +1030,12 @@ def parse_use_t0(self, do_use_t0: bool):

# TODO: Find a good name for this
def produce_t0set(
self, t0pdfset=None, use_t0_sampling=False, use_t0_fitting=True,
self, t0pdfset=None, use_t0=False,
):
"""Return the t0set if use_t0 is True and None otherwise. Raises an
error if t0 is requested but no t0set is given.
"""
if use_t0_sampling or use_t0_fitting:
if use_t0:
if not t0pdfset:
raise ConfigError("Setting use_t0 requires specifying a valid t0pdfset")
return t0pdfset
Expand Down

0 comments on commit 110f814

Please sign in to comment.