Skip to content

Commit

Permalink
now uses the loadResultsJSON() function from dataset_io #939
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazadhum committed May 3, 2024
1 parent e8afa64 commit 4537eda
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions atom_evaluation/scripts/other_calibrations/rwhe_calib_ali.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
#!/usr/bin/env python3

import argparse
import json

from atom_core.dataset_io import loadResultsJSON

def main():

# Parse command line arguments
ap = argparse.ArgumentParser()
ap.add_argument("-json", "--json_file", type=str, required=True,
help="Json file containing input dataset.")
ap.add_argument("-csf", "--collection_selection_function", default=None, type=str,
help="A string to be evaluated into a lambda function that receives a collection name as input and "
"returns True or False to indicate if the collection should be loaded (and used in the "
"optimization). The Syntax is lambda name: f(x), where f(x) is the function in python "
"language. Example: lambda name: int(name) > 5 , to load only collections 6, 7, and onward.")

args = vars(ap.parse_args())

json_file = args['json_file']
collection_selection_function = args['collection_selection_function']

# Read dataset file
f = open(json_file, 'r')
dataset = json.load(f)
dataset, json_file = loadResultsJSON(json_file, collection_selection_function)

# Close dataset file
f.close()

print(dataset)



if __name__ == '__main__':
Expand Down

0 comments on commit 4537eda

Please sign in to comment.