|
4 | 4 |
|
5 | 5 | @author: Giuseppe Chindemi |
6 | 6 | @remark: Copyright (c) 2017, EPFL/Blue Brain Project |
7 | | - This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> |
8 | | - This library is free software; you can redistribute it and/or modify it |
9 | | - under the terms of the GNU Lesser General Public License version 3.0 as |
10 | | - published by the Free Software Foundation. |
| 7 | + This file is part of BluePyOpt |
| 8 | + <https://github.com/BlueBrain/BluePyOpt> |
| 9 | + This library is free software; you can redistribute it and/or modify |
| 10 | + it under the terms of the GNU Lesser General Public License version |
| 11 | + 3.0 as published by the Free Software Foundation. |
11 | 12 | This library is distributed in the hope that it will be useful, but |
12 | 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -48,27 +49,27 @@ def __init__(self, t, v, tstim, params): |
48 | 49 | self.stimidx = np.searchsorted(t, tstim) |
49 | 50 | self.dx = t[1] - t[0] |
50 | 51 | self.nsamples = len(v) |
51 | | - self.params = params |
52 | 52 | # Find voltage baseline |
53 | 53 | bs_stop = np.searchsorted(t, tstim[0]) |
54 | 54 | self.vrest = np.mean(v[:bs_stop]) |
55 | 55 | # Compute time windows where to compare model and data |
56 | 56 | offset = 0.005 # s |
57 | 57 | window = 0.04 # s |
58 | | - window_samples = int(np.round(window/self.dx)) |
59 | | - psp_start = np.searchsorted(t, tstim+offset) |
| 58 | + window_samples = int(np.round(window / self.dx)) |
| 59 | + psp_start = np.searchsorted(t, tstim + offset) |
60 | 60 | psp_stop = psp_start + window_samples |
61 | | - psp_stop[-1] += 2*window_samples # Extend last psp window (RTR case) |
| 61 | + psp_stop[-1] += 2 * window_samples # Extend last psp window (RTR case) |
62 | 62 | self.split_idx = list(zip(psp_start, psp_stop)) |
63 | 63 | # Parameters to be optimized |
64 | 64 | self.params = [bpop.parameters.Parameter(name, bounds=(minval, maxval)) |
65 | | - for name, minval, maxval in self.params] |
| 65 | + for name, minval, maxval in params] |
66 | 66 | # Objectives |
67 | 67 | self.objectives = [bpop.objectives.Objective('interval_%d' % (i,)) |
68 | 68 | for i in xrange(len(self.split_idx))] |
69 | 69 |
|
70 | 70 | def generate_model(self, individual): |
71 | | - """Calls numerical integrator `tmodeint.py` and returns voltage trace based on the input parameters""" |
| 71 | + """Calls numerical integrator `tmodeint.py` and returns voltage trace |
| 72 | + based on the input parameters""" |
72 | 73 |
|
73 | 74 | v, _ = tmodeint.integrate(self.stimidx, self.nsamples, self.dx, |
74 | 75 | self.vrest, *individual) |
|
0 commit comments