MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / resample_np

Function resample_np

utils/stepfun.py:376–392  ·  view source on GitHub ↗

numpy version of resample

(t, tp, vp, use_avg=False)

Source from the content-addressed store, hash-verified

374
375
376def 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
395def blur_stepfun(x, y, r):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected