Commit ·
966f93f
1
Parent(s): 9e4bc69
fixing error when no selections applied
Browse files
root_gnn_dgl/root_gnn_base/dataset.py
CHANGED
|
@@ -134,7 +134,7 @@ def print_cutflow(cutflow, title="Cutflow"):
|
|
| 134 |
def selection_mask(data, selections):
|
| 135 |
if len(selections) == 0:
|
| 136 |
first_field = data.fields[0] if len(data.fields) > 0 else None
|
| 137 |
-
return
|
| 138 |
mask = None
|
| 139 |
for selection in selections:
|
| 140 |
current_mask = eval(selection, {"__builtins__": {}}, data) if isinstance(selection, str) else check_selection(data, selection)
|
|
@@ -150,7 +150,7 @@ def compute_cutflow(data, selections):
|
|
| 150 |
cutflow["total"] = len(data[first_field]) if first_field is not None else 0
|
| 151 |
if first_field is None:
|
| 152 |
return cutflow
|
| 153 |
-
running_mask =
|
| 154 |
for i, selection in enumerate(selections):
|
| 155 |
current_mask = eval(selection, {"__builtins__": {}}, data) if isinstance(selection, str) else check_selection(data, selection)
|
| 156 |
running_mask = running_mask & current_mask
|
|
|
|
| 134 |
def selection_mask(data, selections):
|
| 135 |
if len(selections) == 0:
|
| 136 |
first_field = data.fields[0] if len(data.fields) > 0 else None
|
| 137 |
+
return np.ones(len(data[first_field]), dtype=bool) if first_field is not None else None
|
| 138 |
mask = None
|
| 139 |
for selection in selections:
|
| 140 |
current_mask = eval(selection, {"__builtins__": {}}, data) if isinstance(selection, str) else check_selection(data, selection)
|
|
|
|
| 150 |
cutflow["total"] = len(data[first_field]) if first_field is not None else 0
|
| 151 |
if first_field is None:
|
| 152 |
return cutflow
|
| 153 |
+
running_mask = np.ones(cutflow["total"], dtype=bool)
|
| 154 |
for i, selection in enumerate(selections):
|
| 155 |
current_mask = eval(selection, {"__builtins__": {}}, data) if isinstance(selection, str) else check_selection(data, selection)
|
| 156 |
running_mask = running_mask & current_mask
|