Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion validphys2/src/validphys/dataplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ def plot_smpdf(pdf, dataset, obs_pdf_correlations, mark_threshold: float = 0.9):
--------
>>> from validphys.api import API
>>> data_input = {
>>> "dataset_input" : {"dataset": "HERACOMBNCEP920"},
>>> "dataset_input" : {"dataset": "HERA_NC_318GEV_EP-SIGMARED"},
>>> "theoryid": 200,
>>> "use_cuts": "internal",
>>> "pdf": "NNPDF40_nnlo_as_01180",
Expand Down
2 changes: 1 addition & 1 deletion validphys2/src/validphys/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ def get_cuts_for_dataset(commondata, rules) -> list:
... default_filter_settings, default_filter_rules_input)
>>> from validphys.loader import Loader
>>> l = Loader()
>>> cd = l.check_commondata("NMC")
>>> cd = l.check_commondata("NMC_NC_NOTFIXED_P_EM-SIGMARED", variant="legacy")
>>> theory = l.check_theoryID(53)
>>> filter_defaults = default_filter_settings()
>>> params = theory.get_description()
Expand Down
19 changes: 14 additions & 5 deletions validphys2/src/validphys/n3fit_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,19 @@ def kfold_masks(kpartitions, data):
--------
>>> from validphys.api import API
>>> partitions=[
... {"datasets": ["HERACOMBCCEM", "HERACOMBNCEP460", "NMC", "NTVNBDMNFe"]},
... {"datasets": ["HERACOMBCCEP", "HERACOMBNCEP575", "NMCPD", "NTVNUDMNFe"]}
... {"datasets": ["HERA_CC_318GEV_EM-SIGMARED", "HERA_NC_225GEV_EP-SIGMARED", "NMC_NC_NOTFIXED_P_EM-SIGMARED", "NUTEV_CC_NOTFIXED_FE_NB-SIGMARED"]},
... {"datasets": ["HERA_CC_318GEV_EP-SIGMARED", "HERA_NC_251GEV_EP-SIGMARED", "NMC_NC_NOTFIXED_EM-F2", "NUTEV_CC_NOTFIXED_FE_NU-SIGMARED"]}
... ]
>>> ds_inputs = [
... {"dataset": "HERA_CC_318GEV_EM-SIGMARED"},
... {"dataset": "HERA_NC_225GEV_EP-SIGMARED"},
... {"dataset": "NMC_NC_NOTFIXED_P_EM-SIGMARED", "variant": "legacy"},
... {"dataset": "NUTEV_CC_NOTFIXED_FE_NB-SIGMARED", "variant": "legacy_dw"},
... {"dataset": "HERA_CC_318GEV_EP-SIGMARED"},
... {"dataset": "HERA_NC_251GEV_EP-SIGMARED"},
... {"dataset": "NMC_NC_NOTFIXED_EM-F2", "variant": "legacy_dw"},
... {"dataset": "NUTEV_CC_NOTFIXED_FE_NU-SIGMARED", "variant": "legacy_dw"},
... ]
>>> ds_inputs = [{"dataset": ds} for part in partitions for ds in part["datasets"]]
>>> kfold_masks = API.kfold_masks(dataset_inputs=ds_inputs, kpartitions=partitions, theoryid=53, use_cuts="nocuts")
>>> len(kfold_masks) # one element for each partition
2
Expand Down Expand Up @@ -774,7 +783,7 @@ def replica_mask(exps_masks, replica, experiments_index, diagonal_basis=True):
>>> from validphys.api import API
>>> ds_inp = [
... {'dataset': 'NMC_NC_NOTFIXED_P_EM-SIGMARED', 'variant': 'legacy', 'frac': 0.75},
... {'dataset': 'ATLAS_TTBAR_7TEV_TOT_X-SEC', 'variant': 'legacy_theory', 'frac': 0.75},
... {'dataset': 'ATLAS_TTBAR_7TEV_TOT_X-SEC', 'frac': 0.75},
... {'dataset': 'CMS_Z0J_8TEV_PT-Y', 'cfac':('NRM',), 'frac': 0.75},
... ]
>>> API.replica_training_mask(dataset_inputs=ds_inp, replica=1, trvlseed=123, theoryid=40_000_000, use_cuts="nocuts", mcseed=None, genrep=False)
Expand Down Expand Up @@ -881,7 +890,7 @@ def integdatasets_fitting_integ_dict(integdatasets=None):
Examples
--------
>>> from validphys.api import API
>>> integdatasets = [{"dataset": "INTEGXT3", "maxlambda": 1e2}]
>>> integdatasets = [{"dataset": "NNPDF_INTEG_3GEV_XT3", "maxlambda": 1e2}]
>>> res = API.integdatasets_fitting_integ_dict(integdatasets=integdatasets, theoryid=53)
>>> len(res), len(res[0])
(1, 9)
Expand Down
24 changes: 16 additions & 8 deletions validphys2/src/validphys/pseudodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def read_replica_pseudodata(fit, context_index, replica):
>>> rep_info.pseudodata.loc[rep_info.tr_idx].head()
replica 1
group dataset id
ATLAS ATLASZPT8TEVMDIST 1 30.665835
ATLAS ATLAS_Z0J_8TEV_PT-M 1 30.665835

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, instead of changing this manually you should run the code above and update the info (you will see that you cannot use pseudodata_test_fit_n3fit and have to use an updated version such as pseudodata_test_fit_n3fit_260518), which has 15 replicas instead of 10 and which has ATLAS_Z0_7TEV_46FB_CC-Y as first dataset.

