Skip to content

Commit

Permalink
Export jsons for modified parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
rozsatib committed Apr 23, 2024
1 parent 62eece3 commit 85d0a89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mozaik/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def prepare_workflow(simulation_name, model_class):
}
save_json(sim_info, Global.root_directory + 'sim_info.json')
save_json(parameters.to_dict(), Global.root_directory + 'parameters.json')
#save_json(modified_parameters, Global.root_directory + 'modified_parameters.json')
save_json(modified_parameters, Global.root_directory + 'modified_parameters.json')
recorders = get_recorders(parameters.to_dict())
save_json(recorders, Global.root_directory + 'recorders.json')

Expand Down
15 changes: 5 additions & 10 deletions mozaik/meta_workflow/parameter_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import re
from mozaik.cli import parse_parameter_search_args
from mozaik.tools.misc import result_directory_name
import json
from mozaik.tools.json_export import save_json

class ParameterSearchBackend(object):
"""
Expand Down Expand Up @@ -183,10 +185,7 @@ def run_parameter_search(self):

counter=0
combinations = self.generate_parameter_combinations()

f = open(mdn + '/parameter_combinations','wb')
pickle.dump(combinations,f)
f.close()
save_json(mdn + '/parameter_combinations.json')

for combination in combinations:
combination['results_dir']='\"\'' + os.getcwd() + '/' + mdn + '/\'\"'
Expand Down Expand Up @@ -250,9 +249,7 @@ def parameter_search_run_script_distributed_slurm(simulation_name,master_results
core_number : int
How many cores to reserve per process.
"""
f = open(master_results_dir+'/parameter_combinations','rb')
combinations = pickle.load(f)
f.close()
combinations = json.load(master_results_dir + '/parameter_combinations.json')

# 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 @@ -295,9 +292,7 @@ def parameter_search_run_script_distributed_slurm_IoV(simulation_name,master_res
core_number : int
How many cores to reserve per process.
"""
f = open(master_results_dir+'/parameter_combinations','rb')
combinations = pickle.load(f)
f.close()
combinations = json.load(master_results_dir + '/parameter_combinations.json')

# 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 85d0a89

Please sign in to comment.