Skip to content

Commit

Permalink
Fix json loading of parameter search params
Browse files Browse the repository at this point in the history
  • Loading branch information
rozsatib committed Oct 14, 2024
1 parent 9d87bac commit 28e4c35
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mozaik/meta_workflow/parameter_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ def parameter_search_run_script_distributed_slurm(simulation_name,master_results
core_number : int
How many cores to reserve per process.
"""
combinations = json.load(master_results_dir + '/parameter_combinations.json')

with open(master_results_dir + '/parameter_combinations.json', 'r', encoding='utf-8') as f:
combinations = json.load(f)

# first check whether all parameter combinations contain the same parameter names
assert len(set([tuple(set(comb.keys())) for comb in combinations])) == 1 , "The parameter search didn't occur over a fixed set of parameters"

Expand Down Expand Up @@ -292,7 +293,8 @@ def parameter_search_run_script_distributed_slurm_IoV(simulation_name,master_res
core_number : int
How many cores to reserve per process.
"""
combinations = json.load(master_results_dir + '/parameter_combinations.json')
with open(master_results_dir + '/parameter_combinations.json', 'r', encoding='utf-8') as f:
combinations = json.load(f)

# first check whether all parameter combinations contain the same parameter names
assert len(set([tuple(set(comb.keys())) for comb in combinations])) == 1 , "The parameter search didn't occur over a fixed set of parameters"
Expand Down Expand Up @@ -333,9 +335,8 @@ def parameter_search_run_script_distributed_slurm_UK(simulation_name,master_resu
core_number : int
How many cores to reserve per process.
"""
f = open(master_results_dir+'/parameter_combinations','rb')
combinations = pickle.load(f)
f.close()
with open(master_results_dir + '/parameter_combinations.json', 'r', encoding='utf-8') as f:
combinations = json.load(f)

# first check whether all parameter combinations contain the same parameter names
assert len(set([tuple(set(comb.keys())) for comb in combinations])) == 1 , "The parameter search didn't occur over a fixed set of parameters"
Expand Down

0 comments on commit 28e4c35

Please sign in to comment.