# Mathematical model of equivalent-time sampling, the resulting unevenly spaced periodic signal, and its interpretation

I sample a continuous signal $s(T)$ over time. This leads to $s[t]$, which depends on several factors of which some are (pseudo-) periodic. I am interested in the effect of one such periodic factors and want to look at signal changes during this period under differing experimental conditions. I know the start and end of every period $i$ and said period slowly and slightly varies over time.

Raw signal $s[t]$

My first approach was to estimate the size of the periodic changes by looking at the power spectrum, where under certain conditions the largest peak is indeed around the frequency for the mean period which I know a priori.

Power spectrum $S[\omega]$

For each measurement I know the start and the end time of the current period $i$, say $t_{i,start}$ and $t_{i,end}$. If I calculate the "phase" or relative position in the current period $\varphi(t)=\frac{t-t_{i,start}}{t_{i,start}-t_{i,end}}$ I can reorder my data as such and plot it. Because I have many samples and the frequency of the effect is not correlated to my sampling frequency the phase increase in my reordered data averages out to pretty much linear (so the two images below are almost identical).

Reordered raw data for reordered sample number $s[n]$

Data plotted to phase $s[\varphi]$

Looking around with google I found that this is called Equivalent-Time Sampling (ETS) in some fields. However it is difficult to find a mathematical formulation for this operation, so it is difficult to see really what information I keep and lose from my data.

My question now is broad: is there a formal mathematical way to model ETS (maybe as a filter on a transformed domain?) and how can I make valid observations about the size and qualities (for example waveform) for this effect when using ETS?

Above (when calculating $\varphi$) I implicitly asume that the waveform is stretched if a period is longer, but in reality there might just be a longer delay before a certain impulse is processed again. Might it be better to use an absolute time delay since start of current period? (as $\varphi(t)=t-t_{i,start}$)

Update

So I think the data, once in equivalent time, can also be considered as unevenly spaced timeseries, since $\varphi(t)$ is unevenly spaced due to the differing period lengths. An answer here suggests methods to calculate correlation between unevenly spaced timeseries. With those methods it might be possible to make a comparison between measurements without any filtering and without assuming a certain sampling rate (seems artificially high in the reordered data). Another answer (and this related answer) suggests to use a Kalman filter to smooth the unevenly spaced time series.

Since the physical measurement takes a certain time $t_s$ (leading to the original sampling rate), each sample in $s[t]$ can be seen as a convolution of a sampling function (perhaps a boxcar) $f(T)$ with the continuous physical value function $s(T)$ during the measuring time. I suspect this is different in the questions that are linked above, which regard economical data and might be regarded instantaneous values.

If that is correct, then in equivalent time the highest frequency that is sampled should not be higher than in the real / original time. Unless there is some way to deconvolve the measurements in equivalent time, the sampling rate in both timeframes should be equal. So the high number of samples between the start and the end of the average period should be reduced to match the true sampling rate, before comparing two measurements.

I think that a moving average with subsampling can be performed. This should be set such that the resulting sampling rate equals the original one. Since in equivalent time the samples are unevenly spaced this can not be performed by a filter in the frequency domain. The moving average has to be performed in the temporal domain instead.

Scale phase $\varphi$ to the average period $P$ of all $N$ periods so its unit is equivalent to that of $t$

$t'(\varphi) = \frac{\varphi}{N} \sum_{i=1}^{N} t_{i,end} - t_{i,start}$ to give $s[t']$

Moving average of $s[t']$ for every $nt_s$

$s'[nt_s] = \frac{\sum_{t'\geq (n-1)t_s}^{t'\lt nt_s} s[t']}{\sum_{t'\geq (n-1)t_s}^{t'\lt n t_s} \frac{t'}{t'}}$

Im not sure about the notation since every $t_s$ has a different number of samples and the period length is not equal to an integer number $n$ of $t_s$. In practice you could append $s[t'+P] = s[t']$ and then use $t_s' = \frac{P}{ceil(\frac{P}{t_s})}$, leading to a slightly interpolated result, but at least it is truly periodic.

The resulting waveform has no more detail / higher frequency content than the original signal. This signal can be compared between experiments like any other signal, so at least it is a workable solution.

This might be a poorly constructed method compared to other suggested solutions (Kalman filter, non uniform FFT´s gridding and unevenly spaced time series operators), but its probably easier too. Not sure if I lose any information in the process.