@@ 217-231 (lines=15) @@ | ||
214 | self.times, self.values, left=0., right=0.) * taufac |
|
215 | return yp * self.dt |
|
216 | ||
217 | def _lt_corr_grad(self, t, tau, tmax=60.): |
|
218 | """Lifetime corrected gradient |
|
219 | ||
220 | Corrects for a finite lifetime by summing over the last `tmax` |
|
221 | days with an exponential decay given of lifetime(s) `taus`. |
|
222 | """ |
|
223 | bs = np.arange(self.dt, tmax + self.dt, self.dt) |
|
224 | ypg = np.zeros_like(t) |
|
225 | tauexp = np.exp(-self.dt / tau) |
|
226 | taufac = np.ones_like(tau) |
|
227 | for b in bs: |
|
228 | taufac *= tauexp |
|
229 | ypg += np.interp(t - self.lag - b / self.days_per_time_unit, |
|
230 | self.times, self.values, left=0., right=0.) * taufac * b |
|
231 | return ypg * self.dt / tau**2 |
|
232 | ||
233 | def get_value(self, t): |
|
234 | t = np.atleast_1d(t) |
|
@@ 201-215 (lines=15) @@ | ||
198 | self.t_adj = -44.25 |
|
199 | super(ProxyModel, self).__init__(*args, **kwargs) |
|
200 | ||
201 | def _lt_corr(self, t, tau, tmax=60.): |
|
202 | """Lifetime corrected values |
|
203 | ||
204 | Corrects for a finite lifetime by summing over the last `tmax` |
|
205 | days with an exponential decay given of lifetime(s) `taus`. |
|
206 | """ |
|
207 | bs = np.arange(self.dt, tmax + self.dt, self.dt) |
|
208 | yp = np.zeros_like(t) |
|
209 | tauexp = np.exp(-self.dt / tau) |
|
210 | taufac = np.ones_like(tau) |
|
211 | for b in bs: |
|
212 | taufac *= tauexp |
|
213 | yp += np.interp(t - self.lag - b / self.days_per_time_unit, |
|
214 | self.times, self.values, left=0., right=0.) * taufac |
|
215 | return yp * self.dt |
|
216 | ||
217 | def _lt_corr_grad(self, t, tau, tmax=60.): |
|
218 | """Lifetime corrected gradient |