Skip to content
Merged
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
32 changes: 12 additions & 20 deletions nnpdf_data/nnpdf_data/new_commondata/ATHENA_NC_105GEV_EP/filter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import yaml
import numpy as np
import pandas as pd

from pathlib import Path
from typing import Optional, Union

import numpy as np
import pandas as pd
import yaml

np.random.seed(1234567890)


Expand Down Expand Up @@ -57,9 +57,7 @@ def fluctuate_data(central: np.ndarray, abserr: np.ndarray) -> np.ndarray:


def write_data(
df: pd.DataFrame,
abserr: Optional[Union[np.ndarray, None]] = None,
add_fluctuate: bool = False,
df: pd.DataFrame, abserr: Optional[Union[np.ndarray, None]] = None, add_fluctuate: bool = False
) -> None:
"""Write the input kinematics, central values, and uncertainties
into the new commondata format.
Expand Down Expand Up @@ -106,9 +104,7 @@ def write_data(
errors = []
for idx, (_, d) in enumerate(df.iterrows()):
if not add_fluctuate:
errors.append(
{"stat": None, "sys": None, "shift_lumi": None, "norm": None}
)
errors.append({"stat": None, "sys": None, "shift_lumi": None, "norm": None})
else:
errors.append(
{
Expand All @@ -120,25 +116,21 @@ def write_data(
)

error_definition = {
"stat": {
"description": "statistical uncertainty",
"treatment": "ADD",
"type": "UNCORR",
},
"stat": {"description": "statistical uncertainty", "treatment": "ADD", "type": "UNCORR"},
"sys": {
"description": "systematic uncertainty",
"treatment": "MULT", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "UNCORR",
},
"shift_lumi": {
"description": "uncertainty on the precision of the relative luminosity",
"treatment": "ADD",
"type": "UNCORR", # TODO: to check
"type": "UNCORR", # TODO: to check
},
"norm": {
"description": "relative (percent) normalization uncertainty (beam pol)",
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
},
}

Expand All @@ -153,4 +145,4 @@ def write_data(
xdf = read_excel(input_xlsx, beams=BEAMS)
cv_preds = read_cvs()
fluctuated_cv = fluctuate_data(cv_preds, xdf["delta_ALL"].values)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
30 changes: 11 additions & 19 deletions nnpdf_data/nnpdf_data/new_commondata/ATHENA_NC_140GEV_EP/filter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import yaml
import numpy as np
import pandas as pd

from pathlib import Path
from typing import Optional, Union

import numpy as np
import pandas as pd
import yaml

np.random.seed(1234567890)


Expand Down Expand Up @@ -51,9 +51,7 @@ def fluctuate_data(central: np.ndarray, abserr: np.ndarray) -> np.ndarray:


def write_data(
df: pd.DataFrame,
abserr: Optional[Union[np.ndarray, None]] = None,
add_fluctuate: bool = False,
df: pd.DataFrame, abserr: Optional[Union[np.ndarray, None]] = None, add_fluctuate: bool = False
) -> None:
"""Write the input kinematics, central values, and uncertainties
into the new commondata format.
Expand Down Expand Up @@ -102,9 +100,7 @@ def write_data(
errors = []
for idx, (_, d) in enumerate(df.iterrows()):
if not add_fluctuate:
errors.append(
{"stat": None, "sys": None, "shift_lumi": None, "norm": None}
)
errors.append({"stat": None, "sys": None, "shift_lumi": None, "norm": None})
else:
errors.append(
{
Expand All @@ -117,25 +113,21 @@ def write_data(
print(f"[+] The number of uncertainty points is {len(errors)}")

error_definition = {
"stat": {
"description": "statistical uncertainty",
"treatment": "ADD",
"type": "UNCORR",
},
"stat": {"description": "statistical uncertainty", "treatment": "ADD", "type": "UNCORR"},
"sys": {
"description": "systematic uncertainty",
"treatment": "MULT", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "UNCORR",
},
"shift_lumi": {
"description": "uncertainty on the precision of the relative luminosity",
"treatment": "ADD",
"type": "UNCORR", # TODO: to check
"type": "UNCORR", # TODO: to check
},
"norm": {
"description": "relative (percent) normalization uncertainty (beam pol)",
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
},
}

Expand Down
32 changes: 12 additions & 20 deletions nnpdf_data/nnpdf_data/new_commondata/ATHENA_NC_29GEV_EP/filter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import yaml
import numpy as np
import pandas as pd

from pathlib import Path
from typing import Optional, Union

import numpy as np
import pandas as pd
import yaml

np.random.seed(1234567890)


Expand Down Expand Up @@ -57,9 +57,7 @@ def fluctuate_data(central: np.ndarray, abserr: np.ndarray) -> np.ndarray:


def write_data(
df: pd.DataFrame,
abserr: Optional[Union[np.ndarray, None]] = None,
add_fluctuate: bool = False,
df: pd.DataFrame, abserr: Optional[Union[np.ndarray, None]] = None, add_fluctuate: bool = False
) -> None:
"""Write the input kinematics, central values, and uncertainties
into the new commondata format.
Expand Down Expand Up @@ -106,9 +104,7 @@ def write_data(
errors = []
for idx, (_, d) in enumerate(df.iterrows()):
if not add_fluctuate:
errors.append(
{"stat": None, "sys": None, "shift_lumi": None, "norm": None}
)
errors.append({"stat": None, "sys": None, "shift_lumi": None, "norm": None})
else:
errors.append(
{
Expand All @@ -120,25 +116,21 @@ def write_data(
)

error_definition = {
"stat": {
"description": "statistical uncertainty",
"treatment": "ADD",
"type": "UNCORR",
},
"stat": {"description": "statistical uncertainty", "treatment": "ADD", "type": "UNCORR"},
"sys": {
"description": "systematic uncertainty",
"treatment": "MULT", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "UNCORR",
},
"shift_lumi": {
"description": "uncertainty on the precision of the relative luminosity",
"treatment": "ADD",
"type": "UNCORR", # TODO: to check
"type": "UNCORR", # TODO: to check
},
"norm": {
"description": "relative (percent) normalization uncertainty (beam pol)",
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
},
}

Expand All @@ -153,4 +145,4 @@ def write_data(
xdf = read_excel(input_xlsx, beams=BEAMS)
cv_preds = read_cvs()
fluctuated_cv = fluctuate_data(cv_preds, xdf["delta_ALL"].values)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
32 changes: 12 additions & 20 deletions nnpdf_data/nnpdf_data/new_commondata/ATHENA_NC_45GEV_EP/filter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import yaml
import numpy as np
import pandas as pd

from pathlib import Path
from typing import Optional, Union

import numpy as np
import pandas as pd
import yaml

np.random.seed(1234567890)


Expand Down Expand Up @@ -57,9 +57,7 @@ def fluctuate_data(central: np.ndarray, abserr: np.ndarray) -> np.ndarray:


def write_data(
df: pd.DataFrame,
abserr: Optional[Union[np.ndarray, None]] = None,
add_fluctuate: bool = False,
df: pd.DataFrame, abserr: Optional[Union[np.ndarray, None]] = None, add_fluctuate: bool = False
) -> None:
"""Write the input kinematics, central values, and uncertainties
into the new commondata format.
Expand Down Expand Up @@ -106,9 +104,7 @@ def write_data(
errors = []
for idx, (_, d) in enumerate(df.iterrows()):
if not add_fluctuate:
errors.append(
{"stat": None, "sys": None, "shift_lumi": None, "norm": None}
)
errors.append({"stat": None, "sys": None, "shift_lumi": None, "norm": None})
else:
errors.append(
{
Expand All @@ -120,25 +116,21 @@ def write_data(
)

error_definition = {
"stat": {
"description": "statistical uncertainty",
"treatment": "ADD",
"type": "UNCORR",
},
"stat": {"description": "statistical uncertainty", "treatment": "ADD", "type": "UNCORR"},
"sys": {
"description": "systematic uncertainty",
"treatment": "MULT", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "UNCORR",
},
"shift_lumi": {
"description": "uncertainty on the precision of the relative luminosity",
"treatment": "ADD",
"type": "UNCORR", # TODO: to check
"type": "UNCORR", # TODO: to check
},
"norm": {
"description": "relative (percent) normalization uncertainty (beam pol)",
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
},
}

Expand All @@ -153,4 +145,4 @@ def write_data(
xdf = read_excel(input_xlsx, beams=BEAMS)
cv_preds = read_cvs()
fluctuated_cv = fluctuate_data(cv_preds, xdf["delta_ALL"].values)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
32 changes: 12 additions & 20 deletions nnpdf_data/nnpdf_data/new_commondata/ATHENA_NC_63GEV_EP/filter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import yaml
import numpy as np
import pandas as pd

from pathlib import Path
from typing import Optional, Union

import numpy as np
import pandas as pd
import yaml

np.random.seed(1234567890)


Expand Down Expand Up @@ -57,9 +57,7 @@ def fluctuate_data(central: np.ndarray, abserr: np.ndarray) -> np.ndarray:


def write_data(
df: pd.DataFrame,
abserr: Optional[Union[np.ndarray, None]] = None,
add_fluctuate: bool = False,
df: pd.DataFrame, abserr: Optional[Union[np.ndarray, None]] = None, add_fluctuate: bool = False
) -> None:
"""Write the input kinematics, central values, and uncertainties
into the new commondata format.
Expand Down Expand Up @@ -106,9 +104,7 @@ def write_data(
errors = []
for idx, (_, d) in enumerate(df.iterrows()):
if not add_fluctuate:
errors.append(
{"stat": None, "sys": None, "shift_lumi": None, "norm": None}
)
errors.append({"stat": None, "sys": None, "shift_lumi": None, "norm": None})
else:
errors.append(
{
Expand All @@ -120,25 +116,21 @@ def write_data(
)

error_definition = {
"stat": {
"description": "statistical uncertainty",
"treatment": "ADD",
"type": "UNCORR",
},
"stat": {"description": "statistical uncertainty", "treatment": "ADD", "type": "UNCORR"},
"sys": {
"description": "systematic uncertainty",
"treatment": "MULT", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "UNCORR",
},
"shift_lumi": {
"description": "uncertainty on the precision of the relative luminosity",
"treatment": "ADD",
"type": "UNCORR", # TODO: to check
"type": "UNCORR", # TODO: to check
},
"norm": {
"description": "relative (percent) normalization uncertainty (beam pol)",
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
"treatment": "MULT", # TODO: to check
"type": "CORR", # TODO: to check
},
}

Expand All @@ -153,4 +145,4 @@ def write_data(
xdf = read_excel(input_xlsx, beams=BEAMS)
cv_preds = read_cvs()
fluctuated_cv = fluctuate_data(cv_preds, xdf["delta_ALL"].values)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
write_data(xdf, abserr=fluctuated_cv, add_fluctuate=True)
Loading