diff --git a/examples/tsodyksmarkramstp/tmevaluator.py b/examples/tsodyksmarkramstp/tmevaluator.py index 6af53f88..db08bb75 100644 --- a/examples/tsodyksmarkramstp/tmevaluator.py +++ b/examples/tsodyksmarkramstp/tmevaluator.py @@ -4,10 +4,11 @@ @author: Giuseppe Chindemi @remark: Copyright (c) 2017, EPFL/Blue Brain Project - This file is part of BluePyOpt - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License version 3.0 as - published by the Free Software Foundation. + This file is part of BluePyOpt + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version + 3.0 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -48,27 +49,27 @@ def __init__(self, t, v, tstim, params): self.stimidx = np.searchsorted(t, tstim) self.dx = t[1] - t[0] self.nsamples = len(v) - self.params = params # Find voltage baseline bs_stop = np.searchsorted(t, tstim[0]) self.vrest = np.mean(v[:bs_stop]) # Compute time windows where to compare model and data offset = 0.005 # s window = 0.04 # s - window_samples = int(np.round(window/self.dx)) - psp_start = np.searchsorted(t, tstim+offset) + window_samples = int(np.round(window / self.dx)) + psp_start = np.searchsorted(t, tstim + offset) psp_stop = psp_start + window_samples - psp_stop[-1] += 2*window_samples # Extend last psp window (RTR case) + psp_stop[-1] += 2 * window_samples # Extend last psp window (RTR case) self.split_idx = list(zip(psp_start, psp_stop)) # Parameters to be optimized self.params = [bpop.parameters.Parameter(name, bounds=(minval, maxval)) - for name, minval, maxval in self.params] + for name, minval, maxval in params] # Objectives self.objectives = [bpop.objectives.Objective('interval_%d' % (i,)) for i in xrange(len(self.split_idx))] def generate_model(self, individual): - """Calls numerical integrator `tmodeint.py` and returns voltage trace based on the input parameters""" + """Calls numerical integrator `tmodeint.py` and returns voltage trace + based on the input parameters""" v, _ = tmodeint.integrate(self.stimidx, self.nsamples, self.dx, self.vrest, *individual)