Skip to content

Commit

Permalink
more suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlehoff committed Feb 22, 2024
1 parent d2b829e commit bb57fe2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions validphys2/src/validphys/commondataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def _get_ported_kinlabel(process_type):
# special case in which the process in DIS- or DYP-like
if process_type[:3] in ("DIS", "DYP"):
return _get_ported_kinlabel(process_type[:3])
if len(process_type.split("_")) > 1:
return _get_process_description(process_type.rsplit("_", 1)[0])
raise KeyError(f"Label {process_type} not recognized in KINLABEL_LATEX")


Expand Down Expand Up @@ -407,11 +409,12 @@ def __post_init__(self):
unused = list(set(self.kinematics.variables) - set(self.kinematic_coverage))
diff_to_3 = 3 - len(self.kinematic_coverage)
if unused:
self.kinematic_coverage += unused[diff_to_3:]
nkincov = self.kinematic_coverage + unused[diff_to_3:]
else:
self.kinematic_coverage += [f"extra_{i}" for i in range(diff_to_3)]
nkincov = self.kinematic_coverage + [f"extra_{i}" for i in range(diff_to_3)]

object.__setattr__(self, 'process_type', self.process_type.upper())
object.__setattr__(self, 'kinematic_coverage', nkincov)

def __hash__(self):
"""ObservableMetaData is defined by:
Expand Down
2 changes: 1 addition & 1 deletion validphys2/src/validphys/coredata.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class CommonData:
nsys: int
commondata_table: pd.DataFrame = dataclasses.field(repr=False)
systype_table: pd.DataFrame = dataclasses.field(repr=False)
systematics_table: pd.DataFrame = dataclasses.field(init=None, repr=False)
legacy: bool
systematics_table: Optional[pd.DataFrame] = dataclasses.field(init=None, repr=False)
legacy_name: Optional[str] = None
kin_variables: Optional[list] = None

Expand Down

0 comments on commit bb57fe2

Please sign in to comment.