-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address comments and fix test script
- Loading branch information
1 parent
3d18c4c
commit 3828c1b
Showing
3 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,10 @@ | |
of the model simulation to match an experimental dipole waveform. | ||
""" | ||
|
||
# Authors: Blake Caldwell <[email protected]> | ||
# Authors: Carolina Fernandez <[email protected]> | ||
# Nick Tolley <[email protected]> | ||
# Ryan Thorpe <[email protected]> | ||
# Mainak Jas <[email protected]> | ||
# Carolina Fernandez <[email protected]> | ||
|
||
import os.path as op | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# Authors: Mainak Jas <[email protected]> | ||
# Carolina Fernandez <[email protected]> | ||
# Authors: Carolina Fernandez <[email protected]> | ||
|
||
from hnn_core import jones_2009_model, simulate_dipole | ||
from general import Optimizer # change path*** | ||
|
@@ -8,12 +7,14 @@ | |
def _optimize_evoked(solver): | ||
"""Test running the full routine in a reduced network.""" | ||
|
||
tstop = 5. | ||
tstop = 10. | ||
n_trials = 1 | ||
|
||
# simulate a dipole to establish ground-truth drive parameters | ||
net_orig = jones_2009_model() | ||
mu_orig = 6. | ||
net_orig._N_pyr_x = 3 | ||
net_orig._N_pyr_y = 3 | ||
mu_orig = 2. | ||
weights_ampa = {'L2_basket': 0.5, | ||
'L2_pyramidal': 0.5, | ||
'L5_basket': 0.5, | ||
|
@@ -31,6 +32,8 @@ def _optimize_evoked(solver): | |
|
||
# define set_params function and constraints | ||
net_offset = jones_2009_model() | ||
net_offset._N_pyr_x = 3 | ||
net_offset._N_pyr_y = 3 | ||
|
||
def set_params(net_offset, param_dict): | ||
weights_ampa = {'L2_basket': 0.5, | ||
|
@@ -48,8 +51,7 @@ def set_params(net_offset, param_dict): | |
synaptic_delays=synaptic_delays) | ||
|
||
# define constraints | ||
mu_offset = 4. # initial time-shifted drive | ||
mu_range = (2, 8) | ||
mu_range = (1, 6) | ||
constraints = dict() | ||
constraints.update({'mu_offset': mu_range}) | ||
|
||
|
@@ -58,9 +60,9 @@ def set_params(net_offset, param_dict): | |
obj_fun='evoked', tstop=tstop) | ||
optim.fit(dpl_orig.data['agg']) | ||
|
||
opt_param = optim.opt_params | ||
opt_param = optim.opt_params[0] | ||
# the optimized parameter is in the range | ||
assert opt_param[0] in range(mu_range[0], mu_range[1]), "Optimized parameter is not in user-defined range" | ||
assert mu_range[0] <= opt_param <= mu_range[1], "Optimized parameter is not in user-defined range" | ||
|
||
obj = optim.obj | ||
# the number of returned rmse values should be the same as max_iter | ||
|