Skip to content

Commit

Permalink
small clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
klankinen authored and jasmainak committed Mar 8, 2023
1 parent 01a64dc commit b9a09d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion doc/whats_new.rst
Expand Up @@ -369,4 +369,4 @@ People who contributed to this release (in alphabetical order):
.. _Sarah Pugliese: https://bcs.mit.edu/directory/sarah-pugliese
.. _Stephanie R. Jones: https://github.com/stephanie-r-jones
.. _Steven Brandt: https://github.com/spbrandt
.. _Kaisu Lankinen: http://klankinen.github.io/
.. _Kaisu Lankinen: https://github.com/klankinen
9 changes: 5 additions & 4 deletions hnn_core/optimization.py
Expand Up @@ -479,16 +479,17 @@ def optimize_evoked(net, tstop, n_trials, target_dpl, initial_dpl, maxiter=50,
Evoked drives to optimize. If 'all', will opimize all evoked drives.
If a subset list of evoked drives, will optimize only the evoked drives in the list.
return_rmse : bool
Returns list of unweighted RMSEs between data in dpl and exp_dpl
for each optimization step
Returns list of unweighted RMSEs between the simulated and experimental dipole
waveforms for each optimization step
Returns
-------
net : Network instance
An instance of the Network object with the optimized configuration of
attached drives.
iter_avg_rmse : list of float
Unweighted RMSE between data in dpl and exp_dpl for each iteration
Unweighted RMSE between data in dpl and exp_dpl for each iteration. Returned only
if return_rmse is True
Notes
-----
Expand Down Expand Up @@ -545,7 +546,7 @@ def optimize_evoked(net, tstop, n_trials, target_dpl, initial_dpl, maxiter=50,
opt_params = dict()

if return_rmse is True:
opt_params['iter_avg_rmse'] = []
opt_params['iter_avg_rmse'] = list()

for step in range(len(param_chunks)):
opt_params['cur_step'] = step
Expand Down
16 changes: 7 additions & 9 deletions hnn_core/tests/test_optimization.py
Expand Up @@ -116,20 +116,18 @@ def test_optimize_evoked():
net_empty = net_offset.copy()
del net_empty.external_drives['evprox1']
del net_empty.external_drives['evdist1']
net_opt, rmse = optimize_evoked(net_empty, tstop=tstop,
n_trials=n_trials, target_dpl=dpl_orig,
initial_dpl=dpl_offset, maxiter=10,
return_rmse=True)
net_opt = optimize_evoked(net_empty, tstop=tstop,
n_trials=n_trials, target_dpl=dpl_orig,
initial_dpl=dpl_offset, maxiter=10)

with pytest.raises(ValueError, match='The drives selected to be optimized '
'are not evoked drives'):
net_test_bursty = net_offset.copy()
which_drives = ['bursty1']
net_opt, rmse = optimize_evoked(net_test_bursty, tstop=tstop,
n_trials=n_trials, target_dpl=dpl_orig,
initial_dpl=dpl_offset,
which_drives=which_drives, maxiter=10,
return_rmse=True)
net_opt = optimize_evoked(net_test_bursty, tstop=tstop,
n_trials=n_trials, target_dpl=dpl_orig,
initial_dpl=dpl_offset,
which_drives=which_drives, maxiter=10)

which_drives = ['evprox1'] # drive selected to optimize
maxiter = 10
Expand Down

0 comments on commit b9a09d8

Please sign in to comment.