diff --git a/atom_evaluation/scripts/other_calibrations/rwhe_calib_ali.py b/atom_evaluation/scripts/other_calibrations/rwhe_calib_ali.py index bd1478f1..e649f139 100755 --- a/atom_evaluation/scripts/other_calibrations/rwhe_calib_ali.py +++ b/atom_evaluation/scripts/other_calibrations/rwhe_calib_ali.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 import argparse -import json + +from atom_core.dataset_io import loadResultsJSON def main(): @@ -9,18 +10,21 @@ def main(): 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__':