Skip to content
Snippets Groups Projects
Unverified Commit 1229126c authored by Zaharid's avatar Zaharid Committed by GitHub
Browse files

Merge pull request #1287 from NNPDF/pi_fix

Fixing plotting info labeler functions
parents 439d59c6 4da660a3
No related branches found
Tags 4.0.3
No related merge requests found
......@@ -12,12 +12,14 @@ requirements:
- swig
- cmake
- pkg-config
# See https://github.com/NNPDF/nnpdf/pull/1280
- sysroot_linux-64==2.17 # [linux]
host:
- lhapdf # with python wrapper
- sqlite
- gsl # Gsl doesn't link openblas on old debian 7
- libarchive ==3.4.2 # See https://github.com/NNPDF/nnpdf/pull/1130
- yaml-cpp
- yaml-cpp >=0.6.3
- apfel >=3 # see https://github.com/scarrazza/apfel
- python
- numpy
......@@ -34,7 +36,7 @@ requirements:
- gsl
- numpy
- libarchive
- yaml-cpp
- yaml-cpp >=0.6.3
- apfel
- pkg-config
- python # requirements for validphys
......@@ -61,6 +63,7 @@ test:
#Build dependencies for catch tests
- {{ compiler("cxx") }}
- {{ compiler("c") }}
- sysroot_linux-64==2.17 # [linux]
- swig ==3.0.10
- cmake
......
......@@ -26,5 +26,3 @@ vp-setupfit --legacy ../nnpdfcpp/config/testconfig.yml
chi2check testconfig NNPDF31_nnlo_as_0118
#Print linkage data
conda inspect linkages -p $PREFIX $PKG_NAME
......@@ -13,6 +13,8 @@ import numpy as np
import pandas as pd
import numbers
from validobj import ValidationError
from reportengine.floatformatting import format_number
from reportengine.compat import yaml
from reportengine.utils import get_functions, ChainMap
......@@ -207,6 +209,7 @@ class Scale(enum.Enum):
@dataclasses.dataclass
class PlottingOptions:
func_labels: dict = dataclasses.field(default_factory=dict)
dataset_label: typing.Optional[str] = None
experiment: typing.Optional[str] = None
nnpdf31_process: typing.Optional[str] = None
......@@ -233,6 +236,31 @@ class PlottingOptions:
extra_labels: typing.Optional[typing.Mapping[str, typing.List]] = None
def parse_figure_by(self):
if self.figure_by is not None:
for el in self.figure_by:
if el in labeler_functions:
self.func_labels[el] = labeler_functions[el]
def parse_line_by(self):
if self.line_by is not None:
for el in self.line_by:
if el in labeler_functions:
self.func_labels[el] = labeler_functions[el]
def parse_x(self):
if self.x is not None and self.x not in self.all_labels:
raise ValidationError(
f"The label {self.x} is not in the set of known labels {self.all_labels}"
)
@property
def all_labels(self):
if self.extra_labels is None:
return set(default_labels)
return set(self.extra_labels.keys()).union(set(default_labels))
def __post_init__(self):
if self.kinematics_override is not None:
self.kinematics_override = transform_functions[
......@@ -241,6 +269,10 @@ class PlottingOptions:
if self.result_transform is not None:
self.result_transform = result_functions[self.result_transform.name]
self.parse_figure_by()
self.parse_line_by()
self.parse_x()
@dataclasses.dataclass
class PlottingFile(PlottingOptions):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment