From a980f673d3d403f266bceded5b8ef5c843232bcb Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Fri, 2 Feb 2024 14:12:01 +0000 Subject: [PATCH] saving JSON files to ~/.brainglobe/atlases/validation --- bg_atlasgen/validate_atlases.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 0786e60..2294c7c 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -206,11 +206,18 @@ def validate_atlas(atlas_name, version, validation_functions): print("### Invalid atlases ###") print(invalid_atlases) + # Get the directory path + output_dir_path = str(get_brainglobe_dir() / "atlases/validation") + + # Create the directory if it doesn't exist + if not os.path.exists(output_dir_path): + os.makedirs(output_dir_path) + # Open a file for writing - with open("failed_validations.json", "w") as file: + with open(str(get_brainglobe_dir() / "atlases/validation/failed_validations.json"), "w") as file: # Write the dictionary to the file in JSON format json.dump(failed_validations, file) - with open("successful_validations.json", "w") as file: + with open(str(get_brainglobe_dir() / "atlases/validation/successful_validations.json"), "w") as file: # Write the dictionary to the file in JSON format json.dump(successful_validations, file)