python - Interpolaton algorithm to correct a slight clock drift -
i have sampled (univariate) data - clock driving sampling process inaccurate - resulting in random slip of (less than) 1 sample every 30. more accurate clock @ approximately 1/30 of frequency provides reliable samples same data ... allowing me establish estimate of clock drift.
i looking interpolate sampled data correct 'fit' high frequency data low-frequency. need 'real time' - no more latency of few low-frequency samples.
i recognise there wide range of interpolation algorithms - and, among i've considered, spline based approach looks promising data.
i'm working in python - , have found scipy.interpolate package - though see no obvious way use 'stretch' n samples correct small timing error. overlooking something?
i interested in pointers either suitable published algorithm, or - ideally - python library function achieve sort of transform. supported scipy (or else)?
update...
i'm beginning realise what, @ first, seemed trivial problem isn't straightforward first thought. no-longer convinced naive use of splines suffice. i've realised problem can better described without reference 'clock drift'... this:
a single random variable sampled @ 2 different frequencies - 1 low , 1 high, no common divisor - e.g. 5hz , 144hz. if assume sample 0 identical @ both sample rates, sample 1 @5hz falls between samples 28 amd 29. want construct new series - @ 720hz, - fits known data points "as smoothly possible".
i had hoped find 'out of box' solution.
before can ask programming question, seems me need investigate more fundamental scientific one.
before can start picking out particular equations fit badfastclock goodslowclock, should investigate nature of drift. let both clocks run while, , @ points together. badfastclock bad because drifts linearly away real time? if so, simple quadratic equation should fit badfastclock goodslowclock, quadratic equation describes linear acceleration of object in gravity; i.e., if badfastclock accelerating linearly away real time, can deterministically shift badfastclock toward real time. however, if find badfastclock bad because jumping around, smooth curves -- complex smooth curves splines -- won't fit. must understand data before trying manipulate it.
Comments
Post a Comment