Commit c03dd09e authored by Manuel Guth's avatar Manuel Guth
Browse files

Merge branch birk-fix-placeholder with refs/heads/master into refs/merge-requests/519/train

parents 33feb435 68c85712
Pipeline #3851085 passed with stages
in 16 minutes and 53 seconds
......@@ -138,6 +138,8 @@ def replace_placeholder_with_file_content(
------
ValueError
If placeholder contains invalid number of colons. Valid numbers are 0, 1, 2
FileNotFoundError
If the file specified in a placeholder does not exist.
"""
print(f"{90 * '-'}\nProcessing {input_file}")
......@@ -159,7 +161,6 @@ def replace_placeholder_with_file_content(
output_file_content = ""
replaced_placeholders = []
skipped_placeholders = []
with open(input_file, "r") as original_file:
# Loop over lines in input file and search for lines containing "§§§"
......@@ -216,15 +217,14 @@ def replace_placeholder_with_file_content(
for line in rep_content.readlines()[start:end]:
replacement += f"{indentation}{line}"
replaced_placeholders.append(replacement_file)
except FileNotFoundError:
replacement = (
f"FileNotFoundError: File '{replacement_file}' not found.\n "
f"\nOriginal line in input file:\n\n{original_line}"
)
skipped_placeholders.append(replacement_file)
# Add to md file
output_file_content += replacement
# Add to md file
output_file_content += replacement
except FileNotFoundError as err:
raise FileNotFoundError(
"\x1b[1;33;40m"
f"file: {input_file}, invalid placeholder: {original_line}"
"\x1b[0m"
) from err
else:
output_file_content += original_line
......@@ -232,8 +232,6 @@ def replace_placeholder_with_file_content(
md_file_new.write(output_file_content)
print("SUMMARY:")
print(f"Replaced placeholders: {replaced_placeholders}")
if len(skipped_placeholders) > 0:
print(f"\x1b[1;33;40mSkipped placeholders: {skipped_placeholders}\x1b[0m")
def main():
......
......@@ -4,6 +4,7 @@
### Latest
- Adding error message if file in placeholder does not exist [!519](https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/umami/-/merge_requests/519)
- Update the LWTNN scripts [!512](https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/umami/-/merge_requests/512)
- Adding pydash to requirements [!517](https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/umami/-/merge_requests/517)
- (Plotting API) Change default value of atlas_second_tag [!514](https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/umami/-/merge_requests/514)
......
......@@ -87,7 +87,7 @@ An explanation how to run on the grid with the TDD can be found [here](https://t
After having the hdf5 ntuples produced, the script [`check_lwtnn-model.py`](https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/umami/-/blob/master/scripts/check_lwtnn-model.py) can be used to compare the athena evaluation with the keras evaluation. The script requiries a short config files which can be found [here](https://gitlab.cern.ch/atlas-flavor-tagging-tools/algorithms/umami/-/blob/master/examples/check_lwtnn-model_config.yaml). This looks like this:
```
§§§examples/check_lwtnn-model_config.yaml§§§
§§§scripts/check_lwtnn-model_config.yaml§§§
```
You can simply run the script via
......
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