diff --git a/n3fit/runcards/examples/Basic_runcard.yml b/n3fit/runcards/examples/Basic_runcard.yml index 89a3294dd4..e64260d3bd 100644 --- a/n3fit/runcards/examples/Basic_runcard.yml +++ b/n3fit/runcards/examples/Basic_runcard.yml @@ -23,6 +23,8 @@ datacuts: theory: theoryid: 708 # database id +resample_negative_pseudodata: True + sampling: separate_multiplicative: true parameters: # This defines the parameter dictionary that is passed to the Model Trainer diff --git a/validphys2/src/validphys/pseudodata.py b/validphys2/src/validphys/pseudodata.py index 963696383b..c12368f13e 100644 --- a/validphys2/src/validphys/pseudodata.py +++ b/validphys2/src/validphys/pseudodata.py @@ -129,6 +129,7 @@ def make_replica( sep_mult, genrep=True, max_tries=int(1e6), + resample_negative_pseudodata=True, ): """Function that takes in a list of :py:class:`validphys.coredata.CommonData` objects and returns a pseudodata replica accounting for @@ -163,6 +164,8 @@ def make_replica( If after max_tries (default=1e6) no physical configuration is found, it will raise a :py:class:`ReplicaGenerationError` + resample_negative_pseudodata: bool + When True, replicas that produce negative predictions will be resampled for ``max_tries`` until all points are positive (default: True) Returns ------- pseudodata: np.array @@ -263,7 +266,7 @@ def make_replica( # Shifting pseudodata shifted_pseudodata = (all_pseudodata + shifts) * mult_part # positivity control - if np.all(shifted_pseudodata[full_mask] >= 0): + if np.all(shifted_pseudodata[full_mask] >= 0) or not resample_negative_pseudodata: return shifted_pseudodata dfail = " ".join(i.setname for i in groups_dataset_inputs_loaded_cd_with_cuts)