numpy version of resample
(t, tp, vp, use_avg=False)
| 374 | |
| 375 | |
| 376 | def resample_np(t, tp, vp, use_avg=False): |
| 377 | """ |
| 378 | numpy version of resample |
| 379 | """ |
| 380 | eps = np.finfo(t.dtype).eps |
| 381 | if use_avg: |
| 382 | wp = np.diff(tp, axis=-1) |
| 383 | v_numer = resample_np(t, tp, vp * wp, use_avg=False) |
| 384 | v_denom = resample_np(t, tp, wp, use_avg=False) |
| 385 | v = v_numer / np.maximum(eps, v_denom) |
| 386 | return v |
| 387 | |
| 388 | acc = np.cumsum(vp, axis=-1) |
| 389 | acc0 = np.concatenate([np.zeros(acc.shape[:-1] + (1,)), acc], axis=-1) |
| 390 | acc0_resampled = np.vectorize(np.interp, signature='(n),(m),(m)->(n)')(t, tp, acc0) |
| 391 | v = np.diff(acc0_resampled, axis=-1) |
| 392 | return v |
| 393 | |
| 394 | |
| 395 | def blur_stepfun(x, y, r): |
nothing calls this directly
no outgoing calls
no test coverage detected