diff --git a/examples/howto/optimize_evoked.py b/examples/howto/optimize_evoked.py index 7c8b6000d..0f799517d 100644 --- a/examples/howto/optimize_evoked.py +++ b/examples/howto/optimize_evoked.py @@ -188,7 +188,7 @@ def set_params(net, params): net = jones_2009_model() optim = Optimizer(net, tstop=tstop, constraints=constraints, - set_params=set_params, max_iter=40) + set_params=set_params) with MPIBackend(n_procs=n_procs, mpi_cmd='mpiexec'): optim.fit(target=exp_dpl, scale_factor=scale_factor, smooth_window_len=smooth_window_len) diff --git a/hnn_core/optimization/general_optimization.py b/hnn_core/optimization/general_optimization.py index 40bd87a8c..efe29c8a6 100644 --- a/hnn_core/optimization/general_optimization.py +++ b/hnn_core/optimization/general_optimization.py @@ -113,13 +113,12 @@ def fit(self, **obj_fun_kwargs): relative_bandpower : tuple (if obj_fun='maximize_psd') Weight for each frequency band. """ - if (self.obj_fun_name == 'dipole_rmse' and 'target' not in obj_fun_kwargs): raise Exception('target must be specified') elif (self.obj_fun_name == 'maximize_psd' and - 'f_bands' not in obj_fun_kwargs or - 'relative_bandpower' not in obj_fun_kwargs): + ('f_bands' not in obj_fun_kwargs or + 'relative_bandpower' not in obj_fun_kwargs)): raise Exception('f_bands and relative_bandpower must be specified') constraints = self._assemble_constraints(self.constraints)