From 8771c7711f27af167bc8f398e18c43b67e4c35db Mon Sep 17 00:00:00 2001 From: Johannes Hjorth Date: Mon, 31 May 2021 15:39:23 +0200 Subject: [PATCH] Why is B not written? --- .../synaptic_fitting/optimise_synapses_full.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/snudda/synaptic_fitting/optimise_synapses_full.py b/snudda/synaptic_fitting/optimise_synapses_full.py index 8def98d1b..254b87375 100644 --- a/snudda/synaptic_fitting/optimise_synapses_full.py +++ b/snudda/synaptic_fitting/optimise_synapses_full.py @@ -834,9 +834,8 @@ def sobol_scan(self, assert self.synapse_type == "glut", \ "GABA synapse not supported yet in new version" - print(f"sobol_scan n_trials = {n_trials}") - if parameter_sets is None: + self.write_log(f"sobol_scan n_trials = {n_trials}") parameter_sets = self.setup_parameter_set(model_bounds, n_trials) self.write_log(f"parameter_sets={parameter_sets}") @@ -1023,9 +1022,13 @@ def parallel_optimise_single_cell(self, n_trials=10000, post_opt=False): "ly.sobol_worker_setup(params=params," \ + "synapse_position_override=(synapse_section_id,synapse_section_x))" + self.d_view.execute(f"ly.write_log('TESTING LOG A')", block=True) + self.write_log("Calling sobol_worker_setup") self.d_view.execute(cmd_str_setup, block=True) + self.d_view.execute(f"ly.write_log('TESTING LOG B')", block=True) + cmd_str = ("res = ly.sobol_scan(t_stim = stim_time," " h_peak = peak_height," " parameter_sets=parameter_points," @@ -1038,7 +1041,9 @@ def parallel_optimise_single_cell(self, n_trials=10000, post_opt=False): # 5. Gather worker data self.write_log("Gathering results from workers") - res = self.d_view["res"] + # res = self.d_view["res"] + res = self.d_view.gather("res", block=True) + self.write_log("Results gathered.") for r in res: self.synapse_parameter_data.merge(r) @@ -1052,7 +1057,7 @@ def parallel_optimise_single_cell(self, n_trials=10000, post_opt=False): synapse_position_override=(synapse_model.synapse_section_id, synapse_model.synapse_section_x)) - self.sobol_scan(n_trials=n_trials, + self.sobol_scan(parameter_sets=parameter_points, t_stim=self.stim_time, h_peak=peak_height, model_bounds=model_bounds, @@ -1237,7 +1242,7 @@ def setup_parallel(self, d_view=None): engine_log_file = [[] for x in range(0, len(self.d_view))] n_workers = len(self.d_view) - self.d_view.scatter("engine_log_file", engine_log_file) + self.d_view.scatter("engine_log_file", engine_log_file, block=True) self.d_view.push({"data_file": self.data_file, "synapse_type": self.synapse_type, @@ -1245,7 +1250,7 @@ def setup_parallel(self, d_view=None): "load_parameters": self.load_parameters, "normalise_trace": self.normalise_trace, "neuron_set_file": self.neuron_set_file, - "role": "servant"}) + "role": "servant"}, block=True) cmd_str = ("ly = OptimiseSynapsesFull(data_file=data_file, synapse_parameter_file=synapse_parameter_file, " " synapse_type=synapse_type,role=role, load_parameters=load_parameters,"