3 15.795880
4 8.769734
5 3.117819
Expand Down Expand Up @@ -222,7 +222,10 @@ def make_replica(
-------
>>> from validphys.api import API
>>> pseudodata = API.make_replica(
dataset_inputs=[{"dataset":"NMC"}, {"dataset": "NMCPD"}],
dataset_inputs=[
{"dataset": "NMC_NC_NOTFIXED_P_EM-SIGMARED", "variant": "legacy"},
{"dataset": "NMC_NC_NOTFIXED_EM-F2", "variant": "legacy_dw"},
],
use_cuts="nocuts",
theoryid=53,
replica=1,
Expand Down Expand Up @@ -380,9 +383,14 @@ def level0_commondata_wc(data, fakepdf):
Example
-------
>>> from validphys.api import API
>>> API.level0_commondata_wc(dataset_inputs = [{"dataset":"NMC"}], use_cuts="internal", theoryid=200,fakepdf = "NNPDF40_nnlo_as_01180")

[CommonData(setname='NMC', ndata=204, commondataproc='DIS_NCE', nkin=3, nsys=16)]
>>> API.level0_commondata_wc(
... dataset_inputs=[{"dataset": "NMC_NC_NOTFIXED_P_EM-SIGMARED", "variant": "legacy"}],
... use_cuts="internal",
... theoryid=200,
... fakepdf="NNPDF40_nnlo_as_01180",
... )

[CommonData(setname='NMC_NC_NOTFIXED_P_EM-SIGMARED', ndata=204, commondataproc='DIS_NCE', nkin=3, nsys=16)]
"""
from validphys.covmats import dataset_t0_predictions

Expand Down Expand Up @@ -456,11 +464,11 @@ def make_level1_data(data, level0_commondata_wc, filterseed, data_index, sep_mul
-------

>>> from validphys.api import API
>>> dataset='NMC'
>>> l1_cd = API.make_level1_data(dataset_inputs = [{"dataset":dataset}],use_cuts="internal", theoryid=200,
>>> dataset = {"dataset": "NMC_NC_NOTFIXED_P_EM-SIGMARED", "variant": "legacy"}
>>> l1_cd = API.make_level1_data(dataset_inputs=[dataset], use_cuts="internal", theoryid=200,
fakepdf = "NNPDF40_nnlo_as_01180",filterseed=1)
>>> l1_cd
[CommonData(setname='NMC', ndata=204, commondataproc='DIS_NCE', nkin=3, nsys=16)]
[CommonData(setname='NMC_NC_NOTFIXED_P_EM-SIGMARED', ndata=204, commondataproc='DIS_NCE', nkin=3, nsys=16)]
"""

dataset_input_list = list(data.dsinputs)
Expand Down
2 changes: 1 addition & 1 deletion validphys2/src/validphys/tests/test_fitdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def test_print_different_cuts():
"""Checks the print_different_cuts functions
using two fits with a different choice of q2min and w2min in the runcard
One of the datasets (SLACP) gets 0 points in in the most restrictive case
One of the datasets (SLAC_NC_NOTFIXED_P_EM-F2) gets 0 points in the most restrictive case
The different cuts are:
q2min: 3.49 - 13.49
w2min: 12.5 - 22.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_pc_type(
Returns
-------
str or tuple of (str, str)
The PC type key(s). For the NMC ratio dataset
The PC type key(s). For the ratio dataset

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I think NMC was acting more as a noun referring to the NMC collaboration itself. But it's ok, it reads good either way

(``NMC_NC_NOTFIXED_EM-F2``), returns ``("f2p", "f2d")``.
For all other datasets, returns a single string key.

Expand Down
8 changes: 4 additions & 4 deletions validphys2/src/validphys/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def experiments_to_dataset_inputs(experiments_list):
>>> fit = API.fit(fit='NNPDF31_nnlo_as_0118_1000')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Instead of updating the results of the code, you should update the fit instead.

A recent one you can use is: nnpdf40-like_t0_sampling, and below instead of experiments which doesn't exist anymore, you need to use dataset_inputs = fit.as_input()['dataset_inputs']

>>> experiments = fit.as_input()['experiments']
>>> dataset_inputs = experiments_to_dataset_inputs(experiments)
>>> dataset_inputs[:3]
[{'dataset': 'NMCPD', 'frac': 0.5},
{'dataset': 'NMC', 'frac': 0.5},
{'dataset': 'SLACP', 'frac': 0.5}]
>>> [{k: v for k, v in ds.items() if k != 'frac'} for ds in dataset_inputs[:3]]
[{'dataset': 'NMC_NC_NOTFIXED_EM-F2', 'variant': 'legacy_dw'},
{'dataset': 'NMC_NC_NOTFIXED_P_EM-SIGMARED', 'variant': 'legacy'},
{'dataset': 'SLAC_NC_NOTFIXED_P_EM-F2', 'variant': 'legacy_dw'}]
"""
dataset_inputs = []
for experiment in experiments_list:
Expand Down
Loading