Evaluate the piecewise linear function. Parameters ---------- t: np.array of times on which the function is evaluated. deltas: np.array of rate changes at each changepoint. k: Float initial rate. m: Float initial offset. changepoint_ts: np.arr
(t, deltas, k, m, changepoint_ts)
| 1295 | |
| 1296 | @staticmethod |
| 1297 | def piecewise_linear(t, deltas, k, m, changepoint_ts): |
| 1298 | """Evaluate the piecewise linear function. |
| 1299 | |
| 1300 | Parameters |
| 1301 | ---------- |
| 1302 | t: np.array of times on which the function is evaluated. |
| 1303 | deltas: np.array of rate changes at each changepoint. |
| 1304 | k: Float initial rate. |
| 1305 | m: Float initial offset. |
| 1306 | changepoint_ts: np.array of changepoint times. |
| 1307 | |
| 1308 | Returns |
| 1309 | ------- |
| 1310 | Vector y(t). |
| 1311 | """ |
| 1312 | deltas_t = (changepoint_ts[None, :] <= t[..., None]) * deltas |
| 1313 | k_t = deltas_t.sum(axis=1) + k |
| 1314 | m_t = (deltas_t * -changepoint_ts).sum(axis=1) + m |
| 1315 | return k_t * t + m_t |
| 1316 | |
| 1317 | @staticmethod |
| 1318 | def piecewise_logistic(t, cap, deltas, k, m, changepoint_ts): |
no outgoing calls