Skip to content

Commit

Permalink
Merge pull request #2061 from NNPDF/add_normalization_to_hash
Browse files Browse the repository at this point in the history
Add normalization (and comment) to hash of theory
  • Loading branch information
scarlehoff authored May 2, 2024
2 parents 400e5c1 + 2c6c8b7 commit 50d167b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions validphys2/src/validphys/commondataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,18 @@ def parser(cls, yaml_file):
return parse_input(meta, cls)

def __hash__(self):
"""Included in the hash any piece of information that can change the
definition of the theory for a given dataset for functions using a cache"""
"""Include in the hash all pieces of information available for functions using a cache.
This includes also any possible comment in the off-chance it could have a meaning."""
to_be_hashed = [self.operation, self.conversion_factor]
to_be_hashed.append(tuple([tuple(i) for i in self.FK_tables]))
if self.shifts is not None:
to_be_hashed.append(tuple(self.shifts.keys()))
to_be_hashed.append(tuple(self.shifts.values()))
if self.normalization is not None:
to_be_hashed.append(tuple(self.normalization.keys()))
to_be_hashed.append(tuple(self.normalization.values()))
if self.comment is not None:
to_be_hashed.append(self.comment)
return hash(tuple(to_be_hashed))


Expand Down

0 comments on commit 50d167b

Please sign in to comment.