From 9f714330a56753ce1dece7e46936b0dbd96e964c Mon Sep 17 00:00:00 2001 From: Kaisu Lankinen Date: Wed, 8 Mar 2023 11:03:11 -0500 Subject: [PATCH] small clarifications --- doc/whats_new.rst | 2 +- hnn_core/optimization.py | 9 +++++---- hnn_core/tests/test_optimization.py | 16 +++++++--------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 9b2d9171f9..cb0e7a4376 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -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 diff --git a/hnn_core/optimization.py b/hnn_core/optimization.py index 68cd254d3b..f2cddc236d 100644 --- a/hnn_core/optimization.py +++ b/hnn_core/optimization.py @@ -479,8 +479,8 @@ 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 ------- @@ -488,7 +488,8 @@ def optimize_evoked(net, tstop, n_trials, target_dpl, initial_dpl, maxiter=50, 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 ----- @@ -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 diff --git a/hnn_core/tests/test_optimization.py b/hnn_core/tests/test_optimization.py index 5c4beb506f..7fdb8e2840 100644 --- a/hnn_core/tests/test_optimization.py +++ b/hnn_core/tests/test_optimization.py @@ -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