Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passes variant info to TupleComp for DataSetInput #2085

Merged
merged 1 commit into from
May 18, 2024
Merged
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
16 changes: 8 additions & 8 deletions validphys2/src/validphys/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __hash__(self):

def __repr__(self):
argvals = ', '.join('%s=%r' % vals for vals in zip(self.argnames(), self.comp_tuple))
return '{}({})'.format(self.__class__.__qualname__, argvals)
return f'{self.__class__.__qualname__}({argvals})'


class PDFDoesNotExist(Exception):
Expand Down Expand Up @@ -344,7 +344,7 @@ def __init__(self, *, name, sys, cfac, frac, weight, custom_group, variant):
self.weight = weight
self.custom_group = custom_group
self.variant = variant
super().__init__(name, sys, cfac, frac, weight, custom_group)
super().__init__(name, sys, cfac, frac, weight, custom_group, variant)

def __str__(self):
return self.name
Expand Down Expand Up @@ -428,7 +428,7 @@ def __init__(self, inputs, threshold):
self.threshold = threshold
super().__init__(self.inputs, self.threshold)

@functools.lru_cache()
@functools.lru_cache
def load(self):
# TODO: Update this when a suitable interace becomes available
from validphys.convolution import central_predictions
Expand Down Expand Up @@ -487,7 +487,7 @@ def __init__(self, *, name, commondata, fkspecs, thspec, cuts, frac=1, op=None,

super().__init__(name, commondata, fkspecs, thspec, cuts, frac, op, weight)

@functools.lru_cache()
@functools.lru_cache
def load_commondata(self):
"""Strips the commondata loading from `load`"""
cd = self.commondata.load()
Expand Down Expand Up @@ -562,7 +562,7 @@ def load_cfactors(self):

return [[parse_cfactor(c.open("rb")) for c in cfacs] for cfacs in self.cfactors]

@functools.lru_cache()
@functools.lru_cache
def load_with_cuts(self, cuts):
"""Load the fktable and apply cuts immediately. Returns a FKTableData"""
return load_fktable(self).with_cuts(cuts)
Expand All @@ -586,7 +586,7 @@ def to_unweighted(self):
)
return self

@functools.lru_cache()
@functools.lru_cache
def load_commondata(self):
return self.commondata.load()

Expand Down Expand Up @@ -669,7 +669,7 @@ def __iter__(self):
yield self.name
yield self.path

@functools.lru_cache()
@functools.lru_cache
def as_input(self):
p = self.path / 'filter.yml'
log.debug('Reading input from fit configuration %s', p)
Expand Down Expand Up @@ -930,4 +930,4 @@ def as_pair(self):
return self.label, self.indexes

def __str__(self):
return '{}: {}'.format(self.label, self.indexes)
return f'{self.label}: {self.indexes}'