brian-team/brian2modelfitting

Cannot run another `fit` after `generate`

Closed this issue · 0 comments

It should be possible to create an example trace after fitting, and then to continue fitting (at least in runtime mode), but currently it fails like this (after adding a fits = fitter.generate_traces() in between the two fitting calls in hh_nevergrad_multiruns.py):

Traceback (most recent call last):
  File "hh_nevergrad_multiruns.py", line 75, in <module>
    Cm=[0.1*ufarad*cm**-2 * area, 2*ufarad*cm**-2 * area],)
  File "/home/marcel/programming/brian2modelfitting/brian2modelfitting/fitter.py", line 479, in fit
    callback, restart, **params)
  File "/home/marcel/programming/brian2modelfitting/brian2modelfitting/fitter.py", line 303, in fit
    metric)
  File "/home/marcel/programming/brian2modelfitting/brian2modelfitting/fitter.py", line 229, in optimization_iter
    self.simulator.run(self.duration, d_param, self.parameter_names)
  File "/home/marcel/programming/brian2modelfitting/brian2modelfitting/simulator.py", line 100, in run
    self.network[name].set_states(params, units=False)
  File "/mnt/data/anaconda2/envs/brian2modelfitting/lib/python3.6/site-packages/brian2/core/network.py", line 395, in __getitem__
    raise KeyError('No object with name "%s" found' % item)
KeyError: 'No object with name "neurons" found'