Use integrator/differentiator with vanishing group delay
I discovered issues with the current implementation of the integrator that's used to calculate the local_timer_deviations
. It is done by computing the cumulative sum (numpy.cumsum
). The equivalent IIR filter reads y[n] = y[n-1] + x[n] \Delta t
. The problem with is the group delay of negative half a sample. This is not a problem if the differentiation is performed by the standard operation y[n] = \frac{x[n] - x[n-1]}{\Delta t}
since it will compensate perfectly the group delay to zero again. The problem becomes noticeable if the sampling rate is changed between integration and differentiation since a half sample delay will be different in terms of absolute time before and after decimation.
I would suggest to use integration and differentiation operations that have zero group delay:
- integration:
y[n] = y[n-1] + \frac{x[n-1] + x[n]}{2}\Delta t
- differentiation:
y[n] = \frac{x[n+1] - x[n-1]}{2\Delta t}