Skip to content

Commit

Permalink
Bugfix for issue 516 (#520)
Browse files Browse the repository at this point in the history
Fixed the bug that drop_idx in build_entry_list was not filled
if no cuts were set by removing the continue condition and
making the default value of cut cut = "" which is changed if
self.cuts is not None and level in self.cuts.keys().

Added continue condition if self.table_list is not None but
not level in self.table_list.keys(). Otherwise the loop over
tables would throw an error.
  • Loading branch information
MoritzNeuberger authored Oct 25, 2023
1 parent 663d352 commit a721fe1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/pygama/flow/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,16 +605,24 @@ def build_entry_list(

# Perform cuts specified for child or parent level, in that order
for level in [child, parent]:
if self.cuts is None or level not in self.cuts.keys():
continue
cut = self.cuts[level]
# Extract the cut condition if given, otherwise set to ""
cut = ""
if self.cuts is not None:
if level in self.cuts.keys():
cut = self.cuts[level]

col_tiers = self.get_tiers_for_col(cut_cols[level], merge_files=False)

# Tables in first tier of event should be the same for all tiers in one level
tables = self.filedb.df.loc[file, f"{self.tiers[level][0]}_tables"]
if self.table_list is not None:
if level in self.table_list.keys():
tables = self.table_list[level]
else:
continue
if tables is None:
continue

# Cut any rows of TCM not relating to requested tables
if level == parent:
f_entries.query(f"{level}_table in {tables}", inplace=True)
Expand Down

0 comments on commit a721fe1

Please sign in to comment.