Skip to content
Snippets Groups Projects
Commit 1c4d3343 authored by Kilian Lieret's avatar Kilian Lieret
Browse files

Also catch deprecation warnings

parent 079ce30a
No related tags found
1 merge request!90Make d columns configurable
......@@ -72,7 +72,6 @@ class DBFReweighter:
self.signal_side_only = signal_side_only
assert all(col in self.df.columns for col in DBFReweighter.get_required_columns())
@classmethod
def get_required_columns(cls) -> List[str]:
req_cols = [cls.b_mdst_col, cls.b_mdst_tau_col]
......@@ -232,8 +231,11 @@ class DBFReweighter:
# Actual command:
self.df["temp"] = list(zip(*[self.df["temp" + var] for var in decay_vars]))
for w in warning:
assert issubclass(w.category, SettingWithCopyWarning)
assert "A value is trying to be set on a copy" in str(w.message)
is_setting_with_copy_warning = issubclass(w.category, SettingWithCopyWarning)
is_setting_with_copy_warning &= "A value is trying to be set on a copy" in str(w.message)
is_deprecation_warning = issubclass(w.category, DeprecationWarning)
if not is_setting_with_copy_warning | is_deprecation_warning:
raise ValueError(f"Caught warning of category {w.category} and message {w.message}")
self.df.loc[conds, decay_col] = self.df["temp"]
for var in decay_vars:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment