Commit 36994392 authored by Alexander Froch's avatar Alexander Froch
Browse files

Merge branch 'svanstro/allow-no-cuts' into 'master'

Small preprocessing changes

See merge request atlas-flavor-tagging-tools/algorithms/umami!383
parents 23517530 9c5bd30c
......@@ -35,6 +35,7 @@ train_variables:
- numberOfSCTSharedHits
- numberOfPixelHoles
- numberOfSCTHoles
#- leptonID
#- AMVFWeightPV
#- ambiRank
#- chiSquaredOverNumberDoF
......@@ -44,5 +45,8 @@ track_train_variables:
tracks:
<<: *tracks_variables
tracks_loose:
<<: *tracks_variables
custom_defaults_vars:
......@@ -47,6 +47,9 @@ def GetSampleCuts(jets, cuts):
cuts = clean_list
for cut_entry in cuts:
if cut_entry is None:
continue
# expect a dictionary with only one entry
cut = list(cut_entry.keys())
if len(cut) != 1:
......
......@@ -90,7 +90,7 @@ class PrepareSamples:
logger.warning("no batch size given. Batch size set to 1,000,000")
self.batch_size = 1_000_000
else:
self.batch_size = self.config.preparation["batchsize"]
self.batch_size = int(self.config.preparation["batchsize"])
def GetBatchesPerFile(self, filename: str):
"""
......
......@@ -340,6 +340,9 @@ class Resampling:
self.outfile_name = self.config.GetFileName(option="resampled")
self.outfile_path = self.config.config["parameters"]["sample_path"]
if os.path.dirname(self.outfile_name):
os.makedirs(os.path.dirname(self.outfile_name), exist_ok=True)
# Get class labels from sampling/preparation.
# Try/Except here for backward compatibility
try:
......@@ -601,7 +604,6 @@ class Resampling:
if create_file:
create_file = False
os.makedirs(os.path.dirname(self.outfile_name), exist_ok=True)
# write to file by creating dataset
with h5py.File(self.outfile_name, "w") as out_file:
out_file.create_dataset(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment