Skip to content

Commit

Permalink
fix conditional statement in fit() method
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandezp committed Apr 2, 2024
1 parent 228efcc commit bba61bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/howto/optimize_evoked.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions hnn_core/optimization/general_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bba61bf

Please sign in to comment.